Configuring a WhatsApp chatbot using Facebook Cloud API

  1. Overview
  2. Support Articles
  3. Configuring a WhatsApp chatbot using Facebook Cloud API

To get your WhatsApp chatbot up and running, we have to complete a few steps over at Facebook. Unfortunately it's somewhat more involved than the Telegram chatbot, but take your time reading through this and follow the steps carefully:

  1. Go to https://developers.facebook.com/apps and press "Create App". It is recommended to create a business profile first and connect it to the app it when asked.
  2. Select "Other" then "Business" as the App Type:



  3. Fill in your business details
  4. Enter your Facebook password when prompted and the app will be created.
  5. Now click on the newly created app - it will appear in the list. 
  6. Scroll down to "Add products to your app" and add WhatsApp



  7. If you need to create a Business Facebook account, do so when prompted, otherwise select your Facebook Business page from the drop down.
  8. You will now be at the "Quickstart" WhatsApp page. 
  9. Scroll down to "Webhooks" and tap "Configure Webhooks".
  10. Click "Edit" and enter https://www.2ndnumber.tel/wacb.php in the "Callback URL" field, and HgstebGSte56437JShtr in the "Verify token" field. Tap "Verify and Save"
  11. Tap "Manage" button next to "Webhook fields" and press the "Subscribe" button next to the "messages" row



  12. Now tap "Quickstart" under the "WhatsApp" option:



    Then tap "Add Phone Number". Complete the "WhatsApp Business Profile" form as you see fit and tap "Next". Now, type your 2ndNumber phone number and select either SMS or voice verification. Either is fine. 
  13. Your number will now appear but it will be "pending review" or "unavailable". This can take up to an hour. Once it is no longer pending review we need to go back to: https://developers.facebook.com/apps and then select our app again.
  14. Now tap "App Dashboard" -> "Business Settings"



  15. On the left menu, select "Users" > "System Users". Click the Add button and you will get a pop-up window. Enter the user name and choose "admin" as the system user role.



  16. Now, you'll see the new user created. Click on the "Add Assets". Choose "App" > Select your app > Select "Full control" option then save changes.



  17. Now tap "WhatsApp Accounts" from the left side menu



  18. Press the "Add People" button, select the user you just created, and select "Full Control"




  19. Now go back to "System Users" on the left hand menu and tap "Generate New Token"



  20. Select your app we created earlier from the list, and scroll down to tick "whatsapp_business_messaging" and "whatsapp_business_management" and then tap "Generate token". You'll be given a token on screen that you MUST copy and paste somewhere safely as it is not stored anywhere. We will need it in 2ndNumber.



  21. Now go back to https://developers.facebook.com/apps  - Select your app > Scroll to "WhatsApp", click the down arrow > "API Setup". Make a note of your phone number ID




  22. Phew! We're done with Facebook. Now go back to your 2ndNumber WhatsApp Chatbot and tap "Set Bot Details". Enter the Phone ID in step 21 into the first box and the token from step 20 in the second box. 
    NOTE: The phone ID is NOT the phone number, it is the special ID you got from step 21.


  23. And we're done! You just need to build your chatbot now by following the instructions on the left hand side. If you get stuck, do let us know.

 


Was this article helpful?