Summary
As a business, it's essential to stay on top of any changes to your WhatsApp Business Account (WABA), especially when it comes to WhatsApp Policy violations. By integrating with webhooks, you can receive real-time notifications about changes to your WABA, allowing you to quickly adjust your behavior and avoid additional warnings and/or enforcement actions.
Instructions
Before You Start
To complete this guide, you'll need to:
Register as a Meta Developer
Set up a Business Manager account
Create a Meta for Developers App with the Business type and link it to your Business Manager
Add WhatsApp as a product to your application
Ensure your app has completed the App Review and requested the
whatsapp_business_managementpermission To add WhatsApp as a product to your application, follow these steps:Go to Facebook's Developer Portal and click on your app
On the app dashboard, find Products on the left side panel and click Add Product
Find WhatsApp and click Set Up
Step 1: Set up Endpoint and Configure Webhooks
Follow our Webhooks Getting Started guide to create your endpoint and configure your webhooks.
Step 2: Subscribe Your App to Your WABA
You need to subscribe your app to webhooks notifications for your WABA. You can do this in two ways:
Step 3: Sign Up for Account Updates
Now that your app is subscribed to webhooks, you can define which types of updates you want to receive. To track your WABA's status, select the account_update option. This will notify you when your WABA has violated WhatsApp policies. To select this option:
Go to your App Dashboard and find the Settings option
Click on Webhooks and then Manage
A dialog box will appear with all the fields you can subscribe to. Click Subscribe for
account_updateYou will receive a notification like this when your WABA has violated a policy:
{
"object": "whatsapp_business_account",
"entry": [
{
"id": "whatsapp-business-account-id",
"time": 1604703058,
"changes": [
{
"field": "account_update",
"value": {
"phone_number": "16505551111",
"event": "ACCOUNT_VIOLATION",
"violation_info": {
"violation_type": "ALCOHOL"
}
}
}
]
}
]
}
Step 4: Track WABA Restrictions
Keep an eye on your webhooks to check if your WABA has been restricted due to policy violations. If a restriction has been imposed, you'll receive a webhook with the restriction_info field, which lists all restrictions imposed on your account and when those restrictions expire. Here are some examples of webhooks that report restrictions:
Restriction on adding new phone numbers:
{
"field": "account_update",
"value": {
"phone_number": "PHONE_NUMBER",
"event": "ACCOUNT_RESTRICTION",
"restriction_info": [
{
"restriction_type": "RESTRICTION_ON_ADD_PHONE_NUMBER_ACTION",
"expiration": TIMESTAMP
}
]
}
}Restriction on sending business-initiated messages:
{
"field": "account_update",
"value": {
"phone_number": "PHONE_NUMBER",
"event": "ACCOUNT_RESTRICTION",
"restriction_info": [
{
"restriction_type": "RESTRICTED_BIZ_INITIATED_MESSAGING",
"expiration": TIMESTAMP
}
]
}
}Restriction on responding to user-initiated messages:
{
"field": "account_update",
"value": {
"phone_number": "PHONE_NUMBER",
"event": "ACCOUNT_RESTRICTION",
"restriction_info": [
{
"restriction_type": "RESTRICTED_CUSTOMER_INITIATED_MESSAGING",
"expiration": TIMESTAMP
}
]
}
}
By following these steps, you'll be able to set up webhooks for your WABA and receive real-time notifications about changes to your account, helping you stay compliant with WhatsApp policies and avoid any potential issues.
Frequently Asked Questions (FAQs)
Getting started
1. What do I need before setting up webhooks for my WABA?
You need to register as a Meta Developer, set up a Business Manager account, create a Meta for Developers App with the Business type, link it to your Business Manager, and add WhatsApp as a product. Your app must also complete App Review and request the whatsapp_business_management permission.
2. How do I add WhatsApp as a product to my app?
You can add WhatsApp by going to the Facebook Developer Portal, opening your app, selecting Add Product, finding WhatsApp, and clicking Set Up.
Configuring webhooks
3. How do I set up an endpoint and configure webhooks?
You can follow the Webhooks Getting Started guide to create your endpoint and configure webhook settings.
4. How do I subscribe my app to receive WABA webhook notifications?
You can subscribe your app either by using API calls or through the Graph API Explorer.
5. What types of updates can I subscribe to?
For tracking WABA status, you should subscribe to the account_update field, which notifies you of policy violations and account-related events.
Policy violation notifications
6. How will I know if my WABA has violated a policy?
You will receive a webhook notification with the event field set to ACCOUNT_VIOLATION, along with details about the violation type.
7. What information is included in a policy violation notification?
A violation notification includes the phone number, event type, and a violation_info field showing the specific policy violation.
Tracking restrictions
8. How can I track restrictions placed on my WABA?
You will receive webhook notifications containing the restriction_info field, which lists any restrictions and their expiration times.
9. What types of restrictions might I be notified about?
You may receive notifications about restrictions on adding new phone numbers, sending business-initiated messages, or responding to user-initiated messages.
10. What should I do after receiving a restriction notification?
Monitor your webhooks for updates and adjust your messaging behavior to stay compliant with WhatsApp’s policies and avoid further enforcement actions.
