WhatsApp as an inbound channel
WhatsApp is a popular messenger that allows you to connect chatbots to your WhatsApp Business account.
A chatbot connected to your WhatsApp business account can promptly respond to customer inquiries. It supports many features using different response types such as sending files, media, geolocation or contacts.
To connect WhatsApp as an inbound channel in JAICP:
- Create an application in your developer account.
- Set up the application.
- Connect an inbound channel.
- Set up a webhook.
- Test the bot.
Create an application
To create an application:
- Sign in to your developer account.
- Select My Apps from the tab bar.
- Click Create App.
- On the Type tab, select Business and click Next.
- On the Details tab, add information about the application:
- an app name
- your contact email
- your business account
- Click Create App to save the information.
Set up the application
First, you need to generate a permanent token to continue the application setup. ! > A permanent token is only available for applications in a live mode.
Generate a permanent token
To generate a permanent token:
- Go to the Business Settings page.
- In the Users section, select System Users and click Add.
- Enter System Username, System User Role and click Create System User.
- On the System Users page, click Add Assets.
- Go to Select Asset type → Apps → Select assets and select your app name.
- Enable the Manage App option in the Full Control section and click Save Changes.
- On the System Users page, click Generate New Token.
- Select your app from the dropdown list.
- Enable the
whatsapp_business_management
andwhatsapp_business_messaging
permissions from the list and click Generate Token.
Complete the application setup
To complete the application setup:
-
Go back to the My apps page and select your app.
-
On the Dashboard page, go to the Add products to your app section, select WhatsApp, and click Set up.
-
On the Getting started tab:
- Go to Step 1: Select phone numbers and choose a phone number connected to your WhatsApp Business account.
cautionIf you do not have a number yet, go directly to Step 5: Add a phone number, create a profile and verify the number. Then go back to Step 1: Select phone numbers and choose the number from the dropdown list.- Copy a Phone number ID.
-
On the Configuration tab, copy a Permanent token.
You will need a Phone number ID and a Permanent token for an inbound channel setup in JAICP.
Connect an inbound channel
To connect an inbound channel in JAICP:
- Choose the project you will connect to the channel.
- In the dashboard, select Channels → Inbound → Connect channel.
- In the Messengers and social networks section, select WhatsApp.
- Fill in the fields in channel settings:
- Access token — insert Permanent token you have saved.
- Phone number ID — insert an ID you have saved. It is a sequence of numbers that looks like
102678009166123
. - Name — enter a name for this inbound channel.
- Click Create.
You will see published WhatsApp channel. Click Get webhook. You will need this webhook to complete the integration setup in your developer account.
Set up a webhook
To complete the integration setup in the application:
- Select your app in the developer account.
- On the Products section in the sidebar, select WhatsApp → Configuration.
- On the Configuration tab, go to the Webhook section and click Edit.
- Fill in the fields in the Edit webhook’s callback URL window:
- Callback URL — insert the webhook from JAICP channel settings.
- Verify token — insert
justai_verify_token
.
- Click Verify and save.
- In Webhook fields section select
messages
and click Subscribe for Webhooks messages. - Click Verify and save.
Test the bot
The integration setup is now complete. To test the bot, send a greeting or an activation phrase from your script to your WhatsApp Business account. Then the dialog with the bot starts.