List Templates
A template is the only thing that delivers outside the 24-hour messaging window, so you need one before you can message a number that has never written to you. This lists what is available and what each one expects.
curl https://api.whatbot.in/public/v1/templates \ -H "X-API-Key: wa_live_xxx"Query parameters
Section titled “Query parameters”| Field | Type | Required | Description |
|---|---|---|---|
| refresh | boolean | Bypass the ~60s cache and re-fetch from WhatsApp. Defaults to false. |
Templates are read from the WhatsApp Business Account of the workspace’s default number.
Response
Section titled “Response”| Field | Type | Required | Description |
|---|---|---|---|
| templates | array | Approved templates. Empty if none, or if the lookup failed. | |
| templates_known | boolean | false when the lookup failed and templates is empty for that reason. |
Each template carries:
| Field | Type | Required | Description |
|---|---|---|---|
| id | string | WhatsApp’s template id. | |
| name | string | Pass this as template_name when sending. | |
| language | string | Language code, e.g. en. Pass it as language_code. | |
| status | string | Always APPROVED here. | |
| category | string | e.g. MARKETING, UTILITY, AUTHENTICATION. | |
| rejected_reason | string | WhatsApp’s field; not meaningful for an approved template. | |
| body_text | string | The body, with {{1}}-style placeholders. | |
| header_format | string | TEXT, IMAGE, VIDEO, DOCUMENT, LOCATION or NONE. | |
| header_text | string | The header text when header_format is TEXT, else empty. | |
| footer_text | string | The footer text, or empty. | |
| buttons | array | Each button as {type, text, index}; URL buttons also carry url and has_variable. | |
| variables | array | Every value the template needs at send time, as {component, index} — HEADER / BODY placeholders by number, plus BUTTON entries (with sub_type url, copy_code or otp) for buttons that take a value. Sorted by component, then index. |
{ "templates": [ { "id": "1203...", "name": "voice_call_followup", "language": "en", "status": "APPROVED", "category": "UTILITY", "body_text": "Hi {{1}}, thanks for speaking with us. Here are the details.", "header_format": "NONE", "header_text": "", "footer_text": "", "buttons": [], "variables": [{ "component": "BODY", "index": 1 }] } ], "templates_known": true}Filling the variables
Section titled “Filling the variables”variables tells you what to supply. A template with one body placeholder is sent
like this:
curl -X POST https://api.whatbot.in/public/v1/messages \ -H "X-API-Key: wa_live_xxx" \ -H "Content-Type: application/json" \ -d '{ "to": "919876543210", "type": "template", "template_name": "voice_call_followup", "language_code": "en", "components": [ { "type": "body", "parameters": [{ "type": "text", "text": "Ravi" }] } ] }'