Setting up the WhatsApp integration
The WhatsApp connector allows you to send and receive messages using the WhatsApp Business API.
The WhatsApp server sends post requests to our FastAPI app. Our App processes these messages and replies to the user. Right now, we respond to the incoming message with the best matching document chunk from our database [To change in the future].
Step 1. Core App Deployment
To set up the WhatsApp integration, while deploying the Core App, you need to do the following -
-
Create/Login to your Meta/Facebook project
-
Once you are in the project, go to "WhatsApp" -> "API Setup"
-
Copy the "Temporary access token" and paste it in the
WHATSAPP_TOKEN
field in the.env
file in the deployments folder in the aaq-core repo- You can skip the previous steps if you already have access to the
WHATSAPP_TOKEN
- You can skip the previous steps if you already have access to the
-
In the
.env
file, set theWHATSAPP_VERIFY_TOKEN
according to any string of your choice. This will be used to verify the WhatsApp webhook in the next step
These are all the necessary steps to set up the Core App for WhatsApp integration at the app deployment stage. You can go ahead and deploy the app.
Step 2. WhatsApp Webhook Setup
Once you have deployed the Core App, you need to set up the webhook for the WhatsApp integration. To do this, follow these steps -
-
Login to your Meta project
-
Navigate to the "WhatsApp" -> "Webhook" page
-
Click on "Edit Subscription"
-
In the pop-up, fill in the core-backend app's URL in the "Callback URL" field. The URL should be of the form:
<your-core-backend-app-url>/webhook
. Then fill the "Verify token" field with the value of theWHATSAPP_VERIFY_TOKEN
that you set in the.env
file in the Core App deployment step. Finally, click on "Verify and Save" -
Next, navigate to "WhatsApp" -> "Configuration"
-
On the page, next to "Callback URL", click on the "Edit" button and similar to the previous step, fill in the "Callback URL" and the "Verify token" field
Once you have gone through all of the above steps, you will have successfully set up a connection between WhatsApp and your app!