Platform Settings > Preferences > Configuring Preferences > WhatsApp Configuration
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.
💡Note: Not verifying your business might limit some functionalities, such as certain API access.
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:
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.
Since this token does not expire, it is critical to store it securely.
There are a few types of messages WhatsApp supports, you only need text-based template messages. Refer to official documentation for more details.
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:
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.
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}}"
}
]
}
]
}
}
Browse through our resources to learn how you can accelerate digital transformation within your organisation.
VuNet’s Business-Centric Observability platform, vuSmartMaps™ seamlessly links IT performance to business metrics and business journey performance. It empowers SRE and IT Ops teams to improve service success rates and transaction response times, while simultaneously providing business teams with critical, real-time insights. This enables faster incident detection and response.