Reputation: 337
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.
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
Upvotes: 7
Views: 4587
Reputation: 17
Here, in the Callback URL mention "webhook" after the trailing "/" i.e.
https://your_callback_url.tld/webhook
Upvotes: -3
Reputation: 21
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
Upvotes: 2