WhatsApp Templates & 24h Window
WhatsApp only allows free-form messages within 24 hours of a person’s last inbound message to your number (the customer service window). Outside that window, or when starting a conversation with someone who has not messaged you, you must send a Meta-approved template.
Checking the 24-Hour Window
Every WhatsApp conversation returned by GET /api/v1/conversations and GET /api/v1/conversations/:id includes a window object:
{
"window": {
"open": true,
"expires_at": "2026-11-26T10:15:00Z"
}
}expires_atislast_inbound_at+ 24 hours (windowisnullfor Email and Slack).- If you send a free-form message when
window.openisfalse,msendfails the message before calling Meta witherror_code: "window_closed".
Syncing Templates
You create and submit templates for approval in Meta’s WhatsApp Manager. msend syncs and validates them:
- Templates are synced automatically when the channel connects, every hour via background job, and on demand via Sync templates in the UI.
- If your Meta webhook subscribes to
message_template_status_update, approvals and rejections update immediately. - Read synced templates via API:
GET /api/v1/channels/:id/templates(filter bystatusorname)GET /api/v1/templates/:id
Sending a Template
Pass a template part in parts:
{
"parts": [
{
"type": "template",
"name": "order_shipped",
"language": "en",
"variables": ["Ada", "1234"],
"header": { "type": "image", "attachment_id": "att_xxx" },
"buttons": [{ "index": 0, "payload": "TRACK_1234" }]
}
]
}variables: An array for positional placeholders ({{1}},{{2}}) or an object for named placeholders ({{first_name}}).header: Required for templates with a media header (image,video, ordocument, viaattachment_idorlink) or a parameterized text header ({ "type": "text", "text": "..." }).buttons: Quick-reply payloads or URL button variables byindex.
msend validates template existence, approval status, and variable counts before calling Meta—returning template_not_found, template_not_approved, or template_variables_invalid on mismatch. After sending, message.text is populated with the rendered template body.