Getting WhatsApp API (Old approach)

To automate chats on your WhatsApp number, you need to procure a WhatsApp API from Meta or any other BSP.

Here is the process of obtaining a WhatsApp API from Meta:

Step 1: Setting up a Meta (Facebook) Business Account and App

Create a Meta (Facebook) business account:

  1. Visit the Meta (Facebook) Business account homepage here

  2. Enter your business name, your name, and work email address. Click 'Next'

  3. Provide your business details and click 'Submit'

  4. Enter your business details and click 'Submit'

Create a new Meta (Facebook) app here:

  1. Log in to your Meta (Facebook) developer account here

  1. Select 'My Apps'

  1. Select 'Create App'

  1. Select user case: 'Other' and click 'Next'

  1. Select app type: 'Business' and click 'Next'

  1. Provide app details: App name, app contact email, business account (optional), and click 'Create App'

Step 2: Setting Up Meta (Facebook) App for WhatsApp Integration

Add WhatsApp to your Meta (Facebook) app:

  1. Choose your app in the developer's dashboard here

  2. Locate 'Add products to your app' in your app's dashboard tab

  1. Select 'WhatsApp' for setup

  1. Select your Meta (Facebook) business account

  2. Navigate to App settings > Basic from the sidebar

  1. Set the Privacy Policy URL to https://ally.io/privacy

  1. Save changes

  2. Set 'App Mode' to Live

Step 3: Generate a Permanent WhatsApp Token

Follow these steps to obtain a permanent WhatsApp Access Token:

  1. Create a 'System user'

    • Visit the Meta Business Suite here

    • Locate your business account in the top-left dropdown menu and click 'Settings'

    • Click 'Business settings'

  • Go to Users > System users

  • Add an 'Admin' system user

2. Add assets

  • After creating the system user, click 'add assets'

  • Navigate to Apps > "Your app name"

  • Select your app and grant full control to manage the app

3. Generate system user access tokens

  • Click 'Generate new token' on the system user

  • Choose the app that will use the token and set the token expiration to never

  • Select "whatsapp_business_messaging" and "whatsapp_business_management" permissions

  • Generate the token

  • Copy the access token and store it securely

4. Add a new business number for WhatsApp

  • You can use your own business number or utilize the provided test number for your WhatsApp chatbot

  • In WhatsApp Developer Dashboard, navigate to WhatsApp > API Setup from the sidebar

  • Proceed to "Step 5: Add a phone number," click 'Add phone number'

  • Provide details required in the following form

  • Verify your number using the received code

  • Once successfully added, select your phone number in Step 1 of API Setup

5. Add a payment method

  • To send messages via WhatsApp, you need a valid payment method. Refer here for details

  • After adding your business phone number, click "Add payment method" to address the "Missing valid payment method" alert

  • You'll be directed to your WhatsApp account settings. Click 'Payment Methods' then 'Add business payment method' and follow the prompts to add your card info

6. Test your new business number for WhatsApp

  • Return to WhatsApp developer dashboard, navigate to API Setup > Step 1

  • Enter a testing 'To' number

  • Click 'Send message' to verify successful message delivery

Step 4: Configure WhatsApp API on Ally

1. Retrieve WhatsApp account Information

  • In WhatsApp developer dashboard, navigate to WhatsApp > API Setup

  • Coy the app ID

  • Copy the phone number ID

  • WhatsApp business Account ID

  1. Paste this copied data into Ally's WhatsApp channel configuration screen

  • Paste the phone number

  • Paste the permanent token (received from Step 3)

  1. Click 'Save' and you will see a 'Webhook URL' field generated

Step 5: Configure WhatsApp API Webhook Settings

1. Verify WhatsApp webhook callback

  • In WhatsApp developer dashboard, navigate to 'Configuration'

  • Under Webhook, click 'Edit'

  • Paste the 'Webhook URL' (received from Step 4) and the "Permanent Token" (received from Step 3)

  • Click 'Verify and save'

2. Configure Webhook subscription field

  • Under 'Webhook fields', click 'Manage'

  • Find the 'Messages' field and subscribe to it by checking the box

Step 6: Activate Your WhatsApp Bot and Test

  1. Make sure the WhatsApp chatbot is deployed and activated

  • Last deployed would show some recent time

  • Switch should be turned on

  1. Send a message to the WhatsApp number

  • On doing this, the the chatbot should respond back

  • You should be able to see the chat on the live chat screen

Last updated