Skip to main content
POST
/
v1
/
messages
Send Message
curl --request POST \
  --url https://api.zavu.dev/v1/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "to": "<string>",
  "text": "<string>",
  "templateId": "<string>",
  "data": {},
  "channel": "<string>",
  "metadata": {},
  "idempotencyKey": "<string>"
}'
{
  "message": {
    "id": "msg_abc123xyz",
    "to": "+56912345678",
    "channel": "sms",
    "status": "queued",
    "text": "Hello from Zavu!",
    "metadata": {},
    "createdAt": "2024-01-15T10:30:00.000Z"
  }
}
Send a message to a phone number via your preferred channel. Messages are processed asynchronously - the API returns immediately with a queued status.

Request

to
string
required
Recipient phone number in E.164 format (e.g., +56912345678)
text
string
Message content. Required if templateId is not provided.
templateId
string
ID of a pre-approved template to use. If provided, text is ignored.
data
object
Variables to substitute in the template. Keys must match template variables.
channel
string
default:"auto"
Channel to use: sms, whatsapp, telegram, rcs, email, or auto.When set to auto, the sender’s routing policy determines the channel.
metadata
object
Custom key-value pairs to attach to the message. Useful for tracking.
idempotencyKey
string
Unique key to prevent duplicate sends. If a message with this key exists, returns 409 Conflict.

Headers

Authorization
string
required
Bearer token: Bearer zv_live_xxx
Zavu-Sender
string
Override the default sender. Format: sender ID (e.g., snd_abc123)

Response

message
object
{
  "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!"
  }'