Templates and the 24 h window
Reply freely for 24 hours after the customer writes. After that, send a template.
The window
WhatsApp lets a business send any message for 24 hours after the customer's last one. Each conversation carries window_expires_at and window.
| window | Meaning |
|---|---|
open | Any message goes through |
closing | Under two hours left |
closed | Only a template goes through |
none | The customer never wrote |
A text, media or interactive send outside the window is 422 window_closed.
Sending a template
Templates sync from Meta every 15 minutes. List templates gives each one's header_values and body_values, which say how many variables to send.
{
"conversation_id": "b1c7e0a4-52a3-4a3c-8d0e-6c1b9e5f7a20",
"type": "template",
"template": {
"name": "transfer_ready",
"language": "en_US",
"variables": { "header": [], "body": ["Ama", "T-42"] }
}
}
variables.body holds one string per {{n}}, in order. language is needed only when the template exists in several. A media header takes { "media_key": "..." } from an upload.
When a template is refused
Anything wrong is 422 template_invalid, and details.reason says what: not_found, not_approved, language_required, wrong_variable_count, media_header_required, header_not_media or header_format_unsupported.