Respond to customer inquiries on Facebook Messenger, generate replies with ChatGPT, and send messages from your page
Each new customer message to your Facebook page gets a personalized ChatGPT reply, sent back in Messenger.
Install it
Set up this Zap for me, read how here: https://zapier.sh/zapier/awesome-zaps/respond-to-facebook-messenger-messages-with-chatgpt/
Paste into Claude, ChatGPT, Cursor or any agent.
- Apps it uses
ChatGPT- Author
- Zapier
- Source
- zapier/awesome-zaps, folder zaps/respond-to-facebook-messenger-messages-with-chatgpt
Set it up with the CLI
- Add it. Copies the folder into
zaps/respond-to-facebook-messenger-messages-with-chatgpt/. Outside a project, it makes one first.npx zap-pack add awesome-zaps/respond-to-facebook-messenger-messages-with-chatgpt - 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 respond-to-facebook-messenger-messages-with-chatgpt - Check it. Its recent runs, with status and errors.
npx zap-pack logs respond-to-facebook-messenger-messages-with-chatgpt
zaps/respond-to-facebook-messenger-messages-with-chatgpt/
- 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 2 to fill in
- connections/chatgpt.tsThe
chatgptaccount it uses - connections/facebook-messenger.tsThe
facebook-messengeraccount it uses - triggers/message.tsWhat starts it:
facebook-messengermessage1 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 new message is sent to the Facebook page (
facebook-messenger,message). - ChatGPT writes a reply to the message, using the instructions in
config.tsand the business name the user gives. - Facebook Messenger sends that reply back to the customer from the page.
Messages with no text, such as stickers or photos alone, and the page's own messages are skipped.
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 |
|---|---|---|
BUSINESS_NAME |
config.ts |
The name replies are written as, such as the business or page name. Ask the user for it. |
PAGE_ID |
config.ts and triggers/message.ts (page) |
The Facebook page's ID. Look it up from the page list on the user's Facebook Messenger connection; the same value fills both files. |
Also review the defaults with them:
DEFAULT_MODEL: the model that writes the replies. Defaults togpt-4o.SYSTEM_INSTRUCTIONS: the tone and limits of the replies. Check they match how the business wants to sound.POLL_INTERVAL_SECONDSandMAX_POLLSinconfig.ts: how long the Zap waits for ChatGPT, by default 30 seconds between checks and 20 checks.
Build it
If you can run shell commands, set it up with zap-pack: run npx zap-pack add awesome-zaps/respond-to-facebook-messenger-messages-with-chatgpt, replace each REPLACE_… value as this file says, then run npx zap-pack deploy respond-to-facebook-messenger-messages-with-chatgpt, 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-messengerto the user's Facebook Messenger connection for the page that receives customer messages, andchatgptto the user's ChatGPT (OpenAI) connection. - Source: publish
workflow.tsandconfig.ts, with eachREPLACE_…replaced by the user's answer.triggers/message.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: sample the Messenger trigger and inspect the
send_messageaction and the ChatGPTconversation_responses_apiaction with the user's connections before the first test run. Fix any key inworkflow.tsthat doesn't match: the trigger's text and sender fields (text,sender__id,sender__name) and the send action's recipient and text inputs (recipient,text).
Test it
Run this sample as a draft test (run_workflow_draft in Zapier MCP), with the Messenger send pointed at a test conversation the user owns, not a real customer:
{
"text": "Hi, what are your opening hours on Saturday?",
"sender__id": "1234567890",
"sender__name": "Test Customer"
}
Confirm that the test conversation receives one reply that answers the question and matches the tone in SYSTEM_INSTRUCTIONS. If run-status tools aren't available, check the reply in the Messenger conversation directly. The user deletes the test messages, not the agent.
Notes
- Once the Zap is published and its trigger is active, every new message to the page gets a reply. Start with a page that has a few conversations, and check the first replies before leaving it on.
- The Zap never answers its own replies. The trigger's only setting is
page, so it has no incoming-only option, and its output fields could not be confirmed.workflow.tstherefore skips, before calling ChatGPT, any message whosesender__idequalsPAGE_IDor whoseis_echois true. When you sample the trigger, check which of these fields it really delivers (a page ID field or an echo flag under another name) and fix the guard to match; if the page's own sends never arrive, the guard is harmless. - Replies can take up to about 10 minutes to arrive, since the Zap waits for ChatGPT between checks.
- ChatGPT writes replies without knowing the business's details. Put facts such as hours, prices or policies into
SYSTEM_INSTRUCTIONSbefore going live. - Never commit a real page ID, a real customer's name or message, or a real ChatGPT key.