Send a message
/api/v1/messagesSend a WhatsApp message to a phone number. Send text to reply within 24 hours of the customer's last message, or an approved template at any time (order updates, reminders, offers). The contact is created if it's new.
Body
tostringrequiredPhone number with country code, e.g.
+919876543210. Spaces and dashes are fine.textstringFree text, up to 4096 characters. Only works inside the 24-hour reply window.
template.namestringName of an approved template.
template.languagestringLanguage code such as
enorhi. Optional if you have only one language.template.bodyParamsstring[]Values for {{1}}, {{2}}… in the template body, in order. Send exactly as many as the template has.
template.headerParamsstring[]The value for {{1}} in a text header.
template.headerMediaUrlstringImage, video or document headers: a public https link to the file (JPG/PNG up to 5 MB, MP4 up to 16 MB, PDF up to 100 MB).
template.headerMediaFilenamestringDocument headers: the file name customers see, like
Invoice-1042.pdf.template.locationobjectLocation headers:
latitudeandlongitude, with optionalnameandaddress.template.urlParamsstring[]Dynamic website buttons: the value added after the link, one per dynamic button, in button order.
template.quickReplyPayloadsstring[]Quick reply buttons: your own reference for each one, in button order, up to 256 characters. It comes back as
buttonPayloadin themessage.receivedwebhook when the customer taps it.template.offerCodestringCopy offer code buttons: the code customers copy, up to 20 characters.
template.codestringAuthentication templates: the one-time code. It fills the message and the Copy code or autofill button.
- •Send either
textortemplate, never both. - •If the 24-hour window is closed, a
textsend fails with 400. Send a template instead. - •Templates are not sent to contacts who replied STOP (400).
- •A template send that leaves out a value the template needs, like a header image or a dynamic link, fails with 400 and says which field is missing. GET /templates lists what each template takes.
- •Phone number, Call on WhatsApp, static website and form buttons need nothing at send time. See Sending templates for an example of every kind.
curl -X POST "https://www.chatpaat.com/api/v1/messages" \
-H "Authorization: Bearer $CHATPAAT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to":"+919876543210","template":{"name":"order_shipped","language":"en","bodyParams":["Priya","#CP2041"]}}'{
"id": "cm2k8z3ab0002ab12cd34ef56",
"wamid": "wamid.HBgMOTE5ODc2NTQzMjEwFQIAERgS",
"status": "sent",
"contactId": "cm2k8x1q40001ab12cd34ef56"
}