Facebook Lead
Webhook
Facebook Lead allows you to receive a webhook whenever a person submits one of your Facebook Lead Ads forms (event "lead"), with the person's answers.
It is sent for a Facebook Pages connection (facebook_type 3), to the URL
you set with Set Webhook for that
connection. Delivery, retries and duplicates are explained on the
Webhook Events page.
The content of the lead. Meta's webhook carries only the IDs of a
lead. So for every lead we fetch the lead from Facebook and send it to you
in lead, with the answers of the form, and add leadFetched:
leadFetched | Meaning |
|---|---|
true | lead holds the lead's content: the answers (fieldData and fields), createdTime, isOrganic and disclaimerResponses. |
false | We could not fetch the lead, so lead is null. The IDs in the event (leadgenId, formId, adId, adgroupId) are valid: you can fetch the lead again later with Get Lead and the leadgenId. |
You don't need Get Lead to receive your leads: it stays available as an optional re-fetch.
- When Facebook fails for a moment (a timeout, too many requests), we try
again for a few minutes before we send the lead with
leadFetchedfalse. So a lead event can reach you a few minutes later than usual. - When the problem will not pass by itself — for example, the connection's
access expired (onboard it again) or the permission to read leads is
missing — the lead is sent at once with
leadFetchedfalse.
The answers (names, email addresses, phone numbers …) are personal data of the person who filled in the form. We keep them with the event in our history for one year, and in our service logs for 30 days, so we can recover a lead for you if your server missed it. Store and protect them on your side accordingly.
Settings:
| Setting | Value |
|---|---|
| URL | Your URL — set it with Set Webhook |
| Method | JSON via POST |
With every lead event, you will get some of the following:
{
"event": "lead",
"action": "created",
"eventId": "fbw_a3f6c9e2b5d81047f0c3e6b9a2d5f817",
"platform": "facebook",
"from": "463745743546345",
"facebook_type": 3,
"pageId": "104857362910483",
"leadgenId": "1293847560192837",
"formId": "918273645501928",
"adId": "120211938475610290",
"adgroupId": "120211938475610288",
"author": null,
"fromSelf": false,
"text": null,
"timestamp": 1795611000,
"lead": {
"createdTime": 1795611000,
"isOrganic": false,
"fieldData": [
{ "name": "full_name", "values": ["Dana Cohen"] },
{ "name": "email", "values": ["dana@example.com"] },
{ "name": "phone_number", "values": ["+972501234567"] },
{ "name": "preferred_contact_time", "values": ["morning", "evening"] }
],
"fields": {
"full_name": "Dana Cohen",
"email": "dana@example.com",
"phone_number": "+972501234567",
"preferred_contact_time": "morning"
},
"disclaimerResponses": [
{ "checkbox_key": "marketing_consent", "is_checked": "1" }
]
},
"leadFetched": true
}
Response explained
| Parameter | Description / Example |
|---|---|
event | "lead" always, for lead webhooks. |
action | "created" always. |
eventId | The unique ID of this event (fbw_ and 32 characters). The same lead always comes with the same eventId, so use it to ignore an event you already received. |
platform | "facebook" always. |
from | The ID of your connection — the from you use to call our API. |
facebook_type | 3 always (Facebook Pages). |
pageId | Your Facebook Page ID. |
leadgenId | The lead ID. Use it with Get Lead. |
formId | The ID of the Lead Ads form, or null when Facebook does not send it. |
adId | The ID of the ad the lead came from, or null (for example, an organic lead). |
adgroupId | The ID of the ad group the lead came from, or null (for example, an organic lead). |
author | null always: the person's details are in the answers. |
fromSelf | false always. |
text | null always. |
timestamp | When the form was submitted, as Facebook reports it (Unix time in seconds, UTC). |
lead | The lead's content (see below), or null when leadFetched is false. |
leadFetched | true — lead holds the content. false — we could not fetch it: lead is null and the IDs are valid. |
lead
| Parameter | Description / Example |
|---|---|
createdTime | When the form was submitted (Unix time in seconds, UTC), or null when Facebook does not say. |
isOrganic | true — the lead came from organic reach. false — it came from an ad. null when Facebook does not say. |
fieldData | The answers exactly as Facebook returns them: one name and values for each question. name is the question's key as Facebook sends it (for example full_name, email, phone_number, or the key of your own question). values is a list of texts: a multiple-choice question can have several. |
fields | The same answers as a simple list of name: value, with the first value of each question (null when it has none). For a question with several values, read fieldData. When two questions have the same name, fields has the first one. A question whose name can't be a key (an empty name, a name longer than 1,000 bytes, or a name that starts and ends with __) is only in fieldData. |
disclaimerResponses | The optional check boxes of your form's custom disclaimer, as Facebook returns them (checkbox_key, is_checked). null when the form has none. |
Webhook payload
Your response
- 200
- default
Received. Answer with any 2xx status (200, 201, 204 …) — we wait up to 5 seconds to connect and up to 15 seconds for your answer. The body of your answer is ignored.
Any other status, or no answer in time, counts as a failed delivery. We try again: immediately, then 5 minutes, 20 minutes, 1 hour, 4 hours and 24 hours after the previous failure. After that, the event is not sent again.