Skip to main content

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:

  1. Create an application in your developer account.
  2. Set up the application.
  3. Connect an inbound channel.
  4. Set up a webhook.
  5. Test the bot.

Create an application

caution
To set up the integration, you need a developer account.

To create an application:

  1. Sign in to your developer account.
  2. Select My Apps from the tab bar.
  3. Click Create App.
  4. On the Type tab, select Business and click Next.
  5. On the Details tab, add information about the application:
    • an app name
    • your contact email
    • your business account
  6. 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:

  1. Go to the Business Settings page.
  2. In the Users section, select System Users and click Add.
  3. Enter System Username, System User Role and click Create System User.
  4. On the System Users page, click Add Assets.
  5. Go to Select Asset typeAppsSelect assets and select your app name.
  6. Enable the Manage App option in the Full Control section and click Save Changes.
  7. On the System Users page, click Generate New Token.
  8. Select your app from the dropdown list.
  9. Enable the whatsapp_business_management and whatsapp_business_messaging permissions from the list and click Generate Token.

Complete the application setup

To complete the application setup:

  1. Go back to the My apps page and select your app.

  2. On the Dashboard page, go to the Add products to your app section, select WhatsApp, and click Set up.

  3. On the Getting started tab:

    • Go to Step 1: Select phone numbers and choose a phone number connected to your WhatsApp Business account.
    caution
    If 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.
  4. 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:

  1. Choose the project you will connect to the channel.
  2. In the dashboard, select Channels → Inbound → Connect channel.
  3. In the Messengers and social networks section, select WhatsApp.
  4. 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.
  5. 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:

  1. Select your app in the developer account.
  2. On the Products section in the sidebar, select WhatsAppConfiguration.
  3. On the Configuration tab, go to the Webhook section and click Edit.
  4. 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.
  5. Click Verify and save.
  6. In Webhook fields section select messages and click Subscribe for Webhooks messages.
  7. 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.