Easy Way
The simplest way to send messages with Zavu
Send your first message in seconds. Zavu handles channel selection, delivery optimization, and fallbacks automatically.
Quick Start
import Zavudev from '@zavudev/sdk';
const zavu = new Zavudev({
apiKey: process.env['ZAVUDEV_API_KEY'], // This is the default and can be omitted
});
const result = await zavu.messages.send({
to: "+14155551234",
text: "Hello from Zavu!",
});
That's it. Zavu automatically:
- Respects user preference: When a user messages you first, we reply on the same channel they used
- Optimizes outbound: For business-initiated messages, selects the optimal channel based on cost and delivery rates
- Falls back intelligently: Tries alternative channels if delivery fails
- Tracks everything: Delivery status updates via API and webhooks
How It Works
When you send a message without specifying a channel, your default Sender handles routing:
CodeYour Message → Default Sender → Smart Routing → Best Channel → Delivery
Senders
A Sender is a configuration that defines how messages are sent. Each Sender has:
- Channels: Which channels are available (SMS, WhatsApp, etc.)
- Routing Policy:
smart(automatic) ormanual(you choose) - Phone Numbers: Configured for each channel
Using a Specific Sender
If you have multiple Senders (e.g., "Marketing" and "Support"), specify which one to use:
const result = await zavu.messages.send({
to: "+14155551234",
text: "Your order has shipped!",
"Zavu-Sender": "snd_abc123",
});
Specifying a Channel
For full control, specify the channel directly:
const result = await zavu.messages.send({
to: "+14155551234",
text: "Hello!",
channel: "whatsapp",
});
Available channels: sms, whatsapp
Response
A successful request returns the message details:
JSON{ "message": { "id": "msg_abc123", "to": "+14155551234", "text": "Hello from Zavu!", "channel": "whatsapp", "status": "queued", "createdAt": "2024-01-15T10:30:00.000Z" } }
| Status | Description |
|---|---|
queued | Message accepted, pending delivery |
sent | Sent to carrier/provider |
delivered | Confirmed delivered |
read | User opened the message (WhatsApp only) |
failed | Delivery failed |
Next Steps
- Smart Routing - Learn how automatic channel selection saves up to 90% on messaging costs
- SMS Guide - SMS-specific features and best practices
- WhatsApp Guide - Rich messaging with media, buttons, and templates
API Reference
- Send a message — full HTTP reference for the
/v1/messagesendpoint - Get a message by ID — retrieve delivery status and metadata
- List messages — fetch sent messages with filtering and pagination