Facebook Pages and lead ads
Base URL: https://chatsa.co/api/v1
A partner account can connect its Facebook Pages so every lead ad form submitted on them (on Facebook or Instagram) reaches you as a lead.received webhook, within seconds. Your customer connects their Pages in a window ChatSa hosts, with your product's name on it.
Availability. Lead ads are available to every business once Meta approves ChatSa's lead ads permissions (
leads_retrieval,pages_read_engagement,pages_manage_adsandads_management). Until then, only people ChatSa has added to its Meta app can connect Pages: ask ChatSa before you offer lead ads to your customers.GET /partner/capabilitiestells you whether the window is available at all (lead_ads).
This uses the partner API: authenticate every call with the account's key (Authorization: Bearer <account key>, 30 calls a minute). Paths are under https://chatsa.co/api/v1/.
Open a Facebook signup window#
POST /api/v1/partner/facebook/signups
Authorization: Bearer <account key>
{ "return_url": "https://app.example.com/chatsa/facebook/done", "state": "<random, up to 500 characters>", "locale": "en" }
201 with:
{ "data": { "id": "3c5d…", "url": "https://chatsa.co/partner/facebook-signup/3c5d…", "expires_at": "2026-11-30T10:30:00Z" } }
return_urlmust be exactly one of your app's registered redirect URIs, or the path/api/v1/chatsa/facebook/callbackon the origin of one of them (anhttpsorigin, orhttp://localhost/http://127.0.0.1). Anything else:400 invalid_return_url.stateis required (1–500 characters); a missing field is400 invalid_request.- A window is single use and lasts 30 minutes, like the WhatsApp window. A suspended account:
403 account_suspended. While lead ads aren't available on ChatSa:503 not_configured.
The window#
Open url in a popup. It has no ChatSa sign-in: it shows your product's name (in Arabic, with your app's Arabic name, when locale starts with ar) and a Continue with Facebook button. Facebook's own window then asks the business to log in and choose its Pages (Facebook shows ChatSa as the connecting app). ChatSa subscribes each chosen Page the person can advertise on to its lead ads, then the window goes to return_url with:
| Parameter | Value |
|---|---|
status | connected, cancelled or error |
signup | The signup id |
state | The state you sent: check it before anything else |
reason | When status=error: no_pages (no Page the person can advertise on was shared) or subscribe_failed (Facebook didn't let ChatSa receive any chosen Page's leads; the business should check that lead access is allowed for ChatSa in the Page's Leads Access settings) |
A passing problem (Facebook didn't confirm the login, or didn't answer) keeps the window open with a message, to try again.
A Page sends its leads to one ChatSa account. Connecting it from another account moves it there, and its counts start again.
Read the result#
GET /api/v1/partner/facebook/signups/{id} (the same account's key; another account's signup is 404 not_found):
{
"data": {
"status": "connected",
"pages": [{ "page_id": "104829375610245", "name": "Acme Plumbing" }],
"error": null
}
}
status is pending, connected, cancelled or error. error is null, the reason above, or expired (with status: "error") for a window not finished within 30 minutes.
The account's Pages#
GET /api/v1/partner/facebook/pages:
{
"data": [
{ "page_id": "104829375610245", "name": "Acme Plumbing", "status": "connected", "leads_received": 37, "last_lead_at": "2026-11-30T14:02:00Z", "connected_at": "2026-11-02T09:15:00Z" }
]
}
status is connected, or reconnect when Facebook no longer lets ChatSa read the Page's leads (for example, the business removed the permission or lost its role on the Page). Open a new signup window to reconnect.
DELETE /api/v1/partner/facebook/pages/{page_id} stops lead ads for that Page: { "data": { "page_id", "disconnected": true } }, or 404 not_found when the account receives no lead ads from that Page.
The lead.received event#
Subscribe your account webhook to lead.received (or lead.*, or *). The event belongs to the account, so chatbot_id is null and it never goes to a Connect endpoint.
{
"id": "evt_8e2b4f6a-1c3d-4e5f-8a9b-0c1d2e3f4a5b",
"event": "lead.received",
"chatbot_id": null,
"timestamp": "2026-11-30T14:02:05.000Z",
"data": {
"leadgen_id": "1234567890123456",
"created_at": "2026-11-30T14:02:00.000Z",
"backfill": false,
"page": { "id": "104829375610245", "name": "Acme Plumbing" },
"form": { "id": "880112233445566", "name": "Free estimate" },
"ad": { "id": "120211223344556677", "name": "Winter drain special", "campaign_name": "Q4 Bay Area" },
"platform": "facebook",
"is_organic": false,
"name": "Jordan Lee",
"email": "jordan@leedental.com",
"phone": "+14155550199",
"company": "Lee Dental",
"city": "San Francisco",
"job_title": "Office manager",
"fields": [
{ "name": "full_name", "values": ["Jordan Lee"] },
{ "name": "email", "values": ["jordan@leedental.com"] },
{ "name": "phone_number", "values": ["+14155550199"] },
{ "name": "what_needs_fixing", "values": ["Slow drain in the break room"] }
],
"consent": [
{ "key": "marketing_opt_in", "checked": true }
]
}
}
| Field | Meaning |
|---|---|
leadgen_id | Facebook's id for this submission |
created_at | When the form was submitted (null if Facebook didn't say) |
backfill | true for a submission made before the Page was connected (see below) |
page, form | The Page and the form it was submitted on (form.name may be null) |
ad | The ad's id and name and its campaign's name; each is null when Facebook doesn't give it (an organic submission has no ad) |
platform | facebook, instagram, or null if Facebook didn't say |
is_organic | true when the form was submitted without an ad (null if Facebook didn't say) |
name, email, phone, company, city, job_title | The form's standard questions, each null when the form didn't ask it. name is the full name, or the first and last names together. email is lower-cased. phone is in E.164 only when it is unambiguous (written with its country code, or read with the account's country); otherwise null, and the raw answer is in fields |
fields | Every answer, including your custom questions, as Facebook gives them (up to 60 questions) |
consent | The form's consent checkboxes and whether each was ticked |
- Each submission is delivered once. Use
leadgen_id(andX-ChatSA-Delivery) to skip repeats. - ChatSa also re-reads recent leads every hour, so a lead whose notification from Facebook was missed still arrives.
- The first read of a Page goes back up to 90 days (what Facebook keeps), so connecting a Page also delivers its recent leads, with
backfill: true. - Leads wait for a webhook: until an endpoint of the account takes
lead.received, nothing is delivered, and once one does, the hourly read delivers what arrived meanwhile (up to Facebook's 90 days). - Deliveries are signed and retried like every webhook: see Webhooks.
Leads without code#
A business that uses ChatSa directly connects its Pages itself: in a chatbot's Connect → Facebook, the card Facebook and Instagram lead ads (workspace admins). Its leads reach its own dashboard webhooks (Dashboard → Developers → Outbound webhooks) as the same lead.received event, so any URL can receive them, including catch hooks from Zapier, Make or n8n.