Writing

A WhatsApp Cloud API Gotcha: The Webhook Verifies, but No Messages Arrive

2026-06-12

15 mins to read

Share article

You followed the docs step by step and set up the WhatsApp Cloud API webhook. The Meta console plainly says "verified", and a message sent from a real phone shows ✓✓ (delivered). Yet your backend logs contain not a single inbound record.If this is where you are stuck, this post can save you a few hours. The cause is almost always one switch that the docs barely emphasize but that decides whether messages flow at all: subscribed_apps. I'll untangle the three things that are all called a "subscription" but are entirely different in the WhatsApp Cloud API, and give you a systematic debugging path that doesn't rely on guessing.

1. The symptom: a counterintuitive "delivered"

After integrating the WhatsApp Cloud API and configuring the webhook per the official Quickstart, a common place to get stuck looks like this:

  • You click Verify and save in the Meta developer console, and it reports the webhook as verified.
  • You send hello from a real phone to your WhatsApp number, and the message shows ✓✓ (delivered).
  • But your backend receives no POST callback at all, and the inbound log is empty.

Verification succeeded, the message was delivered, and still no callback. At this point most people start suspecting the reverse proxy, or the signature check swallowing the message, or a missing payment method.

It is most likely none of those. The real cause is that you missed the most important, and best hidden, of the three "subscriptions" in the WhatsApp Cloud API.


2. The core idea: three things called "subscription" that are three different things

For an inbound message to reach your backend, three conditions have to hold on Meta's side at the same time. The trap is that all three carry the word "subscribe" in the docs and the console, so they are easy to conflate, and doing one feels like having done them all.

#NameWhere you do itWhat it actually does
①Webhook URL verification (the hub.mode=subscribe challenge)Your code (a GET endpoint)Proves the callback URL is reachable and the verify_token is correct
②App subscription to the messages fieldMeta console → the App's Webhooks settingsThe App declares which kinds of events it wants to receive
③WABA → App subscription (subscribed_apps)Meta platform API (not a checkbox in the console)Routes the events of a specific WhatsApp Business Account to this App

The diagram below shows the three gates a message has to pass through to reach your backend. Without ③, Meta drops it silently, and the sender notices nothing:

A mail analogy makes it clear:

① = the post office confirms that your address really exists and can receive mail.② = you declare that you only want registered mail, not flyers.③ = a specific sender is registered so that the mail they send gets delivered to your address.Without ③, the address is verified and the mail type is declared, but no sender is registered to you, so the mail never comes.

In the vast majority of "verified but no messages" cases, ① and ② are done and only ③ is missing.

Why is ③ the easiest to miss?

Because ① and ② both have prominent UI entry points in the console (enter the URL, click verify, tick the fields), and each ends with a success message. ③, on the other hand, often has no corresponding checkbox in the console; you have to call the Graph API explicitly. In the docs it is usually a low-key section of the API Reference rather than part of the main Quickstart path, so it is very natural to skip.


3. Why does it work in testing and break the moment you go to production?

This is another frequent source of confusion, and the key to understanding ③. Many people use the test number Meta provides during the testing phase, and everything works. Then they switch to their own production number and their own WABA, and messages stop arriving immediately.

To understand this, remember one fact: subscribed_apps is a WABA-level subscription. It binds one specific WABA to one specific App, and it does not carry over automatically when you change numbers or environments.

So why did it work in testing? This is exactly the place where you should not take things for granted. That subscription may have been established at some earlier point: perhaps an onboarding flow did it as a side effect, or perhaps someone configured it by hand when setting up the test environment and never wrote it into the handover notes. Either way you can't see that it exists, so you assume things were simply fine all along. It is not in your code, and it may not be in anyone's operation log either. So don't try to work out why testing worked (often you can't), and check the production environment directly (see section 4).

Conclusion: a working test environment does not mean the chain is complete. For platform-side state such as subscriptions and registrations, which lives neither in your code nor in any step you explicitly performed, you must confirm each item when you change environments. You cannot assume that production works because testing did.

4. How to check for ③, and how to fix it

The rule of thumb in one line: WhatsApp webhook configured but no messages arriving → check GET /{waba_id}/subscribed_apps first.

4.1 Check: which Apps is this WABA subscribed to

curl -s "https://graph.facebook.com/v17.0/<WABA_ID>/subscribed_apps" \
  -H "Authorization: Bearer <ACCESS_TOKEN>"
  • It returns {"data": []} (an empty array) → this is it. The WABA is not subscribed to any App, so of course nothing is delivered.
  • Your App is in the response → ③ is in place and the problem is elsewhere (go back and check signature verification, the reverse proxy, and the field subscription).

4.2 Fix: subscribe the WABA to the current App

curl -s -X POST "https://graph.facebook.com/v17.0/<WABA_ID>/subscribed_apps" \
  -H "Authorization: Bearer <ACCESS_TOKEN>"

The "App" being subscribed here is the one that <ACCESS_TOKEN> belongs to. Once it returns {"success": true}, send another message from a real phone, and the callback usually arrives right away.

Make sure you use the right <ACCESS_TOKEN>. In production, use a permanent System User token (section 5.2 below shows how to verify that it really is permanent), not a temporary token that expires after 24 hours. Otherwise the subscription succeeds now and "mysteriously" stops working two days later.

5. No guessing: a layered debugging method

"Check subscribed_apps first" is the conclusion. But if you want to actually locate the problem rather than get lucky, I recommend walking through the path below: work in layers, and verify facts with tools. Each layer verifies exactly one thing, and each step narrows the search. It applies to any "third-party webhook isn't calling me back" problem.

5.1 Layer one: prove your app and reverse proxy are fine (one GET locally, one against the public URL)

WhatsApp's webhook verification is a GET request carrying hub.mode=subscribe, hub.verify_token and hub.challenge, and it requires you to echo hub.challenge back unchanged. Hit it locally first:

curl "http://127.0.0.1:8000/webhooks/whatsapp?hub.mode=subscribe&hub.verify_token=<YOUR_VERIFY_TOKEN>&hub.challenge=test123"
# Expected output: test123

Then send the same request to your public domain. If both echo the challenge, you have proven that your application logic, your reverse proxy and your verify_token are all correct. The matching server-side implementation, using FastAPI as an example:

@router.get("/webhooks/whatsapp")
async def verify_webhook(request: Request):
    mode = request.query_params.get("hub.mode")
    token = request.query_params.get("hub.verify_token")
    challenge = request.query_params.get("hub.challenge")
    if mode == "subscribe" and token == EXPECTED_VERIFY_TOKEN:
        return Response(content=challenge or "", media_type="text/plain")
    return Response(status_code=403)
Passing this layer is precisely what most easily convinces people that everything is set up. It only proves that the callback URL is valid; it says nothing about whether messages will come in. Don't be fooled by the words "subscription verified".

5.2 Layer two: verify your access_token with debug_token

A lot of "intermittently can't receive or can't send" problems are really a token of the wrong type or with the wrong lifetime. The Graph API's debug_token tells you at a glance:

curl -s "https://graph.facebook.com/debug_token?input_token=<ACCESS_TOKEN>&access_token=<APP_ID>|<APP_SECRET>"

Look at two fields in the response:

  • type: for production it should be SYSTEM_USER (a system user token, which can be made permanent).
  • expires_at: 0 means it never expires. If it is a future timestamp, the token will expire, and production will break sooner or later.
A side benefit: this call uses <APP_ID>|<APP_SECRET> as the caller's credentials, so a successful response also proves that your app_secret is correct (you need it for signature verification).

5.3 Layer three: sign your own webhook POST to verify the code path

To confirm that your code would handle a message correctly if one really came in, you can build a POST with a valid signature yourself and send it to your local webhook. WhatsApp computes an HMAC-SHA256 over the raw request body using app_secret and puts it in the X-Hub-Signature-256 header:

import hmac, hashlib

raw_body = open("sample_inbound.json", "rb").read()          # a sample inbound payload
sig = "sha256=" + hmac.new(APP_SECRET.encode(), raw_body, hashlib.sha256).hexdigest()
# Then use curl / httpx to POST raw_body with this signature header to http://127.0.0.1:8000/webhooks/whatsapp

The standard way to verify the signature on the server (note the constant-time comparison, which guards against timing side channels):

expected = "sha256=" + hmac.new(APP_SECRET.encode(), raw_body, hashlib.sha256).hexdigest()
if not hmac.compare_digest(request_signature, expected):
    logger.warning("Webhook signature verification failed")
    return {"status": "ok"}        # Note: return 200 even on failure, see section 6

If this self-signed POST gets your service to parse, process and reply normally, you have proven that the whole code path works: signature check → parsing → business dispatch.

There is a blind spot here that you must remember: a self-signed simulated POST bypasses Meta. It can prove that your code handles a message once it arrives, but it cannot prove that Meta will actually push the message to you. The former is a problem in your code; the latter is a platform delivery problem, and ③ belongs to the latter.

5.4 Layer four: a real-device test, which you cannot skip

Passing the first three layers only shows that the code and configuration on your side are correct. The only thing that verifies real delivery by Meta is sending a message from a real phone and seeing whether the callback arrives. The missing ③ subscribed_apps in this case could only be exposed by a real device, because it is a switch in the platform's delivery stage, and the first three layers (local GET, token check, self-signed POST) all bypass it.

Local GET echoes the challenge       → verifies: app + reverse proxy + verify_token
debug_token on the token             → verifies: access_token type/expiry + app_secret
Self-signed HMAC simulated POST      → verifies: code path (signature → parsing → dispatch)
Real-device message, watch callback  → verifies: real delivery by Meta (subscribed_apps and other platform state) ★ cannot be skipped

6. A few side traps worth clearing up

While debugging this kind of problem, it is easy to be led astray by a few things that look related but aren't. Here they are in one place.

6.1 Why return 200 even when signature verification fails? Read the logs, not the status code

Meta retries on any non-2xx response. If you return 4xx/5xx when signature verification fails, a bug in the verification logic itself will bring on a retry storm. So the right approach is to return 200 whether verification succeeds or fails, and to surface the anomaly through logs rather than the HTTP status code. That means that while debugging you cannot tell from the status code whether verification passed; you have to check the logs for a "signature verification failed" warning.

6.2 The "no payment method configured" warning is not why you aren't receiving messages

The Meta console often warns that a missing payment method may limit messaging features, which makes it easy to conclude that messages aren't arriving because no payment method is attached. In fact, replies inside the customer service window (within 24 hours of a user-initiated message) are free service messages and need no payment method. A bot that only responds to users normally works entirely inside this window. A payment method is only needed for proactive pushes, template messages, or volume beyond the free tier. What actually blocks inbound messages is ③, not payment.

The lesson: the most prominent warning on a platform is not necessarily what is blocking you right now. Locate the problem from the symptoms (logs, real-device behavior) instead of following the most eye-catching notice to a conclusion.

6.3 Number "pending review" or "not registered": use the Cloud API /register, and it isn't a payment problem either

If your number shows as "not registered" on wa.me, or stays "pending review", the root cause is usually that it never went through Cloud API number registration:

curl -s -X POST "https://graph.facebook.com/v17.0/<PHONE_NUMBER_ID>/register" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"messaging_product": "whatsapp", "pin": "<YOUR_6_DIGIT_PIN>"}'

This pin is the number's two-step verification PIN. You set it yourself, and you must record it somewhere safe: you will need it when changing devices, migrating, or re-registering.

6.4 Display name review: avoid internal or technical words

When you submit the number's Display Name for review, names containing internal terms, technical terms, or overly generic words (such as Prod, Test or AI Bot) tend to be rejected. A real, properly formed brand name usually passes quickly.

6.5 The webhook must return 200 within 5 seconds

Meta requires the webhook to respond with 200 within 5 seconds; otherwise it counts as a failure and is retried. So don't do slow work synchronously in the webhook (calling an LLM, querying the database, sending messages). The right pattern is to return 200 as soon as the payload is parsed and hand the slow work to a background task:

@router.post("/webhooks/whatsapp")
async def webhook(request: Request):
    body = await request.body()
    # ... signature verification ...
    payload = parse(body)
    for msg in extract_messages(payload):
        # Idempotent dedup: Meta may redeliver the same message_id
        if already_processed(msg.id):
            continue
        mark_processed(msg.id, ttl=60)
        asyncio.create_task(handle_message(msg))   # all slow work is async
    return {"status": "ok"}                          # 200 immediately

7. Going further: resolving the tenant from the webhook payload in a multi-tenant setup

Once messages are flowing, a multi-tenant system immediately hits the next question: which tenant does this message belong to? In my case I was adding WhatsApp to a multi-channel conversational assistant that already supported other IM channels, with one number serving one tenant and credentials isolated per tenant. That is when I noticed that, under the same "channel" abstraction, different channels resolve the tenant in different ways:

ChannelHow the tenant (tenant_id) is determinedNeeds a stored mapping?
WhatsApp (this post)Look up the tenant config table by phone_number_id, cache the result for 24 hoursYes
Other IM channel ATaken dynamically from the account's login sessionNo
Other IM channel BInjected directly in the webhook URL pathNo (the URL carries it)

Why the difference? It comes down to whether the inbound payload lets you locate the tenant directly:

  • WhatsApp is one number per tenant, and the payload only carries phone_number_id (in value.metadata), so you have to use it for a reverse lookup against a "number → tenant" mapping.
  • Some channels serve several tenants from a single account, and the tenant travels with the login session.
  • Some channels give each tenant its own webhook URL containing an ID, so the path itself is the answer.

None of the three is better than the others; it depends on what the platform puts in the payload. But the reverse lookup is the only one that requires you to maintain mapping data yourself, which adds two things to watch for around writes and caching.

7.1 Writes: pre-check first, then a rollback-guarded update

Tenant-level credentials (phone_number_id + access_token) live in the database, not in code and not in the repository. When writing credentials for a tenant, I do it in two steps:

  1. Pre-check with a SELECT: confirm the number is not already used by another tenant; the expected result is empty. One number per tenant is the premise the reverse lookup rests on, and once the mapping is duplicated, messages get routed to the wrong tenant.
  2. A rollback-guarded UPDATE: run the update inside a transaction and commit only if exactly one row was affected; otherwise roll back. With a wrong condition, zero affected rows means nothing changed and several affected rows is an incident, and neither should be committed.

7.2 Caching: clear it after changing the database

The phone_number_id → tenant_id lookup result is cached for 24 hours on a hit, so that not every message queries the database. The cost is that if you change the credentials in the database without clearing the cache, the new credentials can take up to 24 hours to take effect. What you see is "the database is clearly correct, but production still uses the old value", which is easy to mistake for one of the platform-side problems above. So treat the database change and clearing the matching cache key as two steps of a single operation, and put them on the same runbook.


8. Summary: a debugging checklist

When you hit "the WhatsApp Cloud API webhook verifies but no messages arrive", go in this order:

  1. Check GET /{waba_id}/subscribed_apps first. If it is empty, that is the cause; a POST fixes it immediately. (90% of cases end here.)
  2. Don't assume that it is automatic for test numbers and only production numbers need it. The subscription is a WABA-level relationship; it does not carry across environments, and someone may have configured it for you without recording it. Run GET /{waba_id}/subscribed_apps against the production WABA and POST if it is missing.
  3. Use debug_token to check the type and expires_at of your access_token (production needs SYSTEM_USER and 0).
  4. Judge signature verification from the logs, not the status code, since a failed verification also returns 200.
  5. Don't be sidetracked by the payment method warning. Replies inside the customer service window are free and need no payment method.
  6. For a number that is "not registered", use the Cloud API /register (and set a PIN).
  7. Never skip the real-device test. It is the only way to verify real delivery by Meta.

Keep the three "subscriptions" straight

SubscriptionWhat it verifiesWhere you do it
① Webhook URL verificationCallback URL reachable + verify_tokenYour GET endpoint
② messages field subscriptionWhich events the App wantsCheckbox in the console
③ subscribed_appsRoutes WABA events to the AppGraph API (the one most often missed)
One closing line: in the WhatsApp Cloud API, "verified" only checks the URL, and "delivered" only means the message reached the other person's phone. Neither one means the callback will reach your backend. The switch that actually makes messages flow into your service is called subscribed_apps.

Appendix: a minimal FastAPI webhook you can run as-is

Run pip install fastapi uvicorn, then uvicorn app:app --port 8000 to start it. It takes two environment variables: WA_VERIFY_TOKEN (the string you chose when configuring the webhook in Meta) and WA_APP_SECRET (the Meta App's App Secret, used for HMAC signature verification). It ties the points above into a runnable skeleton: echo the challenge on GET, verify the signature on POST, deduplicate idempotently, and return 200 within 5 seconds while processing asynchronously.

"""Minimal runnable WhatsApp Cloud API webhook  ·  uvicorn app:app --port 8000"""
import os, hmac, hashlib, asyncio, time, json, logging
from fastapi import FastAPI, Request, Response

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("wa")
VERIFY_TOKEN = os.environ.get("WA_VERIFY_TOKEN", "")   # chosen when configuring the webhook in Meta
APP_SECRET   = os.environ.get("WA_APP_SECRET", "")     # Meta App → App Secret
app = FastAPI()

_seen = {}  # in-memory dedup (use Redis with a 60s expiry in production)
def already_processed(msg_id, ttl=60):
    now = time.time()
    for k in [k for k, t in _seen.items() if now - t > ttl]:
        _seen.pop(k, None)
    if msg_id in _seen:
        return True
    _seen[msg_id] = now
    return False


@app.get("/webhooks/whatsapp")
async def verify(request: Request):
    p = request.query_params
    if p.get("hub.mode") == "subscribe" and p.get("hub.verify_token") == VERIFY_TOKEN:
        return Response(content=p.get("hub.challenge", ""), media_type="text/plain")
    return Response(status_code=403)


@app.post("/webhooks/whatsapp")
async def receive(request: Request):
    body = await request.body()
    if APP_SECRET:  # HMAC check: return 200 even on failure to avoid a retry storm; rely on logs
        expected = "sha256=" + hmac.new(APP_SECRET.encode(), body, hashlib.sha256).hexdigest()
        if not hmac.compare_digest(request.headers.get("X-Hub-Signature-256", ""), expected):
            logger.warning("[WA] HMAC signature verification failed")
            return {"status": "ok"}
    try:
        payload = json.loads(body)
    except Exception as e:
        logger.error(f"[WA] failed to parse payload: {e}")
        return {"status": "ok"}
    for entry in payload.get("entry", []):
        for change in entry.get("changes", []):
            value = change.get("value", {})
            metadata = value.get("metadata", {})            # contains phone_number_id (the basis for multi-tenant routing)
            for msg in value.get("messages", []) or []:
                if already_processed(msg["id"]):
                    continue
                asyncio.create_task(handle_message(msg, metadata))
    return {"status": "ok"}                                  # 200 right away, within 5 seconds


async def handle_message(msg, metadata):
    """Slow business logic (LLM calls / DB queries / replies) goes here, outside the 5s window"""
    try:
        t = msg.get("type")
        text = msg.get("text", {}).get("body", "") if t == "text" else f"<{t}>"
        logger.info(f"[WA] inbound from={msg.get('from')} type={t} text={text!r} "
                    f"pnid={metadata.get('phone_number_id')}")
        # TODO: your business logic / reply via the Graph API
    except Exception:
        logger.exception("[WA] error while handling message")
Deduplication here uses an in-memory dict for demonstration; use Redis (with a 60s expiry) in production. The phone_number_id in metadata is the basis for multi-tenant routing: when one number serves one tenant, use it to look up which tenant the message belongs to (see section 7).