Webhooks for Ad Accounts allow you to get real-time notifications for certain ads changes.
To set up Webhooks for Ad Accounts, the following steps are required:
Follow our Webhooks Getting Started guide to create your endpoint and configure your Webhooks. When you configure your webhooks, make sure to choose Ad Account
.
Currently, you can get real-time notifications for ad object status changes for WITH_ISSUES
and IN_PROCESS
. Subscribe to one or more fields below:
Field | Description |
---|---|
| Notifies you when a campaign, ad set or ad under the ad account receives the |
| Notifies you when a campaign, ad set, or ad exits the |
You need to subscribe your app to webhook notifications for your ad account. You app should have edit permission to the ad account to complete this step. The app should also have ads_management
permission.
To subscribe your app, have your app send a POST
request subscribed_apps
for the ad account:
curl -i -X POST \ -d "access_token=<ACCESS_TOKEN>" \ "https://graph.facebook.com/<VERSION>/act_<AD_ACCOUNT_ID>/subscribed_apps?app_id=<APP_ID>"
On success, you see this response:
{"success": "true"}
To see which app's are subscribed for your ad account has subscribed, send a GET
request:
curl -i -X GET \ -d "access_token=<ACCESS_TOKEN>" \ "https://graph.facebook.com/<VERSION>/act_<AD_ACCOUNT_ID>/subscribed_apps"
On success you see this response:
{ "data": [ { "name": "<APP_NAME>", "id": "<APP_ID>" } ] }
To remove an app from subscription, send a DELETE
request:
On success, you see this response:
{"success": "true"}
You can also subscribe app with Graph API Explorer.
Replace the me?fields=id,name
query with act_AD_ACCOUNT_ID/subscribed_apps
. It will subscribe the app you use to send the POST
request in Graph Explorer.
Or you can subscribe a different app by specifying subscribed_apps
as an input parameter with the app id.
The app must have permission to edit the ad account in order to subscribe.
[ { "object": "ad_account", "entry": [ { "id": "0", "time": 1568132516, "changes": [ { "field": "with_issues_ad_objects", "value": { "id": "111111111111", "level": "AD", "error_code": "567", "error_summary": "error summary", "error_message": "error message" } } ] } ] } ]