WhatsApp Integration

WhatsApp Integration

This article will provide a walkthrough on the setup for the integrations of WhatsApp with the phone system.

WhatsApp Limitations Notice

  • WhatsApp integration is intended to answer inbound messages only. You cannot send an outbound message to a WhatsApp user without them having sent you a message first. You then have 24 hours to respond to the message. After that, you can no longer answer the message!
  • You cannot initiate a conversation with a WhatsApp user.
  • The number you configure must not be in use on another WhatsApp, for example it cannot be in use on your WhatsApp Business App on your mobile.

Pre-Requisite Notice

You must have a WhatsApp Business account set up with a phone number added prior to starting the integration. This number should not be registered to any other existing WhatsApp account, whether it be virtually or on any physical device.

If you want to use a number that is already set up on WhatsApp, you have to delete the account first. Read more here.

Setup Phases


Phase One: WhatsApp Configuration

Create a WhatsApp Application

  1. Navigate to the Facebook Development Portal. 
  2. Click Log In.
  3. Navigate to My Apps.
  4. Click on Create App.
  5. Select Business.
  6. Click Next.
  7. Give your application a display name and use the drop-down list to select your business account.
  8. Click Create app.
  9. Re-enter your password.
  10. Click Submit. The next screen will offer you to add products to your app.
  11. Scroll down to WhatsApp.
  12. Click Set up.
  13. Use the drop-down menu to ensure the correct phone number listed that you will use to send and receive messages. Copy your Phone number ID below the drop-down box and save it for a later stage. If you do not have a number attached to your WhatsApp account then follow the steps below.
    WAInteg2

Adding a Phone Number in WhatsApp

  1. Scroll down to the WhatsApp menu.
    WAInteg1
  2. Select Getting Started.
  3. Got to Step 5: Add a Phone Number.WAInteg3
  4. Click on the Add Phone Number button.
  5. Enter a WhatsApp Business profile display name.
  6. Select your timezone.
  7. Select a Category.
  8. Input a business description, if desired.
  9. Click Next.
  10. Enter your phone number.
  11. Choose your method of verification (Text or phone call).
  12. Click Next. Once verified, your number can be seen in the getting started “send and receive messages” drop-down section. Ensure it is selected and then
  13. Copy your Phone number ID below the drop-down box and save it for a later stage.

Setting up the Admin Role in WhatsApp

  1. Click on the menu icon.
    WAInteg4 
  2. Select the Business settings icon.
  3. Navigate to Users.
  4. Go to System Users.
  5. Click Add.
  6. Accept the non-discrimination policy.
  7. Click Done.
  8. Set a system user name. In this example, we have named it 3CX for simplicity.
  9. Set the user role to Admin.
  10. Click the Add Assets button. A pop-up will appear. 
    WAInteg5 
  11. Select Apps.
  12. Choose your app by the system name you provided in step 8.
  13. Enable the Manage App option.
  14. Click on Save Changes.
  15. Navigate to Accounts.
  16. Go to WhatsApp Accounts.
  17. Select your business app.
  18. Click Add People.
    WAInteg6
  19. Go to your previously created system user.
  20. Enable full control.WAInteg7
  21. Click the Assign button.

Generate a New Token

  1. Navigate to Users.
  2. Choose System Users.
  3. Click on Generate New Token.WAInteg9
  4. In the pop-up options, select your app from the drop-down list.
  5. Check the box to enable for whatsapp_business_messaging.
  6. Check the box to enable for whatsapp_business_management.
  7. Click Generate Token. The token will appear in a pop-up box.WAInteg8
  8. Copy the token and save it as it will not be available again. This is a permanent token. The token will not expire unless you click the revoke token button.

Phase Two : Sip Trunk Configuration

  1. Log into the bvoip phone system.
  2. Click on the Call Flow drop-down menu.
  3. Go to the SIP trunks menu item. 
  4. Select the WhatsApp button.
  5. In the Name field, input the desired name for the WhatsApp integration. 
  6. In the Access token field, input the access token from the Token Generation section
  7. In the Phone Number ID field, input the desired WhatsApp account phone ID in the e164 format (+countrycodeDID) as shown in the Create a WhatsApp Application section.
  8. Copy the Webhook URL.
  9. Click on the Save button.

Phase Three : Webhook Configuration 


Configuring the Webhook

  1. Navigate back to your Meta for Developers portal.
  2. Browse to your app.
  3. Go to the WhatsApp menu.
  4. Select the Configuration submenu.
  5. Click on Edit.
  6. In the Callback URL field, paste the copied webhook from the Sip Trunk Configuration Section.
  7. To verify the token, enter a random string of letters and numbers. This will not be needed again so there is no need to save your string for a later date.
  8. Click Verify and Save.
  9. Go to the Webhook Fields section.
  10. Click on Manage.WAInteg12 
  11. Go to Messages.
  12. Click the Subscribe button.
  13. Click the Done button. You can now proceed to test your configuration by sending a WhatsApp message to your configured number and ensuring your routing works correctly.