Skip to main content
POST
https://api.enviaai.app
/
v1
/
messages
/
send
Send Message
curl --request POST \
  --url https://api.enviaai.app/v1/messages/send \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "instanceId": "<string>",
  "to": "<string>",
  "message": "<string>",
  "mediaUrl": "<string>",
  "mediaType": "<string>",
  "filename": "<string>",
  "caption": "<string>",
  "quotedMessageId": "<string>",
  "metadata": {}
}
'
{
  "success": true,
  "messageId": "msg_xyz789",
  "status": "queued",
  "timestamp": "2026-02-03T12:00:00.000Z"
}

Overview

Send text, media, or template messages to any WhatsApp number. Messages are queued and processed asynchronously for reliable delivery.

Request Body

instanceId
string
required
The ID of the WhatsApp instance to send from
to
string
required
The recipient’s phone number in international format (without + or spaces). Example: 5511999999999
message
string
The text message content. Required for text messages.
mediaUrl
string
URL of the media file to send (image, video, audio, or document)
mediaType
string
Type of media: image, video, audio, or document. Required when sending media.
filename
string
Filename for document attachments
caption
string
Caption for media messages
quotedMessageId
string
ID of a message to reply to
metadata
object
Custom metadata to attach to the message (returned in webhooks)

Response

success
boolean
Indicates if the message was queued successfully
messageId
string
Unique identifier for the message
status
string
Current status: queued, sent, delivered, read, or failed
timestamp
string
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'
});

Supported Media Types

TypeSupported FormatsMax Size
imageJPEG, PNG, WebP5 MB
videoMP4, 3GP16 MB
audioMP3, OGG, AAC16 MB
documentPDF, DOC, DOCX, XLS, XLSX, PPT, PPTX, TXT100 MB

Error Codes

CodeDescription
invalid_instanceThe instance ID is invalid or doesn’t exist
instance_disconnectedThe WhatsApp instance is not connected
invalid_phone_numberThe phone number format is invalid
media_too_largeThe media file exceeds the size limit
unsupported_media_typeThe media type is not supported
rate_limit_exceededYou’ve exceeded your message rate limit
insufficient_creditsYour 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.