Appearance
Send Text Message
Send a plain-text WhatsApp message to any phone number.
POST /api/v1/messages/send
Request
http
POST /api/v1/messages/send HTTP/1.1
Authorization: Bearer wzy_your_key_here
Content-Type: application/jsonRequest body
json
{
"account_id": 1,
"to": "+201234567890",
"message": "Hello! Your order has been shipped."
}| Field | Type | Required | Description |
|---|---|---|---|
account_id | integer | ✅ | The id of the WhatsApp account to send from. Retrieve it from GET /accounts. |
to | string | ✅ | Recipient phone number. Accepts +201234567890, 201234567890, or 00201234567890. |
message | string | ✅ | Plain text body. Max 4096 characters. |
Response
json
{
"success": true,
"message_id": "wamid.HBgLMjAxMjM0NTY3ODkVAgASGCA...",
"to": "201234567890"
}| Field | Type | Description |
|---|---|---|
success | boolean | true when Meta accepted the message |
message_id | string | WhatsApp message ID (WAMID) — use this to correlate status updates from webhooks |
to | string | Normalized recipient number (no + prefix) |
Error — account not found
json
{
"error": "Account not found or not owned by this API key."
}HTTP 404.
Error — send failure (422)
json
{
"error": "Failed to send message: The phone number is not registered on WhatsApp."
}Examples
bash
curl -X POST https://whatsapp-backend.developnetwork.net/api/v1/messages/send \
-H "Authorization: Bearer wzy_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"account_id": 1,
"to": "+201234567890",
"message": "Hello! Your order has been shipped."
}'js
const res = await fetch('https://whatsapp-backend.developnetwork.net/api/v1/messages/send', {
method: 'POST',
headers: {
'Authorization': 'Bearer wzy_your_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
account_id: 1,
to: '+201234567890',
message: 'Hello! Your order has been shipped.',
}),
})
const result = await res.json()
console.log(result.message_id) // wamid.HBgL...python
import requests
r = requests.post(
'https://whatsapp-backend.developnetwork.net/api/v1/messages/send',
headers={'Authorization': 'Bearer wzy_your_key_here'},
json={
'account_id': 1,
'to': '+201234567890',
'message': 'Hello! Your order has been shipped.',
},
)
print(r.json())php
$ch = curl_init('https://whatsapp-backend.developnetwork.net/api/v1/messages/send');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer wzy_your_key_here',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'account_id' => 1,
'to' => '+201234567890',
'message' => 'Hello! Your order has been shipped.',
]),
]);
$result = json_decode(curl_exec($ch), true);
echo $result['message_id'];Notes
- 24-hour window: WhatsApp only allows free-form text messages within 24 hours of the last message from the customer. Outside that window, you must use a template message.
- Phone format: The
+,00prefix and spaces are stripped automatically. Just pass the full international number. - Status updates (delivered, read, failed) are delivered via webhooks.