Webhook setup
- GET with hub.mode=subscribe, hub.verify_token, hub.challenge: echo the challenge if the token matches
- POST deliveries carry X-Hub-Signature-256 = sha256=HMAC(app secret, raw body)
- Subscribe the app to the messages field of the WhatsApp Business Account
- Return 200 quickly; failed deliveries are retried
Message types
text(body up to 4096 characters)image,video,audio,document,stickerby link or media idinteractive: button (3 max), list (10 rows), cta_url, flowtemplateapproved in WhatsApp Managerlocation,contacts,reaction
The 24 hour window
- A user message opens a 24 hour customer service window for free-form replies
- Outside it you can only send approved templates
- Template categories: marketing, utility, authentication; pricing differs by category and country
- Get opt-in before messaging people first
Incoming payload
entry[].changes[].value
.messages[] from, id, timestamp, type,
text.body | interactive.button_reply
| interactive.list_reply
.statuses[] id, status: sent | delivered
| read | failed, errors[]
.contacts[] profile.name, wa_idUseful calls
- Mark as read: POST /messages with "status": "read" and "message_id"
- Upload media: POST /<PHONE_NUMBER_ID>/media, then send by id
- Download media: GET /<MEDIA_ID> returns a short-lived URL that also needs the token
Common errors
131047re-engagement: outside the 24 hour window, use a template131026message undeliverable132001template does not exist in that language190access token expired or invalid130429throughput limit reached
Source: developers.facebook.com/docs/whatsapp/cloud-api.
Last checked against official documentation: