WhatsApp (optional)
Connect a Meta WhatsApp Business sender to AppCore for WhatsApp one-time codes and template messages. Deferred and off by default.
On this page
AppCore can send WhatsApp authentication (one-time code) templates and approved template messages through the
Meta WhatsApp Cloud API, directly from your environment's runtime. It verifies Meta's webhook challenge and every
status callback's X-Hub-Signature-256 signature, enforces a destination-country allowlist and a daily spend cap, and
never sends SMS. Signing in by WhatsApp does not grant marketing consent; WhatsApp campaigns additionally need the
user's marketing_whatsapp consent. Console paths are as of 2026-11.
Warning
Not yet enabled: WhatsApp is deferred and off by default. The adapter is implemented and tested against a fake
Graph API only (MOCK_TESTED). Even with an active connection nothing is sent until your platform operator turns
WhatsApp on for the environment (messaging and, for one-time codes, identity with an allowed country list). Until
then whatsapp_otp and whatsapp never appear in /v1/config/public, the webhook URL returns 404, and
WhatsApp requests return 503 FEATURE_UNAVAILABLE. A phone number outside the allowed countries gets 422 with the
sign-in methods that are available instead.
Before you begin
- A verified Meta business portfolio, a WhatsApp Business Account (WABA), a registered sender phone number and a payment method in Meta. Business verification and number registration are Meta's processes and can take days.
- A Meta developer app of type Business with the WhatsApp product added. You need admin rights on the app and the business.
- Your environment's API host,
https://<your-api-host>. - Meta's per-message price for authentication messages in each target country, to set the spend cap.
Steps
App ID and secret. Meta for Developers → My Apps → your app → App settings → Basic: copy the App ID; App secret → Show and copy it.
Sender IDs. App → WhatsApp → API Setup: copy the Phone number ID (not the phone number) and the WhatsApp Business Account ID.
System-user token. Meta Business Suite → Business settings → Users → System users → Add, assign the app and the WABA as assets, then Generate new token with
whatsapp_business_messaging(andwhatsapp_business_management). Choose a non-expiring or long-lived token and record its expiry.Authentication template. WhatsApp Manager → Message templates → Create template → Authentication, with the copy code button, in each language you need. Submit it and wait for Approved. Note its name and language code (for example
en_US).Verify token. Generate a random string (for example
openssl rand -hex 32). You will paste the same value into AppCore and into Meta.In AppCore, open Setup and connections → Connections, create a Direct Meta WhatsApp connection, fill in the public fields, and paste
meta_app_secret,access_tokenandwebhook_verify_tokeninto their write-only fields. Run Check syntax, then Read-only check, then Activate.Webhook. Copy the connection's Callback URL:
Codehttps://<your-api-host>/webhooks/whatsapp/<connection-id>In App → WhatsApp → Configuration → Webhook → Edit, paste it as Callback URL, paste your verify token, and Verify and save. Then subscribe to the messages field. Verification only succeeds once your operator has enabled WhatsApp for the environment.
Paste into AppCore
| AppCore field | Where to find it | Secret? |
|---|---|---|
meta_app_id | App settings → Basic → App ID | Public |
meta_app_secret | App settings → Basic → App secret | Secret (write-only) |
waba_id | WhatsApp → API Setup (or WhatsApp Manager → Account tools) → WhatsApp Business Account ID | Public |
phone_number_id | WhatsApp → API Setup → Phone number ID | Public |
access_token | Business settings → System users → your user → generated token | Secret (write-only) |
graph_api_version | The Graph API version to pin, for example v21.0 | Public |
authentication_template | {"name": "<template-name>", "language": "en_US"} of your approved Authentication template | Public |
webhook_verify_token | The random string from step 5 (also pasted in Meta) | Secret (write-only) |
country_allowlist | ISO country codes where codes may be sent, for example ["IN"] | Public |
daily_spend_cap | {"daily_cap_minor": "50000", "unit_cost_minor": "115", "currency": "INR"}: daily cap and per-message cost as integer minor-unit strings | Public |
daily_spend_cap takes exactly daily_cap_minor, unit_cost_minor (greater than zero), currency (ISO 4217) and an optional rate_card_ref; other keys are rejected when you save. If it cannot be read, AppCore
treats WhatsApp as unpriced and sends nothing (fail closed). Each send reserves its cost against the day's cap; at the
cap, WhatsApp stops for the rest of the day.
Verify
- Read-only check passes with
META_SENDER_READABLE: AppCore read your phone number ID from the Graph API with the token. Nothing is sent. - Meta's Verify and save on the webhook succeeds (AppCore answered the challenge).
- With WhatsApp turned on by your operator,
whatsapp_otpappears inauth_methodsofGET https://<your-api-host>/v1/config/publicwhen the connection is ready, a sender is configured, the country list is not empty and the authentication template is set. - Send a one-time code to your own number and record it as evidence for
meta-otp(stagesandbox); attestmeta-webhookafter checking a tampered callback is rejected.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
Read-only check PROVIDER_AUTH_REJECTED | Token expired or revoked, or the phone number is not assigned to the system user | Assign the WABA and number to the system user; generate a new token and Rotate |
| Webhook verification fails in Meta | WhatsApp not enabled for the environment (404), connection not active, or verify token differs (403) | Ask your operator to enable WhatsApp; paste the same token on both sides |
Status callbacks get 401 | Signature check failed: meta_app_secret is not this app's secret | Paste the App secret of the app that owns the webhook |
whatsapp_otp missing from auth_methods | WhatsApp off for this environment, empty country list, no template, or connection not ready | Check each with your operator |
422 with alternative methods | The number's country is not in country_allowlist (or in the operator's list) | Add the country only after confirming Meta pricing and template approval there |
whatsapp_otp disappears during the day, or 503 FEATURE_UNAVAILABLE ("WhatsApp budget is not priced") | Daily spend cap reached, or daily_spend_cap unreadable | Raise the cap or fix its JSON keys; keep another sign-in method enabled |
Template rejected or paused by Meta (meta_template_pending) | Meta review | Fix the template in WhatsApp Manager without changing its category |