Skip to content

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
curl https://api.whatbot.in/public/v1/templates \
-H "X-API-Key: wa_live_xxx"
FieldTypeRequiredDescription
refreshbooleanBypass 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.

FieldTypeRequiredDescription
templatesarrayApproved templates. Empty if none, or if the lookup failed.
templates_knownbooleanfalse when the lookup failed and templates is empty for that reason.

Each template carries:

FieldTypeRequiredDescription
idstringWhatsApp’s template id.
namestringPass this as template_name when sending.
languagestringLanguage code, e.g. en. Pass it as language_code.
statusstringAlways APPROVED here.
categorystringe.g. MARKETING, UTILITY, AUTHENTICATION.
rejected_reasonstringWhatsApp’s field; not meaningful for an approved template.
body_textstringThe body, with {{1}}-style placeholders.
header_formatstringTEXT, IMAGE, VIDEO, DOCUMENT, LOCATION or NONE.
header_textstringThe header text when header_format is TEXT, else empty.
footer_textstringThe footer text, or empty.
buttonsarrayEach button as {type, text, index}; URL buttons also carry url and has_variable.
variablesarrayEvery 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.
200
{
"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
}

variables tells you what to supply. A template with one body placeholder is sent like this:

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": "919876543210",
"type": "template",
"template_name": "voice_call_followup",
"language_code": "en",
"components": [
{ "type": "body", "parameters": [{ "type": "text", "text": "Ravi" }] }
]
}'