简体   繁体   中英

Not receiving some messages via WhatsApp Cloud API webhook

I'm trying to get WhatsApp's Cloud API working. I managed to set up Meta Business Account and configure a WhatsApp app. Then I configured a webhook and subscribed to messages event (see the following screenshot).

网络钩子配置

I then managed to send a message via the API using the following request:

curl -i -X POST `
  https://graph.facebook.com/v13.0/103690452403982/messages `
  -H 'Authorization: Bearer MY_TOKEN' `
  -H 'Content-Type: application/json' `
  -d '{ \"messaging_product\": \"whatsapp\", \"to\": \"MY_NUMBER\", \"type\": \"template\", \"template\": { \"name\": \"hello_world\", \"language\": { \"code\": \"en_US\" } } }'

I received the message and it came through the webhook as well. If I reply to that message, it comes through the webhook too.

The problem

However, when I send a message to the associated number from a different WhatsApp number (not via the API) it is received but the webhook is not called.

I suspect some incorrect configuration on my side. When I text the number from a different phone, the chat has a notice about E2E encryption - something which is not present in a chat window of the API-sent message. I assume that E2E-encrypted messages cannot be passed to the webhook because only the recipients should be able to decrypt the message.

Any ideas what I might be missing?

Thank you in advance

If you're using your business manager as a BSP, then you must Subscribe to your WABA first, to get notifications over your webhook.

See whatsApp cloud API document here: https://developers.facebook.com/docs/whatsapp/cloud-api/get-started-for-bsps#subscribe-waba

Here, in the Callback URL mention "webhook" after the trailing "/" ie

https://your_callback_url.tld/webhook

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM