Messages β
All send endpoints are POST with a JSON body. They share these fields:
| Field | Type | |
|---|---|---|
session | string | The session (linked number) to send from. |
to | string | Phone number with country code (6281234567890), group id, or full JID. |
is_group | boolean | Optional. Set true when to is a group id. |
Before sending, the gateway checks that a phone number is registered on WhatsApp and answers 400 6281234567890 is not registered on WhatsApp if it isn't. Anything in to that isn't a number, group id or JID (a name, an email, a username) is rejected right away. WhatsApp usernames are not supported.
The response contains the sent message. Its key.id is the message ID you'll see again in message.status webhooks:
{
"data": {
"key": { "remoteJid": "6281234567890@s.whatsapp.net", "fromMe": true, "id": "3EB0C4F1A2B3D4E5" },
"message": { "extendedTextMessage": { "text": "Hello" } },
"messageTimestamp": "1764584460"
}
}Before sending text, images, videos and documents, the number shows typing⦠for a moment (up to 5 seconds, depending on the text length), like a person would.
Media URLs
Media is sent from a public http(s) URL: the gateway downloads it and uploads it to WhatsApp. Local file paths are not accepted.
Send text β
POST /message/send-text{ "session": "sales", "to": "6281234567890", "text": "Your order #1042 has shipped π¦" }curl -X POST http://YOUR_SERVER:5001/message/send-text \
-H "key: wag_your_key" -H "content-type: application/json" \
-d '{"session":"sales","to":"6281234567890","text":"Your order #1042 has shipped π¦"}'await fetch("http://YOUR_SERVER:5001/message/send-text", {
method: "POST",
headers: { key: "wag_your_key", "content-type": "application/json" },
body: JSON.stringify({ session: "sales", to: "6281234567890", text: "Your order #1042 has shipped π¦" }),
});import requests
requests.post(
"http://YOUR_SERVER:5001/message/send-text",
headers={"key": "wag_your_key"},
json={"session": "sales", "to": "6281234567890", "text": "Your order #1042 has shipped π¦"},
)$ch = curl_init('http://YOUR_SERVER:5001/message/send-text');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['key: wag_your_key', 'content-type: application/json'],
CURLOPT_POSTFIELDS => json_encode(['session' => 'sales', 'to' => '6281234567890', 'text' => 'Your order #1042 has shipped π¦']),
]);
$response = curl_exec($ch);To a group:
{ "session": "sales", "to": "120363012345678901", "is_group": true, "text": "Hello team" }Send image β
POST /message/send-image{
"session": "sales",
"to": "6281234567890",
"text": "Here's your receipt",
"image_url": "https://example.com/receipt.png"
}text is the caption.
Send video β
POST /message/send-video{ "session": "sales", "to": "6281234567890", "video_url": "https://example.com/demo.mp4", "text": "Optional caption" }Send document β
POST /message/send-document{
"session": "sales",
"to": "6281234567890",
"text": "Invoice for December",
"document_url": "https://example.com/files/invoice-1042.pdf",
"document_name": "Invoice-1042.pdf"
}document_name is the file name the recipient sees and must include the extension. The file type is taken from it (pdf, docx, xlsx, csv, zip, β¦).
Send audio β
POST /message/send-audio{ "session": "sales", "to": "6281234567890", "audio_url": "https://example.com/hello.ogg", "as_voice_note": true }With as_voice_note: true the audio is sent as a voice note (push-to-talk). Voice notes play best as OGG/Opus.
Send sticker β
POST /message/send-sticker{ "session": "sales", "to": "6281234567890", "image_url": "https://example.com/sticker.webp" }Send poll β
POST /message/send-poll{
"session": "sales",
"to": "6281234567890",
"name": "Which delivery slot works best?",
"options": ["Morning", "Afternoon", "Evening"],
"selectable_count": 1
}2 to 12 options. selectable_count is how many options a person may pick (default 1). Votes show up live in the inbox and in the History API.
Deprecated: send text with GET β
GET /message/send-text?session=sales&to=6281234567890&text=Hello&key=wag_your_keyKept for v4 compatibility. Prefer POST: query strings end up in server and proxy logs, key included.