Platform SettingsPreferences > Configuring Preferences > WhatsApp Configuration

WhatsApp Configuration

Configuring Whatsapp Business API Account

This is a one-time configuration. Once this is configured and approved you can fetch the necessary information when needed.

Prerequisite: A dedicated phone number to be used as a WhatsApp sender number, which shouldn’t be linked to any WhatsApp account.

Creating a Business Account

  1. Visit Facebook Business Manager: Go to Facebook Business Manager, and if you’re not already logged in, log in with your personal Facebook account.
  2. Create a Business Account: Click on the “Business Settings” option in the top right corner. Then, click on “Accounts” and select “Business Account.” Follow the prompts to create a new business account.
  3. Business Verification (Optional): While verification is optional, it’s recommended for added credibility. To verify your business, follow the instructions provided during the setup. You may need to provide business documents.

💡Note: Not verifying your business might limit some functionalities, such as certain API access.

Logging into the Developer Console

  1. Access the Developer Console: Visit the Facebook for Developers website.
  2. Log in with Business Account: Click on “Log In” and use the Business Account credentials you just created to log in to the Developer Console.

Creating an App

  1. Access the Developer Dashboard: Once logged in, you’ll land on the Developer Dashboard. If you don’t see any existing apps, you can create one.


  2. Create a New App: Click on the “Create App” button. Follow the prompts to provide a display name, contact email, and other necessary details for your app.

Adding WhatsApp as a Product

  1. Access the App’s Dashboard: After creating the app, you’ll be taken to its dashboard.
  2. Add a Product: On the left sidebar, click on “Products” and then click the “Set Up” button next to “WhatsApp.” Follow the setup process, which may involve agreeing to terms and conditions.

Adding a Phone Number

Before proceeding to add payment details to your WhatsApp Business API setup, you need to register and verify a phone number. Here are the steps to add a phone number:

  1. Access WhatsApp Business API Dashboard: Log in to your WhatsApp Business API Dashboard using your Business Account credentials.
  2. Select Your WhatsApp Business API Instance: If you have multiple instances, select the instance for which you want to add a phone number. (https://business.facebook.com/settings/whatsapp-business-accounts/)


  3. Navigate to Whatsapp Accounts: Look for a section or option in your instance dashboard related to “Whatsapp Accounts”


  4. Add a Phone Number: In the Whatsapp account section, you should see an option “Add” Click on it.


  5. Enter Phone Number Information:
    • Provide the phone number you want to register for WhatsApp Business API.
    • You have to choose the country code and enter the phone number without any spaces or special characters.
  6. Verification Process:
    • WhatsApp will initiate a verification process to ensure the ownership of the phone number. This may involve receiving a verification code via SMS or phone call.
    • Enter the verification code when prompted to verify the phone number.
  7. Phone Number Added:
    • Once the verification is successful, WhatsApp will add the phone number to your WhatsApp Business API instance.
  8. Note the Phone Number ID:
    • After adding the phone number, note down the associated Phone Number ID. This is an important identifier for your WhatsApp Business API configuration and integration.
    • Ensure that you copy the Phone Number ID to a secure location, as you will use it in your API integration code. Treat this ID as sensitive information and do not expose it publicly.

Adding Payment Details in Account Information

  1. Navigate to Account Information: In the Developer Console, click on the account icon in the top right corner and select “Account Settings.”
  2. Update Payment Method: In the “Account Information” section, you’ll find “Payment Method.” Click “Edit” to add or update your payment information. This is important for billing related to WhatsApp API usage.

Creating and Managing Templates

  1. Access the WhatsApp Manager: In the Developer Console, go back to your app’s dashboard.
  2. Open WhatsApp Manager: Under “Products” in the left sidebar, click on “WhatsApp.” Then, click on “WhatsApp Manager.” (https://business.facebook.com/wa/manage/message-templates/ )
  3. Manage Templates: In the WhatsApp Manager, you can create and manage message templates. Click on “Message Templates” to create new templates or manage existing ones.
  4. Create Templates: To create a template, click on the “Create Message Template” button. Fill in the required details, including the template name, language, and message content. Make sure your templates comply with WhatsApp’s guidelines.
  5. Submit Templates for Approval: After creating templates, you’ll need to submit them for approval. WhatsApp will review and approve them if they meet the criteria.
  6. Use Approved Templates: Once approved, you can use these templates to send alert messages via the WhatsApp Business API.

Generating a Permanent Access Token

We recommend that you use system user access tokens to access the Business Management API and Cloud API. Generate a System User access token after creating a system user.

  1. Sign in to the Meta Business Suite.
  2. Locate your business account in the top-left dropdown menu and click its Settings (gear) icon.
  3. Click Business settings.
  4. Navigate to User > System users.
  5. Select the appropriate system user from the list of system users.
  6. Create a system user if not present
  7. Click the Generate new token button.
  8. Select the app that has been configured for WhatsApp API access.
  9. Necessary permissions are added to the token by default by selecting the app in the previous step and generating the token.

Since this token does not expire, it is critical to store it securely.

Creating Message Payload

There are a few types of messages WhatsApp supports, you only need text-based template messages. Refer to official documentation for more details.

Creating Message Payload in general

Creating a payload for a text-based template message using the WhatsApp Business Cloud API involves specific JSON formatting and considerations. Below is a simplified guide on how to structure a payload for a text-based template message for WhatsApp Business Cloud API. Please note that this is a general example, and you should consult the official WhatsApp Business API documentation for the most up-to-date information and specific requirements:

{
 "message": {
   "product": {
     "product_code": 
"your_product_code",
     "type": 
"PRODUCT"
   },
   "template": {
     "name": 
"your_template_name",
     "language": {
       "policy": 
"deterministic",
       "code": 
"your_language_code"
     },
     "namespace": 
"your_namespace",
     "components": [
       {
         "type": 
"BODY",
         "parameters": [
           {
             "type": 
"text",
             "text": 
"Your text-based template message goes here."
           }
         ]
       }
     ]
   }
 }
}

Here’s a breakdown of the components in this WhatsApp Business Cloud API payload:

  • “product”: Specifies the product associated with the message, including the product code and type (typically “PRODUCT”).
  • “template”: Contains details about the template message.
    • “name”: Your template’s name or identifier.
    • “language”: Describes the language settings for the template.
      • “policy”: Language policy (“deterministic” for predefined templates).
      • “code”: Language code for the template.
    • “namespace”: Namespace for your template.
    • “components”: Contains the components of your template message.
      • “type”: Type of component (“BODY” for the main message body).
      • “parameters”: Parameters for the component.
        • “type”: Specifies the type of parameter (in this case, “text” for text-based content).
        • “text”: The actual text content of your text-based template message.

Replace the placeholders such as “your_product_code”, “your_template_name”, “your_language_code”, “your_namespace”, and Your text-based template message goes here.” with your specific information and message content.

Creating Payload for vuSmartMaps™

Consider the template in the image below as the one configured and approved by WhatsApp.

In this template {{1}} {{2}} & {{3}} are placeholders for which whatsapp expects you to send the appropriate data for you to send the message.

For these placeholders, if you create a payload as mentioned in the “Creating Message Payload in general” section, it looks like the below one

{
  "messaging_product": 
"whatsapp",
  "type": 
"template",
  "template": {
      "name": 
"vualert",
      "language": {
          "code": 
"en"
      },
      "components": [

          {
              “type”: 

"body",
              "parameters": [
                  {
                      "type": 
"text",
                      "text": 
"Enter_Your_Alert_Name_Here"
                  },
                  {
                      "type": 
"text",
                      "text": 
"Enter_Your_Severity_Value_Here"
                  },
                  {
                      "type": 
"text",
                      "text": 
"Enter_Your_Insight_value_Here"
                  }
              ]
          }
      ]
  }
}

In the payload above “Enter_Your_Alert_Name_Here”, “Enter_Your_Severity_Value_Here”, “Enter_Your_Insight_value_Here” need to be substituted with appropriate Data.

💡Note: You can test if this payload is working as expected, by testing it using PostMan or Curl.

This Data is going to be substituted from the values from the alert document, consider the alert document below.

{
   "Alert-Rule-Name": 
"High_CPU_Usage_Alert",
   "doc_type": 
"alert",
   "tenant_id": 
"1",
   "bu_id": 
"1",
   "timeToDetect": 300.0,
   "severity": 
"critical",
   "level": 
"1",
   "Type": 
"CPU_Usage",
   "description": 
"The CPU usage has exceeded 90% for a sustained period of time.",
   "summary": 
"High CPU Usage Detected",
   "R1": {
       "M1": {
           "label": 
"CPU Usage",
           "type": 
"number",
           "value_for_eval_duration": 
"95",
           "formatted_value_for_eval_duration": 
"95%",
           "color": 
"#dd171d",
           "insights": 
"Need immediate attention! CPU usage is critically high.",
           "matched_threshold": 
"> 90"
       },
       "status": 
"Unavailable",
       "name": 
"Server001"
   },
   "tags": [
       
"Infrastructure",
       
"CPU",
       
"Critical"
   ],
   "group_label": 
"High_CPU_Alerts",
   "timestamp": 
"2023-10-03 09:15:00",
   "Day": 
"Monday",
   "@timestamp": 
"2023-10-03T09:15:00.000Z",
   "Alert-Rule-Evaluation-Duration": 
"5 Minutes",
   "Enterprise Name": 
"YourCompany Inc.",
   "active_period_execution": 
true,
   "alert_id": 
"987654321",
   "alarm_state": 
"Triggered",
   "start_time": 
"2023-10-03T09:15:00.000Z",
   "type": 
"CPU_Usage_Alert",
   "index_prefix": 
"yourcompany-12345-cpu-alerts"
}

Considering the alert document above, you can substitute the values Enter_Your_Alert_Name_Here”, Enter_Your_Severity_Value_Here”, Enter_Your_Insight_value_Here” in the payload create above with template variables {{Alert-Rule-Name}}, {{severity}} and {{R1>M1>insights}}. (Refer to How to create template variables from alert doc under the SMS message creation section of User Guide).

Now the Final Template to configure in the vuSmartMaps will look like the below:

{
  "messaging_product": 
"whatsapp",
  "type": 
"template",
  "template": {
      "name": 
"vualert",
      "language": {
          "code": 
"en"
      },
      "components": [

          {
              “type”: 

"body",
              "parameters": [
                  {
                      "type": 
"text",
                      "text": 
"{{Alert-Rule-Name}}"
                  },
                  {
                      "type": 
"text",
                      "text": 
"{{severity}}"
                  },
                  {
                      "type": 
"text",
                      "text": 
"{{R1>M1>insights}}"
                  }
              ]
          }
      ]
}
}

Resources

Browse through our resources to learn how you can accelerate digital transformation within your organisation.