# How to connect Meta Ads to AI agents?

Connect Meta Ads (Facebook & Instagram) to Sequel with OAuth and ask about ad spend, ROAS, and campaign performance in plain English.

Connect **Meta Ads (Facebook & Instagram)** to Sequel and ask about ad spend, ROAS, impressions, clicks, and campaign performance in plain English — from the Sequel app or any AI tool wired up to the [MCP server](/docs/install). Then join it with your revenue or product data to answer questions a single tool can't.

## What you'll need

- A **Meta (Facebook) account** with access to the ad accounts you want to query.
- Authorization through Meta's OAuth flow — Sequel requests the **`ads_read`** and **`business_management`** scopes (read-only).

Meta Ads connects over **OAuth**, so there's no key to copy — you authorize Sequel with your Facebook account and it gets read access to the ad accounts that account can see.

<Callout type="info" title="Tokens last ~60 days">
Meta issues a long-lived token (~60 days) that can't be silently refreshed. When it nears expiry, Sequel asks you to reconnect so queries don't fail mid-run.
</Callout>

## Connect it

<Steps>
<Step title="Open a new connection">
In the Sequel dashboard, go to **Connections → New connection** and choose **Meta Ads**.
</Step>

<Step title="Sign in with Facebook">
You'll be redirected to Meta's consent screen. Sign in and grant Sequel read access (`ads_read`, `business_management`) to your advertising data.
</Step>

<Step title="Confirm">
Sequel verifies the connection (it reads your Meta profile to confirm access) and the connection goes live.
</Step>

<Step title="Pick an ad account when you query">
The connection covers every ad account your Facebook user can access. List them with **List Ad Accounts** to get each account id (in `act_<id>` form), then point your questions at the account you care about.
</Step>
</Steps>

## What you can query

- **Ad accounts** — id (`act_<id>`), name, status, currency, timezone, and business name.
- **Campaigns** — name, status, objective, schedule, and daily/lifetime budgets.
- **Ad sets** — status, budget, billing event, optimization goal, and targeting (geo, demographics, interests, audiences).
- **Ads** — name, status, parent ad set, and creative reference.
- **Insights** — spend, impressions, clicks, CTR, CPC, CPM, reach, frequency, and conversion actions (purchases and revenue live in `actions` / `action_values`) at account, campaign, ad set, or ad level — over presets like `last_30d` or an explicit date range, with daily/monthly buckets and breakdowns by age, gender, country, publisher platform, device, and more.

## Try it

- "What was our total Meta ad spend last 30 days, broken down by campaign?"
- "Which campaigns had the best ROAS this month?"
- "Show daily spend and clicks for the last 7 days."
- "Break down impressions by country and publisher platform for last month."

## Join it with other sources

Meta Ads gets more powerful next to your other data. With a database also connected, ask:

> "Compare last month's Meta ad spend by campaign against signups in our Postgres `users` table over the same dates."

## Troubleshooting

| Symptom | Likely fix |
| --- | --- |
| No ad accounts listed | The Facebook account you authorized doesn't have access to any ad account — reconnect with an account that does, and make sure you granted the `ads_read` / `business_management` scopes. |
| Authorization fails | Re-run the OAuth flow and approve the requested read scopes; if it persists, reconnect to issue a fresh 60-day token. |
| Insights come back empty | Confirm the ad account actually ran delivery in the date range, and that you're querying the right `object_id` and `level`. |

## Related

- [Connecting your first data source](/docs/connecting-your-first-data-source)
- [Chatting with your data](/docs/chatting-with-your-data)
- [Browse all integrations](/docs/integrations)
