I made this tutorial because I think facebook docs is a bit confusing. I didn't find good stuff about connecting Leads ads forms with a webhook. But don't worry, this is what you need:
First:
- Create a new Facebook App
- Have any Facebook Page and leads ads forms created.
- Create a webhook. If you can't understand the Facebook docs, here's what you need:
- Any Verify Token, like 'string123'.
- A https callback url which will return the token verification. When you press 'Verify and Save', fb will check if the url is correct and the verification is ok. If ok, your App will be subscribed to one webhook.
Since you want to connect that webhook with the leads ads form, you have to subcribe it with your page. This will be done with the following steps:
Step 1: Go to the Graph API Explorer
Step 2: Select the application created before in the 'Application' select box.
Step 3: Generate a Page Access Token selecting the page where you have the leads ads forms. Check you are generating this with the App and no the Graph API Explorer.
Step 4: Run this: POST /{page-id}/subscribed_apps
And that's all :)
Step 4 seems incomplete. The docs for that endpoint suggest a payload like
subscribed_fields=leadgen
.https://developers.facebook.com/docs/graph-api/reference/v7.0/page/subscribed_apps