AI-Driven Facebook Comment Moderation and Auto-Reply System - n8n Workflow

Automate Facebook comment management using this powerful n8n workflow. Classify sentiment, generate AI replies, delete spam, and ban toxic users, all integrated with Google Sheets.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Social Media Managers needing automated moderation.
Businesses handling high volumes of Facebook comments.
Users looking for advanced n8n templates integrating AI agents and web services.
Developers wanting to see a complex, production-ready n8n node chain involving Facebook Graph API and Google Sheets.

Overview

Managing high volumes of comments on a Facebook page can be overwhelming. This advanced n8n workflow provides a comprehensive, automated solution. The system periodically checks recent posts, retrieves all new comments, and utilizes large language models (LLMs) via an n8n node to classify comment intent (e.g., positive feedback, support request, spam, or toxic content).

Based on this AI classification, the n8n workflow automatically takes action:


  1. Auto-Reply: Uses specialized AI agents (Positive Replay, Support Replay) to craft appropriate, human-like responses and posts them via the Facebook Graph API n8n node.

  2. Moderation: Deletes harmful comments and logs the incident in Google Sheets.

  3. User Ban: If a user accumulates a defined number of strikes (tracked in Google Sheets), the n8n workflow automatically bans them from the page, providing robust protection against repeat offenders. This efficient n8n automation ensures rapid engagement and maintains a positive community environment without constant manual supervision.

How it Works

This comprehensive n8n workflow is triggered manually and follows a multi-stage process:


  1. Data Ingestion (n8n trigger): The process starts with the Start manual n8n trigger. It fetches recent posts using the Get 0-100 Post from Page n8n node (Facebook Graph API).

  2. Iteration and Retrieval: The workflow loops through each post (Loop Over Posts) and retrieves all associated comments using the Get Individual Post Comments n8n node.

  3. Filtering Existing Replies: The flow iterates through comments (Loop Over Comments). An HTTP Request n8n node (Get Any Replay in Comment) checks if an admin has already responded. If a reply exists, the comment is ignored.

  4. AI Classification: Comments without admin replies proceed to the Message a model Langchain n8n node, which classifies the comment's intent (e.g., 'Positive', 'Support', 'Delete').

  5. Decision Routing: A Switch n8n node routes the flow based on the classification result:

Positive/Support Paths: If a reply is needed, dedicated AI Agent n8n nodes (Positive Replay, Support Replay) generate customized, multilingual responses utilizing LLMs (Gemini/OpenAI) and context tools. The Reply to Comment n8n node posts the reply.
Moderation Path: If classified as harmful, the Delete Comment n8n node removes it via an HTTP request.

  1. Logging and Banning: Deleted comments are logged to Google Sheets (Append row in sheet). Subsequent nodes check the user's history in the sheet (Get row in sheet). If a toxicity threshold is met, the user is banned using the Banned user Facebook Graph API n8n node, and their status is updated in Google Sheets (Update row in sheet).

  2. Completion: The flow loops back to process the next batch of posts and comments, utilizing the power of this n8n automation.

Installation Guide

To deploy this powerful n8n workflow, follow these steps:


  1. Import: Copy the provided JSON data and paste it directly into your n8n instance using the 'New' -> 'Import from JSON' function.

  2. Facebook Credentials: You will need to set up a Facebook Graph API credential. This credential must have appropriate permissions (e.g., pagesmanageposts, pagesreaduser_content) to read posts, fetch comments, reply, delete, and ban users. Update the credentials in all Facebook Graph API n8n node instances.

  3. AI Credentials: Configure the required Langchain credentials for the AI nodes (Message a model, Positive Replay, Support Replay). This typically involves setting up API keys for OpenAI and/or Google Gemini in your n8n environment.

  4. Google Sheets Setup: Create a Google Sheets credential and link it to the spreadsheet where comment toxicity data will be logged and tracked. Update the Spreadsheet ID and Sheet Name in the Append row in sheet, Get row in sheet, and Update row in sheet n8n node parameters.

  5. Custom Code Review: Review the Code in JavaScript n8n node and the Separatamente Without Admin Reply n8n node to ensure any logic or variable names match your specific data structure or toxicity thresholds.

  6. Activation: Once credentials are set, activate the n8n workflow and execute the Start n8n trigger to begin processing comments.

Node Details

Start (Manual Trigger): The initial n8n trigger, used to start the data retrieval process for the Facebook comments.
Get 0-100 Post from Page (Facebook Graph API): This n8n node fetches the initial set of posts from the configured Facebook Page.
Loop Over Posts / Loop Over Comments (Split In Batches): Essential n8n nodes for handling data arrays, allowing the workflow to process each individual post and comment sequentially.
Get Any Replay in Comment (HTTP Request): Performs a request to determine if a specific comment already has a reply from an admin account.
Message a model (Langchain OpenAI): The core classification n8n node. It sends the comment text to an LLM (OpenAI) to classify the required action (Reply, Support, Delete).
Switch (Core Logic Flow Control): Routes the flow based on the classification output provided by the previous n8n node.
Positive Replay / Support Replay (Langchain Agent): Advanced AI agent n8n nodes used to generate contextually relevant, human-like replies. They utilize tools like Gemini and OpenAI as their language models.
Reply to Comment (Facebook Graph API): Posts the AI-generated response back to the comment thread on Facebook.
Delete Comment (HTTP Request): Executes the API call to remove the offensive comment.
Append row in sheet / Get row in sheet / Update row in sheet (Google Sheets): These n8n nodes manage the toxicity tracking database, logging incidents and checking user history.


  • Banned user (Facebook Graph API): Executes the final moderation action, banning the user from the page based on the logic in the preceding If n8n node.

Related n8n Workflows

Paid

Nodes: 21 Nodes
Updated: December 26 2025
View all
Created by

SpaGreen Creative is a leading software company specializing in SaaS solutions, AI automation, and Laravel/Vue.js development. With 800+ eCommerce platforms and 8,000+ global clients, we deliver powerful tools for OTT, CRM, ERP, and WhatsApp marketing. We combine innovation and tech to build scalable digital products.

Featured*