Handle replies and the 24-hour window
Get the messages
events_pollwith the stored cursor, or a webhook (webhook_create). Eachmessage.receivedhas the sender, the content, andreply_window_expires_at.message_list/contact_getgive history and whether the window is open.
The window
- When a customer writes, you can send anything (text, media, buttons) for 24 hours after their last message. Service replies in that window are free.
- After that, only approved templates. If you're about to lose the window on an open issue, answer now or ask a question that invites a reply.
- Click-to-WhatsApp ads open a longer free window (72 hours) for the ad's conversation.
Reply well
- Acknowledge quickly.
message_mark_readwithshow_typingshows blue ticks and a typing indicator while you prepare an answer. - Reply in-thread (
reply_to) when answering a specific message. - Keep the formatting cookbook in mind: short, specific, one idea per message.
- If you can't solve it, say so and hand over to a person the business names. Tell the customer when they'll hear back.
STOP, START and complaints
- STOP-style replies (several languages) put the person on the do-not-contact list automatically, for marketing. You get
contact.opted_out. Reply once, briefly, to confirm ("You won't get offers from us any more."). Don't argue or send anything else promotional. - START lifts their own STOP (
contact.opted_in). - If someone is angry or says they never signed up, apologise, add them with
suppression_add(reason: complaint,scope: all), and tell the human: it's a sign the list or the consent is wrong. - "Delete my data" requests: confirm with the human, then
contact_erase.
Coexistence numbers
If the business also uses the WhatsApp Business app on the same number, their own replies from the phone arrive as message.echo. Check for an echo before answering, so you don't reply twice.