A WhatsApp app is what connects your WhatsApp business number to your webhook (the main element of the experience: this is where you receive, process and send messages. ) and is where you configure various settings for the WhatsApp experience.
In this guide, you'll learn how to set up a WhatsApp app.
Requirements
Before you begin, a few things will need to be created. Make sure you have all of the following:
Facebook Developer Account: Your developer account is needed to create new apps, which are the centerpiece of any WhatsApp integration. You can create a new developer account by logging into the Facebook https://developers.facebook.com/ developer website and clicking the "Get Started" button.
Facebook Business Account: Meta Business Manager is a tool that helps you organise and manage your business. You can create your business manager by following this guide Create a Business Manager
Facebook app: The Facebook app contains settings for your WhatsApp experience. To create a new app, visit the app dashboard by clicking "My Apps" in the top bar of the developer page.
Webhook URL: Actions that take place in conversations, such as new messages, are sent as events to your webhook. Along with the callback url, a verification token will be provided that will need to be used when installing the app. CTLiveSocial needs to be reachable via a public WebHook according the following format
https://<public_ctlivedomain>/ctlivesocial/<tenantname>/whatsapp/<appid>
Phone number: a valid phone number you want to connect to your WhatsApp Business account
Creating a new Facebook app
To create a Facebook app, from the Facebook developer page (https://developers.facebook.com/ ), click on "My Apps" and then on the "Create an app" button.
Then follow the following steps in the wizard:
Link your Business account to the app.
Select the type of app. App types determine which products can be added to an app in the app dashboard and what permissions and features can be requested for approval through the app review process. For this app, choose “Business” type.
Enter details about the app such as app name, email address, and purpose. Then press the "Create App" button to finish the creation process.
Installation steps
Before you begin, make sure that you have met all the requirements listed above.
Add the WhatsApp platform to your Facebook app
In the app's settings sidebar under "PRODUCTS", click "Add Product".
Hover over "WhatsApp" to see the options.
Click the "Set up" button. The WhatsApp platform will be added to your app and the WhatsApp settings console will appear.
Configuration
Under the section WhatsApp, select the “Getting started” option and go to step 5 Add a phone number to start sending messages to any WhatsApp number.
Fill the inputs, insert the phone number that you want to use as business number and verify it.
You can later complete the profile information of your phone number by clicking “see the Overview page.” on step 5:
Set up the webhook for your app
Under the section WhatsApp, select the “Configuration” option
In the "Callback URL" field, enter the public URL for your webhook.
In the "Verify token" field, enter the verification token for your webhook.
Click "Verify & Save" to confirm the callback URL. The WhatsApp platform will send a GET request to your webhook with the verification token you provided. If your webhook is valid and configured correctly to respond to the verification request, the settings of your webhook will be saved.
manage the webhook fields and be sure you are subscribed to the following: account_review_update, account_update, message_template_status_update, messages, phone_number_name_update, phone_number_quality_update
Add app to your Business Manager
now you have to add the app you’ve just created to your Business Manager.
you can follow this guide Add apps to your Business Manager to help you in the process
in your Business Manager, under Accounts, click Apps
click the blue Add drop-down menu
select Connect an app ID to add your app
Add System Users to Your Business Manager
System users represent servers or software that make API calls to assets owned or managed by a Business Manager
to add a system user to your Business Manager, follow this guide Add System Users to Your Business Manager
Go to Business Settings
Below Users, click System Users.
Click Add New System User
Give a name to the system user, give him Admin access and click Create System User
Assign your app as Assets to the user created and give the user full control
Generate Permanent token
Go to Business Settings of your Business Manager
Below Users, click System Users.
Select the user created in the previous step
click Generate New Token
select your app
Make sure you have checked the “Available permissions”: whatsapp_business_messaging, whatsapp_business_management
click Generate Token
save and store the generated token in the connector configuration on MongoDB