Skip to main content
The Meta Connector API lets an unattended integration deliver audiences to Meta Custom Audiences and send conversion events to Meta’s Conversions API. A person signs in once to create an API key and once to connect your Meta business, and the integration works from the API key after that. Complete the prerequisites and set up API access on this page before you follow either guide.

Choose a guide

Custom Audience delivery

Upload hashed identifiers and deliver them into a new or existing Custom Audience in one ad account.

Conversion events

Send offline conversion events to a Meta dataset through the Conversions API, starting with test events.

Prerequisites

What you need depends on the guide you follow:

API key

Create the key under Settings → API Keys with read and write on datasets, uploads, connections, and installations, and read on jobs. Add webhooks if you want delivery notifications. See API Keys for the procedure and the Permissions Reference for what each resource covers. Create it from a shared team account rather than a personal login, so the integration keeps working when someone changes roles.

Facebook Connector installed

The Facebook Connector is app 8. Find your installation of it:
Record the installation ID. If no record has "app_id": 8, install the Facebook Connector from the Narrative Marketplace.

A connected Meta profile

A connector profile holds the Meta credentials that every delivery uses. You create it once per Meta business, in the Narrative UI:
1

Open the connector

In Narrative, go to Installed Apps and select Facebook Connector.
2

Choose a profile type

Choose System user for an integration. With a system-user profile, you name the ad account on each connection.
3

Sign in to Meta

Sign in to Meta in the popup and grant Narrative access to your business.
Every request in these guides then uses the profile ID. Find your profile shows how to look it up.

An eligible ad account

Custom Audiences go into an ad account that belongs to a Business Manager and has accepted Meta’s Custom Audience terms. List your ad accounts shows both. See Ad Account Eligibility for Custom Audiences to fix an account that does not qualify.

A Meta dataset ID

Conversion events go to a Meta dataset, which Events Manager also calls a pixel. Its numeric ID is on the dataset’s page in Events Manager, and List your Meta datasets returns it.

Set up API access

The guides talk to two hosts, and each takes its own credential:

Get an installation token

The Meta connector authenticates requests with an installation token, which you get by exchanging your API key. Use the installation ID from Facebook Connector installed:
Store access_token as $INSTALLATION_TOKEN. It lasts about three hours, so request a new one at the start of each run of your integration. Confirm that both hosts answer:
Send the API key to api.narrative.io and the installation token to facebook.narrativeconnectors.com.
API keys contain characters that shells mangle. Read the key from a file or an environment variable rather than pasting it inline.

Find your profile

GET /profiles lists every Meta profile in your company. To read one:
Use a profile whose status is enabled and whose token.is_valid is true. Record its id.

List your ad accounts

Choose an account where both supports_custom_audiences and user_accepted_custom_audience_tos are true. Keep the act_ prefix when you use the ID.

List your Meta datasets

id is a number. Conversion events carry it in meta_dataset_id.

Delivery notifications

The Facebook Connector reports each delivery as an app webhook event. Subscribe a webhook to app 8 to receive them:
Keep the secret to verify each delivery. The connector sends these events: To stop the notifications, delete the subscription with DELETE /webhooks/{webhook_id}. See App subscription for the subscription fields and Verifying deliveries for checking the secret.

Meta Custom Audiences Connector

Supported identifiers and audience membership duration

Meta Conversions API Connector

Every meta_conversion_event field, event name, and action source

Connector Interfaces

Why a dataset connects to an interface rather than a connector

API Keys

Create and rotate keys for programmatic access