Facebook + Notion: reply to comments with Gemini
Facebook comments come in fast, and the “we’ll reply later” plan quietly turns into missed buyers, rushed answers, and the occasional awkward correction.
If you run paid social as a marketing manager, you feel this on launch days. A store owner feels it at night when the DMs slow down but comments keep rolling. Even a small agency juggling multiple client pages gets dragged into the same loop. This Facebook comment replies automation answers quickly, stays consistent, and stops duplicates.
This workflow watches your latest Facebook post, checks if a comment is new, pulls the right product facts from Notion, and uses Gemini to post an on-brand reply in Egyptian Arabic. You’ll see how it works, what you need, and what to tweak so it fits your page.
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: Facebook + Notion: reply to comments with Gemini
flowchart LR
subgraph sg0["Schedule Flow"]
direction LR
n0@{ icon: "mdi:robot", form: "rounded", label: "AI Agent", pos: "b", h: 48 }
n1@{ icon: "mdi:brain", form: "rounded", label: "AI Chat Model", pos: "b", h: 48 }
n2@{ icon: "mdi:play-circle", form: "rounded", label: "Schedule Trigger", pos: "b", h: 48 }
n3["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/merge.svg' width='40' height='40' /></div><br/>Merge"]
n4["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/notion.dark.svg' width='40' height='40' /></div><br/>Knowledge Base"]
n5["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Last Post Fetcher"]
n6["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/notion.dark.svg' width='40' height='40' /></div><br/>CommentID Checker"]
n7["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>KB Arrange"]
n8@{ icon: "mdi:swap-horizontal", form: "rounded", label: "New Comment Conditioner", pos: "b", h: 48 }
n9["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/facebook.svg' width='40' height='40' /></div><br/>Latest Comment"]
n10["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/facebook.svg' width='40' height='40' /></div><br/>Reply Writer"]
n11["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/notion.dark.svg' width='40' height='40' /></div><br/>CommentID to DB"]
n12["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Posts Fetcher"]
n3 --> n7
n0 --> n10
n7 --> n8
n10 --> n11
n1 -.-> n0
n12 --> n5
n4 --> n3
n9 --> n0
n2 --> n12
n6 --> n3
n5 --> n6
n5 --> n4
n8 --> n9
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n2 trigger
class n0 ai
class n1 aiModel
class n8 decision
class n4,n6,n11 database
class n5,n9,n10,n12 api
class n7 code
classDef customIcon fill:none,stroke:none
class n3,n4,n5,n6,n7,n9,n10,n11,n12 customIcon
The Problem: Facebook comments slip through (and replies drift off-brand)
Replying to Facebook comments sounds simple until you’re doing it all day. You’re switching tabs, hunting for product details, trying to sound friendly, and hoping you don’t contradict yesterday’s answer. Then you miss a comment for two hours and the thread turns into “Is anyone there?” which is honestly the worst look on a promo post. Add a team member replying from memory and you get inconsistent pricing, unclear delivery times, and replies that don’t match your brand voice. It’s not one big failure. It’s a hundred tiny ones.
The friction compounds. Here’s where it breaks down.
- Checking new comments manually every hour steals about 1–2 hours a day once campaigns heat up.
- Product info gets paraphrased, which leads to wrong details and extra back-and-forth in the thread.
- Two people reply to the same comment, and now you look disorganized in public.
- There’s no clean log, so you can’t audit what was answered, when, and by whom.
The Solution: Auto-reply with Gemini using Notion as the source of truth
This n8n workflow runs on a schedule and monitors your latest Facebook page post for fresh comments. When it finds one, it checks a Notion log to confirm you have not already replied to that comment ID. If it’s new, the workflow pulls your product facts from a Notion knowledge base, structures that information into something the AI can actually use, then asks a Gemini-powered agent to write a friendly reply in Egyptian Arabic that stays inside your approved facts. Finally, it posts the reply back to the same Facebook thread and logs the comment ID in Notion so it won’t answer twice. Set it up once, and it quietly keeps your threads active.
The workflow starts with a timed trigger, then grabs page posts and the most recent comments via API calls. Next, it merges the “what was asked” with “what we know” from Notion. Gemini generates the response, and n8n posts it and stores a record so duplicates don’t happen.
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say your promo post gets about 40 comments a day. Manually, even a quick “real” answer takes maybe 3 minutes when you include checking product details, typing, and not messing up the tone, which is about 2 hours daily. With this workflow, you spend about 10 minutes keeping your Notion knowledge base updated and skimming the log, while replies get posted automatically as new comments appear. That’s roughly 1–2 hours back most days, plus fewer “oops” moments in public threads.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Facebook Page access to read and reply to comments.
- Notion for the knowledge base and comment log.
- Google Gemini API key (get it from Google AI Studio).
Skill level: Intermediate. You’ll connect credentials, paste API tokens, and map a few fields between Facebook, Notion, and the AI prompt.
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
Timed monitoring kicks things off. n8n runs on a schedule trigger, then pulls your page posts and fetches recent comments for the latest post.
Duplicate protection happens early. The workflow validates each comment ID against a Notion database that acts like a “processed comments” ledger, so a comment only gets one automated reply.
Notion becomes the brain. A Notion knowledge store is retrieved and merged with the incoming comment, then the workflow structures those facts so the AI agent can reference the right fields instead of guessing.
Gemini writes, Facebook publishes, Notion logs. The AI agent produces an Egyptian Arabic response, n8n posts it via the Facebook Graph API node, and then the comment ID is stored back in Notion as a final “done” record.
You can easily modify the reply tone and escalation rules to fit your page. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Timed Automation Trigger
Set the schedule that kicks off the workflow and fetches Facebook page posts on a recurring basis.
- Add the Timed Automation Trigger node as your workflow trigger.
- Set the interval rule to run every
10seconds using the seconds interval. - Connect Timed Automation Trigger to Retrieve Page Posts.
Step 2: Connect Facebook and Notion data sources
Pull recent posts and comments from Facebook and load your knowledge base and processed comment logs from Notion.
- In Retrieve Page Posts, set URL to
=https://graph.facebook.com/v21.0/[FACEBOOK_PAGE_ID]/posts?access_token=[FACEBOOK_ACCESS_TOKEN]. - Credential Required: Connect your facebookGraphApi credentials (already configured in Retrieve Page Posts).
- In Recent Post Comments, set URL to
=https://graph.facebook.com/v21.0/{{$json["data"][0].id}}/comments?access_token=[FACEBOOK_ACCESS_TOKEN]and keep Authentication aspredefinedCredentialTypewith Node Credential Type set tofacebookGraphApi. - Credential Required: Connect your facebookGraphApi credentials in Recent Post Comments (this node needs credentials but none are configured).
- In Notion Knowledge Store, set Resource to
databasePage, Operation togetAll, and Return All totrue. Select the database ID[KNOWLEDGE_BASE_DATABASE_ID]. - In Comment ID Validator, set the manual filter to compare Comment ID|rich_text equals
={{ $('Recent Post Comments').first().json.data .sort((a, b) => new Date(b.created_time) - new Date(a.created_time))[0].id }}and choose[PROCESSED_COMMENTS_DATABASE_ID]. - Credential Required: Connect your Notion credentials in Notion Knowledge Store, Comment ID Validator, and Log Comment ID (these nodes need credentials but none are configured).
Recent Post Comments outputs to both Comment ID Validator and Notion Knowledge Store in parallel.
Step 3: Set Up the knowledge merge and new comment gate
Combine the comment validation results with the knowledge base, then structure the knowledge for the AI to reference.
- Connect Comment ID Validator to Combine Streams (index 0) and Notion Knowledge Store to Combine Streams (index 1).
- Connect Combine Streams to Knowledge Structurer.
- In Knowledge Structurer, keep the JavaScript as provided to build
knowledgeContext,knowledgeBase, andcompactKnowledgefrom Notion records. - Connect Knowledge Structurer to New Comment Gate.
- In New Comment Gate, ensure the condition checks leftValue
={{ $json.property_comment_id }}with operatorexistsso only new comments proceed.
property_products, property_prices, or property_description, update the code in Knowledge Structurer to match your actual Notion properties.Step 4: Set Up the AI response generation
Fetch the latest comment content, then use Gemini to compose a humanized reply with knowledge context.
- Connect the true output of New Comment Gate to Fetch Latest Comment.
- In Fetch Latest Comment, set Edge to
comments, Node to={{ $('Recent Post Comments').first().json.data .sort((a, b) => new Date(b.created_time) - new Date(a.created_time))[0].id }}, and Graph API Version tov23.0. - Credential Required: Connect your facebookGraphApi credentials in Fetch Latest Comment (this node needs credentials but none are configured).
- Connect Fetch Latest Comment to Response Composer.
- In Response Composer, keep the prompt text and ensure it references
{{ $('Knowledge Structurer').item.json.knowledgeContext }}and the latest comment message from{{ $('Recent Post Comments').first().json.data .sort((a, b) => new Date(b.created_time) - new Date(a.created_time))[0].message || "" }}. - Open Gemini Chat Engine and set Model Name to
[AI_MODEL_NAME]with Temperature0.2. - Credential Required: Connect your Google Gemini credentials in Gemini Chat Engine. This node powers Response Composer, so add credentials to the parent LLM node, not the agent node.
Step 5: Configure reply posting and logging
Post the AI-generated reply back to Facebook and log the processed comment in Notion to avoid duplicates.
- In Post Reply Action, set Edge to
comments, Node to={{ $('Recent Post Comments').first().json.data .sort((a, b) => new Date(b.created_time) - new Date(a.created_time))[0].id }}, and HTTP Request Method toPOST. - Add a query parameter with Name
messageand Value={{ $('Response Composer').first().json.output }}. - Credential Required: Connect your facebookGraphApi credentials in Post Reply Action (this node needs credentials but none are configured).
- Connect Post Reply Action to Log Comment ID.
- In Log Comment ID, set Comment ID|rich_text to
={{ $('Recent Post Comments').first().json.data .sort((a, b) => new Date(b.created_time) - new Date(a.created_time))[0].id }}and Response Status|status toDone.
Step 6: Test and Activate Your Workflow
Validate the full cycle from retrieval to reply before turning it on.
- Click Execute Workflow to run Timed Automation Trigger manually and watch the execution path.
- Confirm that Recent Post Comments fetches comment data and that New Comment Gate routes only new items.
- Verify Response Composer generates output and Post Reply Action posts a response on Facebook.
- Check that Log Comment ID writes a new record in your Notion database with status
Done. - When everything looks correct, toggle the workflow Active to enable automatic execution.
Common Gotchas
- Facebook Graph API credentials can expire or lack the right permissions. If replies stop posting, check your access token and confirm you have pages_read_engagement and pages_manage_posts.
- If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Notion database properties change more often than people admit. If the duplicate check suddenly “can’t find” IDs, verify the Comment ID field name and type match what the workflow expects.
Frequently Asked Questions
About 45 minutes if your Facebook, Notion, and Gemini access is ready.
No. You will connect accounts, paste an API key, and map a few fields in n8n.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in Google Gemini API usage costs, which are usually small unless you’re replying at very high volume.
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Yes, but you’ll want to adjust the instructions inside the AI agent prompt used to generate the customer reply. In this workflow, that’s handled in the response generation stage (the Gemini chat/agent nodes). Common customizations include switching language, adding a short disclaimer for medical topics, and changing when the workflow escalates a comment to a human instead of replying.
Usually it’s an expired access token or missing permissions on the Facebook app/page connection. Regenerate the token, then confirm pages_read_engagement and pages_manage_posts are granted and still approved for the page. If it works for a bit and then fails again, you may be hitting rate limits during high-volume periods, so reduce how often you poll for comments or process comments in smaller batches.
A lot—practically, it depends on your n8n plan and how often you run the trigger.
Often, yes, because this workflow needs a few things that get clunky elsewhere: merging data from Notion, doing a real duplicate-ID check, and controlling how the AI uses approved facts. n8n is also easier to extend when you want branching logic, like “angry comment goes to a human” or “pricing question uses a different prompt.” Zapier or Make can still work if you only need a simple two-step responder, but you’ll usually end up with more tasks and more edge cases. Also, self-hosting n8n removes execution limits, which matters when posts go viral. If you want help deciding, Talk to an automation expert.
Once this is running, your comment section stops being a constant interruption and starts acting like a quiet sales assistant. The workflow handles the repetitive stuff, and you keep control of the facts and the voice.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.