Send a message to a phone number via your preferred channel. Messages are processed asynchronously - the API returns immediately with a queued status.
Request
Recipient phone number in E.164 format (e.g., +56912345678)
Message content. Required if templateId is not provided.
ID of a pre-approved template to use. If provided, text is ignored.
Variables to substitute in the template. Keys must match template variables.
Channel to use: sms, whatsapp, telegram, rcs, email, or auto.When set to auto, the sender’s routing policy determines the channel.
Custom key-value pairs to attach to the message. Useful for tracking.
Unique key to prevent duplicate sends. If a message with this key exists, returns 409 Conflict.
Bearer token: Bearer zv_live_xxx
Override the default sender. Format: sender ID (e.g., snd_abc123)
Response
Unique message identifier
Channel used (sms, whatsapp, etc.)
Message status: queued, sending, delivered, failed
Message content (rendered if using template)
{
"message": {
"id": "msg_abc123xyz",
"to": "+56912345678",
"channel": "sms",
"status": "queued",
"text": "Hello from Zavu!",
"metadata": {},
"createdAt": "2024-01-15T10:30:00.000Z"
}
}
Examples
Send SMS
curl -X POST https://api.zavu.dev/v1/messages \
-H "Authorization: Bearer zv_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"to": "+56912345678",
"text": "Your verification code is 123456",
"channel": "sms"
}'
Send WhatsApp
curl -X POST https://api.zavu.dev/v1/messages \
-H "Authorization: Bearer zv_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"to": "+56912345678",
"text": "Hello from Zavu!",
"channel": "whatsapp"
}'
Using a Template
curl -X POST https://api.zavu.dev/v1/messages \
-H "Authorization: Bearer zv_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"to": "+56912345678",
"templateId": "tpl_abc123",
"data": {
"name": "John",
"orderId": "12345"
}
}'
With Idempotency Key
curl -X POST https://api.zavu.dev/v1/messages \
-H "Authorization: Bearer zv_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"to": "+56912345678",
"text": "Order #12345 confirmed!",
"idempotencyKey": "order-12345-confirmation"
}'
With Custom Sender
curl -X POST https://api.zavu.dev/v1/messages \
-H "Authorization: Bearer zv_live_xxx" \
-H "Zavu-Sender: snd_marketing123" \
-H "Content-Type: application/json" \
-d '{
"to": "+56912345678",
"text": "Check out our new products!"
}'