Skip to content

Send a Message

WhatsApp only allows free-form text within 24 hours of the customer’s last message. Outside that window (or to start a fresh conversation), you must send an approved template. Whatbot follows this automatically — pick the right type.

Use this to start a conversation or message outside the 24h window.

cURL
curl -X POST https://api.whatbot.in/public/v1/messages \
-H "X-API-Key: wa_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"to": "9876543210",
"type": "template",
"template_name": "order_update",
"language_code": "en",
"components": [
{ "type": "body", "parameters": [ { "type": "text", "text": "Ravi" } ] }
]
}'
cURL
curl -X POST https://api.whatbot.in/public/v1/messages \
-H "X-API-Key: wa_live_xxx" \
-H "Content-Type: application/json" \
-d '{ "to": "9876543210", "type": "text", "body": "Thanks! Your order ships today." }'

Set type to image, document, video, or audio and pass a public media_url — Whatbot hands the link to WhatsApp, which fetches it (no upload step). The file must be reachable over public HTTPS and within WhatsApp’s size limits (image 5 MB, document/video 16 MB, audio 16 MB). Like text, media is a service message — it delivers inside the 24-hour window; outside it, send a template with a media header instead.

Send a PDF (document):

cURL
curl -X POST https://api.whatbot.in/public/v1/messages \
-H "X-API-Key: wa_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"to": "9876543210",
"type": "document",
"media_url": "https://example.com/invoices/INV-1042.pdf",
"filename": "Invoice INV-1042.pdf",
"caption": "Your invoice"
}'

Send an image:

cURL
curl -X POST https://api.whatbot.in/public/v1/messages \
-H "X-API-Key: wa_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"to": "9876543210",
"type": "image",
"media_url": "https://example.com/photos/site.jpg",
"caption": "Site photo"
}'

type: "video" and type: "audio" work the same way (video takes an optional caption; audio takes neither caption nor filename).

FieldTypeRequiredDescription
tostringYesDestination phone, any format (normalized to E.164).
typestringtext, template, image, document, video, or audio. Defaults to text.
bodystringThe message text. Required when type is text.
media_urlstringPublic HTTPS URL of the file. Required when type is image/document/video/audio.
captionstringOptional caption for image/video/document.
filenamestringOptional display filename for document (e.g. Invoice.pdf).
template_namestringThe approved template’s name. Required when type is template.
language_codestringTemplate language, e.g. en, en_US. Defaults to en.
componentsarrayTemplate variable values (header/body/button parameters), per the WhatsApp template component format.
namestringOptional contact name to set if this creates a new conversation.
200
{
"messaging_product": "whatsapp",
"messages": [ { "id": "wamid.HBg...", "message_status": "accepted" } ]
}