@simo777/whatsapp-baileys-sdk
v1.0.0
Published
TypeScript SDK for the WhatsApp Baileys Plugin
Downloads
135
Readme
WhatsApp Baileys SDK
A TypeScript SDK for interacting with the WhatsApp Baileys Plugin API.
Installation
pnpm add @simo777/whatsapp-baileys-sdkUsage
import { WhatsAppSDK } from '@simo777/whatsapp-baileys-sdk';
const sdk = new WhatsAppSDK({
baseUrl: 'http://localhost:3002/api/v1',
// apiKey: 'your-optional-api-key'
});
// Create a session
const session = await sdk.createSession({
name: 'My Session',
topics: ['message.inbound', 'session.status']
});
// Get session status / QR code
const status = await sdk.getSession(session.id);
console.log(status.qr);
// Send a message
await sdk.sendMessage(session.id, {
jid: '[email protected]',
text: 'Hello from SDK!'
});
// Send media
await sdk.sendMessage(session.id, {
jid: '[email protected]',
media: {
url: 'https://example.com/image.jpg',
type: 'image',
caption: 'Optimized image'
}
});API Features
- Session Management: Create, delete, and monitor WhatsApp sessions.
- Message Sending: Text, media (images, video, audio, documents), mentions, and replies.
- History & Conversations: Fetch message history and active conversation lists.
- Webhook Topics: Dynamically update event filtering topics.
- Type Safe: Fully written in TypeScript with complete interface definitions.
Requirements
This SDK is designed to work with the @simo777/whatsapp-baileys-plugin for Fastify.
Created with ❤️ for the WhatsApp integration community.
