Send a text message
Send your own text to a customer inside WhatsApp's 24-hour customer service window.
Sends free-form text to a customer. WhatsApp only allows this within 24 hours of the customer’s last message — outside that window, send a template instead.
POST
/api/external/send-messageRequest body
| Field | Type | Required | Description |
|---|---|---|---|
to | string | Yes | The recipient’s number with country code, for example +971501234567. |
body | string | Yes | The message text, up to 4,096 characters. |
Examples
curl -X POST "https://YOUR_WORKSPACE_DOMAIN/api/external/send-message" \
-H "Authorization: Bearer $WAZLINE_TOKEN" \
-H "Origin: https://yourstore.com" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{ "to": "+971501234567", "body": "Hi Sara, your order #4821 is out for delivery." }'
// Node.js 18 or later
const res = await fetch('https://YOUR_WORKSPACE_DOMAIN/api/external/send-message', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.WAZLINE_TOKEN}`,
Origin: 'https://yourstore.com',
'Content-Type': 'application/json',
Accept: 'application/json',
},
body: JSON.stringify({
to: '+971501234567',
body: 'Hi Sara, your order #4821 is out for delivery.',
}),
});
const data = await res.json();
Response
{
"success": true,
"message_id": 18343,
"wa_message_id": "wamid.HBgMOTcxNTAxMjM0NTY3FQIAERgS..."
}
Errors
| Status | error_code | What to do |
|---|---|---|
| 422 | window_closed | The customer hasn’t messaged in the last 24 hours. Send an approved template instead. |
| 422 | number_not_found | No WhatsApp number is linked to this token. Check the API client in Wazline. |
| 422 | invalid_number | Include the country code. |
| 422 | invalid_payload | to or body is missing, empty or longer than 4,096 characters. |
| 502 | send_failed | WhatsApp rejected the message. Try again shortly. |
Which endpoint should I use?
| send-template | send-message | |
|---|---|---|
| Outside the 24-hour window | Yes | No |
| Content | An approved template, with variables | Any text up to 4,096 characters |
| Typical use | Notifications, confirmations, reminders | Replies while a conversation is active |
Tip: A common pattern is to call
send-messagefirst and, if it returnswindow_closed, fall back tosend-template.
Still have questions?
Contact usOur team is happy to walk you through Wazline and help you set up your workspace.