<!-- Generated from the canonical 99 Digital API documentation. Do not edit this file. -->

Canonical page: https://docs.99digital.co.il/facebook-api/webhooks/facebook-lead

# Facebook Lead

**Webhook.** Sent to the webhook URL you configure.

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](https://docs.99digital.co.il/facebook-api/webhooks/set-webhook) for that
connection. Delivery, retries and duplicates are explained on the
[Webhook Events](https://docs.99digital.co.il/facebook-api/webhooks/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](https://docs.99digital.co.il/facebook-api/facebook-pages/get-lead) and the `leadgenId`. |

You don't need [Get Lead](https://docs.99digital.co.il/facebook-api/facebook-pages/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 `leadFetched` false.
  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 `leadFetched` false.

:::warning Lead answers are personal data
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](https://docs.99digital.co.il/facebook-api/webhooks/set-webhook) |
| Method | JSON via POST |

**With every lead event, you will get some of the following:**

```json
{
  "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](https://docs.99digital.co.il/facebook-api/facebook-pages/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

Content type: `application/json`

| Field | Type | Description |
| --- | --- | --- |
| `event` | string | "lead" always, for lead webhooks. Always `lead`. |
| `action` | string | "created" always. Always `created`. |
| `eventId` | string | 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. Example: `fbw_a3f6c9e2b5d81047f0c3e6b9a2d5f817`. |
| `platform` | string | "facebook" always. Always `facebook`. |
| `from` | string | The ID of your connection — the `from` you use to call our API. Example: `463745743546345`. |
| `facebook_type` | integer | 3 always (Facebook Pages). Always `3`. |
| `pageId` | string | Your Facebook Page ID. Example: `104857362910483`. |
| `leadgenId` | string | The lead ID. Use it with Get Lead. Example: `1293847560192837`. |
| `formId` | string \| null | The ID of the Lead Ads form, or null when Facebook does not send it. Example: `918273645501928`. |
| `adId` | string \| null | The ID of the ad the lead came from, or null (for example, an organic lead). Example: `120211938475610290`. |
| `adgroupId` | string \| null | The ID of the ad group the lead came from, or null (for example, an organic lead). Example: `120211938475610288`. |
| `author` | null | null always — the person's details are in the answers. |
| `fromSelf` | boolean | false always. Always `false`. |
| `text` | null | null always. |
| `timestamp` | integer | When the form was submitted, as Facebook reports it (Unix time in seconds, UTC). Example: `1795611000`. |
| `lead` | object \| null | The lead's content, or null when `leadFetched` is false. |
| `lead.createdTime` | integer \| null | When the form was submitted (Unix time in seconds, UTC), or null when Facebook does not say. Example: `1795611000`. |
| `lead.isOrganic` | boolean \| null | true — the lead came from organic reach. false — it came from an ad. null when Facebook does not say. Example: `false`. |
| `lead.fieldData` | array of object | The answers exactly as Facebook returns them: one `name` and `values` for each question. |
| `lead.fieldData[].name` | string | The question's key as Facebook sends it (for example `full_name`, `email`, `phone_number`, or the key of your own question). Example: `full_name`. |
| `lead.fieldData[].values` | array of string | The answer, as a list of texts — a multiple-choice question can have several. |
| `lead.fields` | object | 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`. |
| `lead.disclaimerResponses` | array \| null | The optional check boxes of your form's custom disclaimer, as Facebook returns them. null when the form has none. |
| `lead.disclaimerResponses[].checkbox_key` | string | The check box key. Example: `marketing_consent`. |
| `lead.disclaimerResponses[].is_checked` | string | "1" when the person checked it. Example: `1`. |
| `leadFetched` | boolean | true — `lead` holds the content. false — we could not fetch it: `lead` is null and the IDs are valid (fetch the lead again later with Get Lead and the `leadgenId`). Example: `true`. |

### Example: Lead

A person submitted your Lead Ads form — the answers are in `lead`.

```json
{
  "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
}
```

### Example: Lead not fetched

We could not fetch the lead — `lead` is null and `leadFetched` is false. The IDs are valid: fetch the lead again later.

```json
{
  "event": "lead",
  "action": "created",
  "eventId": "fbw_c7d0a4e9f2b63158d1e4a7c0b3f6d529",
  "platform": "facebook",
  "from": "463745743546345",
  "facebook_type": 3,
  "pageId": "104857362910483",
  "leadgenId": "1293847560199921",
  "formId": "918273645501928",
  "adId": "120211938475610290",
  "adgroupId": "120211938475610288",
  "author": null,
  "fromSelf": false,
  "text": null,
  "timestamp": 1795614600,
  "lead": null,
  "leadFetched": false
}
```

## Responses

### 200 — 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.

### default — 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.
