Overview
Send text, media, or template messages to any WhatsApp number. Messages are queued and processed asynchronously for reliable delivery.
Request Body
The ID of the WhatsApp instance to send from
The recipient’s phone number in international format (without + or spaces). Example: 5511999999999
The text message content. Required for text messages.
URL of the media file to send (image, video, audio, or document)
Type of media: image, video, audio, or document. Required when sending media.
Filename for document attachments
Caption for media messages
ID of a message to reply to
Custom metadata to attach to the message (returned in webhooks)
Response
Indicates if the message was queued successfully
Unique identifier for the message
Current status: queued, sent, delivered, read, or failed
ISO 8601 timestamp of when the message was queued
Examples
Send Text Message
const response = await client.messages.send({
instanceId: 'inst_abc123',
to: '5511999999999',
message: 'Hello! How can I help you today?'
});
{
"success": true,
"messageId": "msg_xyz789",
"status": "queued",
"timestamp": "2026-02-03T12:00:00.000Z"
}
Send Image Message
const response = await client.messages.send({
instanceId: 'inst_abc123',
to: '5511999999999',
mediaUrl: 'https://example.com/image.jpg',
mediaType: 'image',
caption: 'Check out our new product!'
});
Send Document
const response = await client.messages.send({
instanceId: 'inst_abc123',
to: '5511999999999',
mediaUrl: 'https://example.com/invoice.pdf',
mediaType: 'document',
filename: 'Invoice-2026-001.pdf',
caption: 'Here is your invoice'
});
Reply to a Message
const response = await client.messages.send({
instanceId: 'inst_abc123',
to: '5511999999999',
message: 'Thanks for your question! Here is the answer...',
quotedMessageId: 'msg_original123'
});
| Type | Supported Formats | Max Size |
|---|
image | JPEG, PNG, WebP | 5 MB |
video | MP4, 3GP | 16 MB |
audio | MP3, OGG, AAC | 16 MB |
document | PDF, DOC, DOCX, XLS, XLSX, PPT, PPTX, TXT | 100 MB |
Error Codes
| Code | Description |
|---|
invalid_instance | The instance ID is invalid or doesn’t exist |
instance_disconnected | The WhatsApp instance is not connected |
invalid_phone_number | The phone number format is invalid |
media_too_large | The media file exceeds the size limit |
unsupported_media_type | The media type is not supported |
rate_limit_exceeded | You’ve exceeded your message rate limit |
insufficient_credits | Your account doesn’t have enough credits |
Webhooks
When the message status changes, you’ll receive webhook events:
message.sent - Message was sent to WhatsApp
message.delivered - Message was delivered to the recipient
message.read - Recipient read the message
message.failed - Message delivery failed
See Webhooks Overview for more details.