Integrating with webhooks allows businesses to receive real-time notifications about changes to their WhatsApp Business Account (WABA). These updates can include policy violations or account restrictions, enabling businesses to take timely corrective actions.
Before You Begin
To set up webhooks, you’ll need:
- A Meta Developer account.
- A Business Manager account.
- A Meta for Developers App linked to your Business Manager.
When creating your app:
Steps to Add WhatsApp as a Product:
- Go to Meta Developers and log in.
- Select your app to open the dashboard.
- In the left panel, click “Add Product”.
- Locate WhatsApp and click “Set Up”.
Make sure your app:
- Completes the App Review process.
- Requests the (whatsapp_business_management) permission.
Steps to Set Up Webhooks
Step 1: Create Endpoint and Configure Webhooks
Follow the Meta Webhooks Getting Started Guide to create an endpoint and configure your webhook.
Step 2: Subscribe Your App to WABA Notifications
You can subscribe your app to WABA notifications using one of the following methods:
- API Calls: Use the Graph API to set up your webhook subscriptions programmatically.
- Graph API Explorer: Manually subscribe to webhook notifications through the Graph API Explorer.
Step 3: Sign Up for Account Updates
Once your app is subscribed, refine the types of updates you want to receive by selecting specific webhook fields.
- Go to your app’s dashboard and navigate to Settings > Webhooks.
- Click Manage under Webhook Fields.
- Select account_update and click Subscribe.
This ensures you’ll receive notifications whenever your WABA violates policies.
Example Notification for Policy Violations:
json
Copy code
{
“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
Monitor your webhook for restrictions due to policy violations. Notifications will include the restriction_info field detailing the restriction type and expiration.
Example Notifications for Restrictions:
- Restriction on Adding New Phone Numbers:
json
Copy code
{
“field”: “account_update”,
“value”: {
“phone_number”: “PHONE_NUMBER”,
“event”: “ACCOUNT_RESTRICTION”,
“restriction_info”: [
{
“restriction_type”: “RESTRICTION_ON_ADD_PHONE_NUMBER_ACTION”,
“expiration”: TIMESTAMP
}
]
}
}
- Restricted from Business-Initiated Messages:
json
Copy code
{
“field”: “account_update”,
“value”: {
“phone_number”: “PHONE_NUMBER”,
“event”: “ACCOUNT_RESTRICTION”,
“restriction_info”: [
{
“restriction_type”: “RESTRICTED_BIZ_INITIATED_MESSAGING”,
“expiration”: TIMESTAMP
}
]
}
}
- Restricted from User-Initiated Messages:
json
Copy code
{
“field”: “account_update”,
“value”: {
“phone_number”: “PHONE_NUMBER”,
“event”: “ACCOUNT_RESTRICTION”,
“restriction_info”: [
{
“restriction_type”: “RESTRICTED_CUSTOMER_INITIATED_MESSAGING”,
“expiration”: TIMESTAMP
}
]
}
}
Why Webhooks Matter
By subscribing to webhooks, you can:
- Stay informed about policy violations.
- Take immediate action to resolve issues.
- Minimize potential disruptions to your account.
For more guidance, contact WePOS Support at support@wepos.ai. Let us know how we can assist you!