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_management
permission 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_update
You will receive a notification like this when your WABA has violated a policy:
json { "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:
json { "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:
json { "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:
json { "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
What do I need to do before setting up webhooks for my WhatsApp Business Account? You 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. Additionally, you need to add WhatsApp as a product to your application and ensure your app has completed the App Review and requested
whatsapp_business_management
permission.How do I add WhatsApp as a product to my application? You can add WhatsApp as a product to your application by going to the Meta for Developers website, clicking on your app, and then clicking on Add Product. From there, you can find and set up WhatsApp.
Setting Up Webhooks
How do I set up webhooks for my WhatsApp Business Account? You can set up webhooks by following our Webhooks Getting Started guide, which will walk you through the process of creating an endpoint and configuring your webhooks.
What types of updates can I receive through webhooks? You can receive updates on account updates, including policy violations and restrictions imposed on your WhatsApp Business Account.
Receiving Notifications
How will I receive notifications when my WhatsApp Business Account has been restricted? You will receive a webhook notification with the
restriction_info
field, which lists all restrictions imposed on your account and when those restrictions expire.What information will I receive in a webhook notification when my WhatsApp Business Account has violated a policy? You will receive a notification with the
account_update
field, which includes information about the policy violation, such as the type of violation and the phone number associated with the account.
Troubleshooting
What should I do if I'm not receiving webhook notifications? Check that your webhooks are set up correctly and that your app has the necessary permissions. You can also check the Meta for Developers documentation for troubleshooting tips.
How can I ensure that my WhatsApp Business Account is compliant with WhatsApp policies? You can ensure compliance by regularly reviewing the WhatsApp Commerce and Business Policies and adjusting your behavior on the platform accordingly. You can also use webhooks to receive notifications when your account has been restricted or has violated a policy.