Error when connecting your own webhook to an application that integrates with two different webhook flows Whatsapp
1

My platform allows the client to create chatbots and integrate with Whatsapp, this process is made by the client that need to create an app at https://developers.facebook.com. In the step 3 of the Whatsapp configuration, it is required to include a callback URL and a token.

This process is working fine but our clients complaining because they need to create one app for each whatsapp number and there is some approaval that facebook is demanding.

To solve this problem, we think that if we became a tech provider this will be possible, so we created an app, followed the steps and add the script provided at step 2 to our platform. This allows our clients to use the Facebook login to connect their numbers to our app. This part is working perfectly to.

The problem is that, after the number is connected to our app how can we use the numbers to integrate with the chatbot? At the original process with one app for each number, each app has their own callback URL and Token, but with the number connected to our app their is only one app. How can we connect multiple number on the same app?

We have an application developed with Python and Flask that has one endpoint called /webhook_botpress. This endpoint accepts GET and POST requests. The purpose of this endpoint is to serve as a proxy pointing to several of our bots created within BotPress. We use the "phone_number_id" parameter to determine which bot to direct the messages to. Regarding GET and POST requests, we have a check to determine the type of request. If it is a GET request, we perform the webhook verification process with the standard values (hub.mode, hub.challenge, hub.verify_token). If it is a POST request, we understand it to be a message, so we parse the JSON from the request body, look for the whatsapp_default_number_id, and use this parameter to know which of our BotPress bots to forward the message to. We then forward the message and return a 200 status.

After the client connect their number we need to create another app to connect the bot usign the client number? If that is the case, is their an API that allows to do that?

Rayssa
Asked about 5 months ago