Send a Message
The 24-hour rule
Section titled “The 24-hour rule”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.
Send a template
Section titled “Send a template”Use this to start a conversation or message outside the 24h window.
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" } ] } ] }'Send a text (inside the 24h window)
Section titled “Send a text (inside the 24h window)”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." }'Send media (image, PDF, video, audio)
Section titled “Send media (image, PDF, video, audio)”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 -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 -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).
Body fields
Section titled “Body fields”| Field | Type | Required | Description |
|---|---|---|---|
| to | string | Yes | Destination phone, any format (normalized to E.164). |
| type | string | text, template, image, document, video, or audio. Defaults to text. | |
| body | string | The message text. Required when type is text. | |
| media_url | string | Public HTTPS URL of the file. Required when type is image/document/video/audio. | |
| caption | string | Optional caption for image/video/document. | |
| filename | string | Optional display filename for document (e.g. Invoice.pdf). | |
| template_name | string | The approved template’s name. Required when type is template. | |
| language_code | string | Template language, e.g. en, en_US. Defaults to en. | |
| components | array | Template variable values (header/body/button parameters), per the WhatsApp template component format. | |
| name | string | Optional contact name to set if this creates a new conversation. |
Response
Section titled “Response”{ "messaging_product": "whatsapp", "messages": [ { "id": "wamid.HBg...", "message_status": "accepted" } ]}