Cubu Docs
Technical Guide
Technical Guide
  • Welcome to Cubu's Technical Guide!
  • White Papers
    • Data Protection
    • Sign On and Authentication
  • Advanced Configuration
    • Configuring Video Meetings
      • ⚒️Using Microsoft Teams for Video Meetings
      • ⚒️Using Zoom for Online Meetings
    • Calendar Integration
      • ⚒️Configuring Microsoft Office 365 Calendar Integration
      • ⚒️Configuring Google Workspace Calendar Integration
    • Configuring Single Sign On (SSO)
      • ⚒️Configuring SSO with Azure AD
      • ⚒️Configuring SSO with Okta
      • ⚒️Configuring SSO with Auth0
    • Configuring Chatbots
      • Configure Chatbot using WhatsApp
  • Webhooks
    • Webhooks Configuration
    • Developing Webhooks
      • Dev Tools
      • HMAC Validation (ASP.NET Core)
    • Webhooks Reference
      • Organization Webhooks
        • 🪝Webhook: Send SMS
      • Data Table Webhooks
        • 🪝Webhook: Query
        • 🪝Webhook: Find
        • 🪝Webhook: Fetch
      • Service Webhooks
        • 🪝After Book Appointment
        • 🪝After Check In
        • 🪝After Close
        • 🪝Before Book Appointment
        • 🪝Before Check In
        • 🪝Before Queue-Up
        • 🪝Before Resolve
        • 🪝After Queue-up
        • 🪝After Resolve
        • 🪝After Start Work
      • Kiosk Webhooks
        • 🪝Before Query Appointments
  • Server to Server (S2S) API
    • Server to Server (S2S) API
Powered by GitBook
On this page
  • Create a Facebook App
  • Callbacks
  • Get an API Token
  • Get a Permanennt API Token
  1. Advanced Configuration
  2. Configuring Chatbots

Configure Chatbot using WhatsApp

PreviousConfiguring ChatbotsNextWebhooks Configuration

Last updated 4 months ago

To configure WhatsApp integration for production scenarios, you must have a verified WhatsApp business portfolio. The process of creating and verifying your business is beyond the scope of this guide. Please refer to Meta's documentation:

Cubu/WhatsApp integration contains two parts:

  • Configuring Cubu to send WhatsApp messages using the WhatsApp API.

  • Configuring WhatsApp to send messages received from customers using callbacks.

Configuring WhatsApp integration involves several steps:

  • Verify Business: You need to complete Facebook Business Verification through Business Manager.

  • Phone Number Approval

  • Build and Authenticate Your Application and get an API token

  • Setup Webhooks

This guide refers to 2 Meta portals:

Create a Facebook App

To create an app, go to Meta for developers / Apps () and click Create App.

Follow the instructions to create your app. Choose "Other" as the use case and "Business" as the app type.

Add the WhatsApp product to your application.

Set Phone Number ID

Go to the App Dashboard / WhatsApp / API Setup

  • Select a phone number from the dropdown menu (you will need a verified or test number generated by Meta).

  • Copy the Phone Number ID back to Cubu's Chatbot settings page:

Set the App Secret

  • Go to App Settings / Basic.

  • Copy the App secret from Facebook app settings into Cubu's "App secret" textbox:

Callbacks

In this step, you will configure WhatsApp callbacks. The callbacks are calls made by WhatsApp to notify Cubu when a customer sends a message to a chatbot.

In Meta for developers / App Dashboard, go to Webhooks.

Choose Whatsapp Business Account from the dropdown and click Edit Subscription.

Copy the callback URL provided by Cubu into the Callback URL textbox. Copy the Callback Verify Token you entered in Cubu, and click Verify and save.

In the table below, locate "messages," make sure v21.0 is selected, and click Subscribe.

Get an API Token

When you create your App in meta, you can generate an access token by clicking Generate Access token in the App Dashboard / API Setup.

However, this token is short-lived and expires after a couple of hours.

To get a permanent token, follow the instructions in the next section.

Get a Permanennt API Token

You need to set up a system user as the admin of your app. Then, you can generate never-expiring access tokens for this system user.

Add a system user to your Facebook app

  • Go to Users / System users. Click Add to create a new user. Make sure ut has the Admin role.

  • On the same page, in the "Assigned Assets" section, check whether your app is listed here. If not, add your app via the "Add asset" button, granting "Full control" over your app.

  • Goto to Accounts / WhatsApp accounts. Choose your WhatsApp account, and click Assign people.

  • Add the system user to your Whatsapp account in the "People" section, granting "Full control" over your Whatsapp account

  • Go back to Users > System Users and select the user you've created in the previous step.

  • Click "Generate new token" which reveals a "Generate token" dialog. Follow the instructions, and select the 2
permissions: whatsapp_business_management and whatsapp_business_messaging and confirm.

A new access token will be presented as a link. Click it and store the generated token safely; Facebook will not store it for you. This token will not expire.

  • Copy the token into Cubu's Access Token textbox.

Please see regarding access tokens.

Go to , choose your business portfolio, and click Settings.

Create a business portfolio in Meta Business Suite and Business Manager
Meta for developers
Meta Business Suite
https://developers.facebook.com/apps
Facebook documentation
Meta Business Suite
System Users
Manage assignments dialog
WhatsApp Accounts
Assign people dialog
Generate Token Dialog
Generated Token