Capture new leads from Facebook Lead Ads, analyze with AI, and log in Google Sheets
Each new Facebook lead is logged to your Google Sheet with its details, plus the first and last name and a person-or-business flag that AI reads from the name.
Install it
Set up this Zap for me, read how here: https://zapier.sh/zapier/awesome-zaps/log-facebook-leads-to-google-sheets-with-ai/
Paste into Claude, ChatGPT, Cursor or any agent.
- Category
- Sales · Lead management
- Author
- Zapier
- Source
- zapier/awesome-zaps, folder zaps/log-facebook-leads-to-google-sheets-with-ai
Set it up with the CLI
- Add it. Copies the folder into
zaps/log-facebook-leads-to-google-sheets-with-ai/. Outside a project, it makes one first.npx zap-pack add awesome-zaps/log-facebook-leads-to-google-sheets-with-ai - Fill in the values in
config.ts, and in any other file the list marks. Replace each one as its comment and SKILL.md say. - Deploy it. Asks for any value still left, signs you in to Zapier if you aren't, then publishes it to your account.
npx zap-pack deploy log-facebook-leads-to-google-sheets-with-ai - Check it. Its recent runs, with status and errors.
npx zap-pack logs log-facebook-leads-to-google-sheets-with-ai
zaps/log-facebook-leads-to-google-sheets-with-ai/
- README.mdWhat it does, for people
- SKILL.mdHow an agent sets it up: what to ask you, and how to test it
- config.tsIts settings 1 to fill in
- connections/facebook-lead-ads.tsThe
facebook-lead-adsaccount it uses - connections/google-sheets.tsThe
google-sheetsaccount it uses - triggers/lead.tsWhat starts it:
facebook-lead-adslead1 to fill in - workflow.tsThe code; each
ctx.stepis a step in the Zap
Agents: add --yes to any command so it never prompts. When it needs an answer only the user can give, it stops and names the flag that supplies it.
SKILL.md
View MarkdownWhat it does
- Trigger: a person submits a lead form on a Facebook Page (
facebook-lead-ads,lead). - AI by Zapier (
get_completion) reads the submitter's full name and returns the first name, last name, aname_typeofperson,businessorunclear, and a one-sentence note explaining that call. It never invents a name. - Google Sheets adds one row with the lead ID, the submission time, the full name, email, phone, and the four values from the AI step.
The Zap writes one row per lead and never edits or deletes existing rows.
Ask the user
Each REPLACE_… value is set per person. Resolve names to IDs with the user's own connections; don't ask them to paste an ID you can look up.
| Setting | Where | What goes there |
|---|---|---|
REPLACE_FACEBOOK_PAGE_ID |
triggers/lead.ts, page |
The Facebook Page whose lead forms start the Zap: ask which Page it is, then look up its ID with the user's Facebook Lead Ads connection |
SPREADSHEET_ID |
config.ts |
The sheet that collects the leads: ask which sheet it is, then look up its ID (the long ID in its URL) with the user's Google Sheets connection |
Also review the defaults with them:
- The trigger listens to any form on the Page. To start it from one form only, add a
formparam intriggers/lead.tswith that form's ID. WORKSHEET_ID: the tab holding the leads."0"is the first tab.COLUMN_*values inconfig.ts: column keys such asCOL$A, not header names. Map the user's headers to their column letters, one for each value the Zap writes.MODEL_ID:standard/autoby default. Change it only if they want a stronger model.
Before turning it on, sample a lead with the Facebook Lead Ads connection and confirm the keys FULL_NAME, EMAIL and PHONE_NUMBER exist. Facebook's standard questions arrive in uppercase; custom questions use the key the form defines, so rename the keys in workflow.ts to match.
Build it
If you can run shell commands, set it up with zap-pack: run npx zap-pack add awesome-zaps/log-facebook-leads-to-google-sheets-with-ai, replace each REPLACE_… value as this file says, then run npx zap-pack deploy log-facebook-leads-to-google-sheets-with-ai, which signs the user in to Zapier when it gets there. Otherwise build with Zapier MCP, as the steps below say. No Zapier MCP tools? Read https://docs.zapier.com/mcp/get-started/quickstart.md and follow the page for the app you are running in to get the user connected, then continue with this build.
- Accounts: bind
facebook-lead-adsto the user's Facebook Lead Ads connection for the Page, andgoogle-sheetsto the user's Google Sheets connection for the account that owns the lead sheet. AI by Zapier needs no connection; it uses Zapier-managed credentials (authentication_id"0"). - Source: publish
workflow.tsandconfig.ts, with eachREPLACE_…replaced by the user's answer.triggers/lead.tsandconnections/are settings, not code: set the workflow's trigger and connection bindings from them. The trigger file names the app by its slug; for the trigger'sselected_api, callsearch_triggerswith that slug, find the row whosekeyis the trigger'sevent, and use<app_key>@<app_version>from it. - Build guide: load Zapier's build guide with
get_zapier_skill("zapier:build-workflows")and follow it to create, test and publish the workflow. - Fields: inspect each action's fields with the user's connections (and sample the trigger) before the first test run. Fix any key in
workflow.tsthat doesn't match, including theCOL$keys and the AI step'soutputFields.
Test it
Run this sample as a draft test (run_workflow_draft in Zapier MCP), with a test lead the user sets up for this, not a real one:
{
"id": "install-test-lead-0001",
"created_time": "2026-10-29T10:15:00+0000",
"FULL_NAME": "[install-test] Jordan Rivera",
"EMAIL": "install-test+lead@example.com",
"PHONE_NUMBER": "+1 (555) 010-2030"
}
Confirm one new row in the sheet with the lead ID, the timestamp, the name and contact fields, Jordan and Rivera in the name columns, and person in the name-type column with a short note. If run-status tools aren't available, check the result in Google Sheets directly. The user deletes the test row, not the agent.
Notes
- The AI step only reads the name. It doesn't see the email or phone, so the name-type flag is a guess from the name alone. Review the flag on a few rows before relying on it.
- Each lead adds a row, so a lead that is submitted twice adds two rows. Add a lookup step before the row write if duplicates matter.
- Google Sheets may show the timestamp in the sheet's own format and time zone.
- Never commit a real spreadsheet ID.
- To notify the team of each lead, add a Slack or email step after the row write.