> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omneo.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Meta Lead Ads

> Syncing Meta Lead Ads submissions to Omneo profiles automatically.

The Meta Lead Ads integration captures leads from Meta (Facebook/Instagram) Lead Ad campaigns and automatically creates or updates Omneo profiles with the submitted data.

## How it works

1. A prospect completes a Meta Lead Ad form
2. Meta fires a `leadgen` webhook to the Omneo Meta extension
3. The extension creates or upserts an Omneo profile with the lead's data
4. Reactions can fire to issue a welcome benefit, trigger a comms notification, or enrich the profile

## Prerequisites

* A Meta Business account
* A Meta App configured for webhook delivery
* Your Omneo tenant credentials (provided by Omneo team)
* The `extension-meta` deployed to your Omneo tenant (handled by Omneo team)

## Step 1: Create a Meta App

1. Go to [Meta Developer](https://developers.facebook.com/apps)
2. Create a new App: select **Other → Business**
3. Note down the **App ID** and **App Secret**

## Step 2: Generate a long-lived page access token

1. Go to the [Graph API Explorer](https://developers.facebook.com/docs/pages/access-tokens/) and select your App
2. Add these permissions: `pages_show_list`, `ads_management`, `ads_read`, `leads_retrieval`, `pages_read_engagement`, `pages_manage_metadata`, `pages_manage_ads`
3. Select **Generate Access Token** and copy the short-lived token
4. Exchange for a long-lived token:

```shell theme={null}
curl -X GET "https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id=APP-ID&client_secret=APP-SECRET&fb_exchange_token=SHORT-LIVED-TOKEN"
```

5. Exchange for a page access token:

```shell theme={null}
curl -X GET "https://graph.facebook.com/PAGE-ID?fields=access_token&access_token=LONG-LIVED-USER-TOKEN"
```

## Step 3: Configure the webhook

1. In your Meta App, select **Add Product → Webhooks**
2. Select **Page** from the dropdown and select **Subscribe to this object**
3. Enter a webhook verification token (you choose this) and the Omneo-provided callback URL
4. Select **Verify and Save**
5. Subscribe to the `leadgen` event

Install the app to your page:

```shell theme={null}
curl -X POST "https://graph.facebook.com/{page-id}/subscribed_apps?subscribed_fields=leadgen&access_token={page-access-token}"
```

## Step 4: Provide credentials to Omneo

Provide your Omneo implementation team with:

* Long-lived user access token
* Page access token
* Webhook verification token

Omneo will configure the extension and begin receiving Lead Ad submissions automatically.

## What gets created in Omneo

For each lead submission, Omneo creates or updates a profile using the fields captured in your Lead Ad form. Common mapped fields: `first_name`, `last_name`, `email`, `mobile_phone`. Custom questions in your form can be mapped to Omneo custom attributes.
