sendwizz
v1.0.8
Published
Professional WhatsApp Automation SDK.
Maintainers
Readme
SendWizz SDK 🧙♂️
A powerful, developer-friendly, and lightweight Node.js SDK for WhatsApp automation. Built on top of high-performance Baileys connection engine, it allows you to easily send messages, sync contacts, manage session status, and enable advanced AI-powered message processing with absolute zero-code setup.
⚡ Key Features
- Instant Setup: Connect and control WhatsApp sessions in under 5 lines of code.
- Unified AI Message Filtering: Dynamic processing of incoming messages using Gemini or OpenAI engines.
- Zero-Code Config Sync: Automatically synchronizes AI credentials and system instructions from your SendWizz Dashboard.
- Rich Media Formats: Send text, images, videos, audio, document attachments, locations, VCARD contacts, and interactive product cards.
- Robust Reconnection: Automated token refresh and smart retry strategies on network failures.
- TypeScript Native: Full typings, auto-completion, and native support out of the box.
📦 Installation
Install SendWizz using your preferred package manager:
npm install sendwizz🚀 Quick Start
Initialize your bot and listen to ready, QR code, connection, and incoming message events.
const { SendWizz } = require('sendwizz');
const bot = new SendWizz({
sessionId: 'instance-001',
apiKey: 'YOUR_SENDWIZZ_API_KEY', // Get your API Key from the SendWizz Dashboard
printQR: true // Automatically generates standard WhatsApp QR in your terminal!
});
// Start connection loop
bot.init();
// Connection is fully ready
bot.on('ready', async (user) => {
console.log(`🎉 Bot is connected as ${user.name} (${user.id})`);
// 1. Send standard text message
await bot.sendMessage({
to: '923000000000', // JID or Phone number with country code
type: 'text',
message: 'Hello from SendWizz SDK!'
});
});
// Capture incoming QR codes if printQR is false
bot.on('qr', (qr) => {
console.log('New QR code received:', qr);
});
// Capture instance status transitions
bot.on('status', (status) => {
console.log(`Session status changed to: ${status}`); // 'connecting', 'connected', 'qr', 'disconnected'
});🧠 AI-Powered Message Filtering & Processing
With SendWizz AI, you can capture incoming WhatsApp messages, process them through high-performance generative models (e.g., Gemini-1.5-Flash or GPT-4o-Mini), and retrieve the filtered results dynamically in your event listeners!
Option A: Zero-Code Dashboard Configuration (Recommended)
If you have already saved your AI API keys, prompts, and model choices in the SendWizz Dashboard, you only need to set is_ai: true. The SDK will dynamically fetch and apply the configuration securely upon connection startup!
const bot = new SendWizz({
sessionId: 'customer-support-agent',
apiKey: 'YOUR_SENDWIZZ_API_KEY',
is_ai: true // Dynamic sync and filtering enabled!
});
bot.init();
bot.on('message', (msg) => {
console.log('Incoming Plain Text:', msg.message?.conversation);
console.log('AI Filtered Output:', msg.aiResponse); // ✨ Processed directly using your dashboard settings!
});Option B: Direct Configuration & Custom Overrides
You can also pass keys and custom prompts directly inside your code. Direct constructor parameters will always override the dashboard-configured settings.
const bot = new SendWizz({
sessionId: 'billing-assistant',
apiKey: 'YOUR_SENDWIZZ_API_KEY',
is_ai: true,
aiConfig: {
provider: 'gemini', // 'gemini' (default) or 'openai'
apiKey: 'YOUR_GOOGLE_GEMINI_API_KEY',
systemInstruction: 'Translate the message to clean Spanish. Keep responses professional.',
model: 'gemini-1.5-flash' // Custom model override
}
});📂 Sending Rich Message Formats
SendWizz natively supports the full suite of rich WhatsApp interactive message styles:
// 📸 Image message
await bot.sendMessage({
to: '923000000000',
type: 'image',
mediaUrl: 'https://example.com/marketing-banner.jpg',
caption: 'Check out our new premium release!'
});
// 📁 Document attachment
await bot.sendMessage({
to: '923000000000',
type: 'document',
mediaUrl: 'https://example.com/invoice.pdf',
filename: 'Invoice_May_2026.pdf',
mimetype: 'application/pdf'
});
// 📍 Location card
await bot.sendMessage({
to: '923000000000',
type: 'location',
latitude: 24.8607,
longitude: 67.0011
});
// 🏷️ Interactive Business Product card
await bot.sendMessage({
to: '923000000000',
type: 'product',
product: {
id: 'laptop-pro-15',
title: 'MacBook Pro 15"',
description: 'M3 Chip, 16GB Unified RAM, 512GB SSD',
price: 1999,
currency: 'USD',
image: 'https://example.com/macbook.jpg'
},
caption: 'Click below to view this product in our WhatsApp catalog!'
});📇 CRM & Contacts Sync API
Keep your backend contacts database perfectly updated directly via the SDK:
// 1. Get contact list
const contacts = await bot.getContacts({ limit: 10, page: 1 });
// 2. Create contact
const newContact = await bot.createContact({
name: 'Jane Doe',
number: '923009999999',
email: '[email protected]'
});
// 3. Update contact
await bot.updateContact(newContact.id, { name: 'Jane Smith' });
// 4. Delete contact
await bot.deleteContact(newContact.id);🛡️ Robustness & Anti-Ban Best Practices
- Anti-Crash Safety Net: All AI API calls are guarded by try/catch wrappers and 10s HTTP request timeouts, ensuring that slow/offline LLM endpoints never lag or block your WhatsApp event pipeline.
- Anti-Ban Bulk Sending: When looping over numbers, always build in random delays (e.g. 2-5 seconds) to avoid spam flag triggering:
const delay = ms => new Promise(res => setTimeout(res, ms)); for (const contact of contactList) { await bot.sendMessage({ to: contact.number, message: contact.text }); const randomDelay = Math.floor(Math.random() * (5000 - 2000 + 1)) + 2000; await delay(randomDelay); // Wait 2s to 5s before next message }
📄 License
MIT © SendWizz Inc.
