WhatsApp Business (Cloud API)
Connect a WhatsApp Business number through Meta's Cloud API so customers who
message it are answered by your governed flow. Channel key: whatsapp.
What you need
- A Meta developer account and a Meta app with the WhatsApp product added (https://developers.facebook.com/apps).
- A WhatsApp Business Account (WABA) with a phone number (the dashboard gives you a test number to start with).
- From the App Dashboard: the Phone number ID, a permanent access token (System User), and the App secret.
- Business verification + display-name approval before messaging real customers at scale (test numbers work without it, for up to 5 recipients).
Official documentation
- Cloud API overview: https://developers.facebook.com/docs/whatsapp/cloud-api
- Get started (test number, first message): https://developers.facebook.com/docs/whatsapp/cloud-api/get-started
- Webhooks setup: https://developers.facebook.com/docs/whatsapp/cloud-api/guides/set-up-webhooks
- Webhook payload examples: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/payload-examples
- Send text messages: https://developers.facebook.com/docs/whatsapp/cloud-api/messages/text-messages
- Webhook verification +
X-Hub-Signature-256: https://developers.facebook.com/docs/graph-api/webhooks/getting-started - System User tokens: https://developers.facebook.com/docs/whatsapp/business-management-api/get-started#system-users
- Conversation-based pricing / 24-hour customer service window: https://developers.facebook.com/docs/whatsapp/pricing
Set up on Meta
- Create the app: developers.facebook.com → My Apps → Create App → use case Other → type Business → add the WhatsApp product.
- API Setup (WhatsApp → API Setup): note the Phone number ID (not the display number) and the WhatsApp Business Account ID. Add your own phone as a test recipient and send the "hello_world" template to confirm the number works.
- Permanent token: Meta Business Suite → Business settings → Users →
System users → Add (Admin) → Assign assets: your app (full control)
and the WABA → Generate new token with
whatsapp_business_messagingandwhatsapp_business_management. Temporary dashboard tokens expire after 24 h. - App secret: App Dashboard → App settings → Basic → App secret → Show.
- Webhook: WhatsApp → Configuration → Webhook → Edit: paste the
Callback URL and Verify token shown by Tools Anatomy after you
connect (step below), click Verify and save, then Manage → subscribe
the
messagesfield. - Go live: complete Business verification and register a real number (WhatsApp → Add phone number), then switch the app to Live mode.
Connect in Tools Anatomy
/channels→ Messaging channels → WhatsApp Business → Connect.- Fill in: Phone number ID, Access token (permanent), App secret. Verify token (advanced) can be left empty — one is generated.
- Connect validates the token against the phone number (
GET /{phone_number_id}) and shows the Callback URL and Verify token to paste into the Meta webhook configuration (step 5 above). The GET handshake echoeshub.challengeonly when the verify token matches. - Every POST from Meta must carry a valid
X-Hub-Signature-256(HMAC-SHA256 of the raw body with the App secret); others get 401.
Secrets (access token, app secret) live in the Secret Manager and are never shown again.
Identity we derive
| Canonical key | Source | Notes |
|---|---|---|
external_user_id |
messages[].from (wa_id, digits) |
stable phone-based id |
channel |
whatsapp |
|
phone_number |
+ + wa_id (E.164) |
runtime_only |
display_name |
contacts[].profile.name |
user-controlled, runtime_only |
email |
— |
conversation_context.channel_account_id = the receiving phone number ID
(so one flow can serve several numbers). Thread = the customer's wa_id.
Limits
- 24-hour customer service window: free-form text replies are only delivered within 24 h of the customer's last message. Outside it WhatsApp requires an approved message template — the channel does not send templates, so a late reply fails with a platform error (visible in the thread status).
- Text is split at 4096 characters (
text.bodylimit). - Media (image, audio, document, video, sticker, location, contacts, interactive replies) arrives as an attachment; the flow answers text-only.
- Delivery/read
statuseswebhooks are acknowledged and ignored. - Rate limits and per-number messaging tiers apply (see Meta docs).
- Meta retries undelivered webhooks for up to 36 h; events are deduplicated
on the WhatsApp message id (
wamid…).
Test it
With the app in development mode, message the test number from a phone you added as a recipient. The webhook delivery log in the App Dashboard (Webhooks → Test / Recent deliveries) shows Meta's view.
Troubleshooting
- Verify token mismatch in the Meta dashboard — the URL or the token was pasted incorrectly; copy both again from the channel drawer.
- "platform rejected the credentials" — expired temporary token, or the System User is not assigned to the app/WABA.
- Replies fail with (#131047) / re-engagement — the 24-hour window has closed; the customer must message again.
- (#131030) Recipient not in allowed list — test numbers can only message recipients added in API Setup.