Instagram Comment Auto-Moderation with Perspective API and Slack Alerts - n8n Workflow

Use this comprehensive n8n workflow to automate social media moderation. Instantly detect toxic Instagram comments using the Perspective API, hide them, and notify your team via Slack and Google Sheets.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

This n8n templates automation is perfect for:

Social media managers needing 24/7 moderation.
Brands with high traffic on Instagram posts.
Community managers seeking to maintain a positive online environment.
Users looking for practical n8n workflow examples integrating external AI services.

Overview

Maintaining a healthy and positive online community on Instagram can be challenging, especially when managing high volumes of comments. Manual moderation is slow and resource-intensive. This powerful n8n workflow solves this problem by providing automated, real-time defense against toxic behavior.

Utilizing a scheduled n8n trigger, the workflow polls for new comments, sends the text to the Perspective API for toxicity scoring, and immediately takes action if the score exceeds a threshold (set at 0.7). The automation automatically hides the comment, logs the evidence in a Google Sheet for auditing, and sends a critical alert via Slack. This specific n8n node combination ensures rapid response and transparent reporting.

How it Works

This n8n automation is designed for periodic polling, running every 15 minutes using the initial n8n trigger to check for new activity:


  1. Polling Initiation: The Schedule Trigger starts the n8n workflow execution.

  2. Fetch Posts: The workflow first uses an HTTP Request n8n node to query the Instagram Graph API for recent media (posts) from a specified Instagram Business Account ID.

  3. Fetch Comments: A subsequent HTTP Request n8n node fetches all current comments associated with the most recent post ID.

  4. Batch Processing: The Loop Over Comments n8n node processes each comment individually to prevent rate limiting and ensure granular analysis.

  5. Toxicity Detection: The comment text is sent via an HTTP Request n8n node to the Perspective API (using a wrapper service) to calculate a toxicity score.

  6. Conditional Check: The IF Toxic n8n node evaluates if the returned toxicity score is greater than 0.7.

  7. Toxic Path (True): If toxic, the workflow executes three parallel actions:

Hide Comment (HTTP Request n8n node): Immediately hides the comment via the Instagram API.
Alert Team (Slack): Sends a detailed notification to a designated Slack channel.
* Store Evidence (Google Sheet): Logs the comment text, user, and toxicity score for future review.

  1. Non-Toxic Path (False): If the score is low, the workflow ends gracefully for that specific comment item.

Installation Guide

To set up this powerful n8n workflow template, follow these steps:


  1. Import the n8n Workflow: Copy the provided JSON and import it directly into your n8n instance.

  2. Instagram API Setup: You must obtain a long-lived Instagram Access Token and your Instagram Business Account ID from the Facebook Developer Portal. Replace the placeholder values in the Get Instagram Posts and Hide Comment n8n nodes.

  3. Perspective API Setup: Sign up for the Perspective API (if you don't already have a key). Update the Detect Toxicity n8n node's JSON body with your actual CLIENT_TOKEN (API Key).

  4. Slack Credentials: Create a Slack API credential in n8n and select it in the Alert Team (Slack) n8n node. Update the channel name.

  5. Google Sheets Setup: Create a Google Sheets credential in n8n. In the Store Evidence (Google Sheet) n8n node, link your Sheet ID and ensure the required columns are ready for data appending.

  6. Activate: Ensure the Schedule Trigger n8n trigger is correctly configured for your desired frequency (default is every 15 minutes) and activate the n8n workflow.

Node Details

Schedule Trigger (n8n trigger): Initiates the polling process automatically every 15 minutes, allowing this n8n workflow to run autonomously.
Get Instagram Posts (HTTP Request n8n node): Fetches recent media posts using the Instagram Graph API. Key Configuration: Requires YOURINSTAGRAMBUSINESSACCOUNTID.
Get Comments (HTTP Request n8n node): Retrieves comments for the post identified in the previous step. Key Configuration: Uses dynamic data linking to get the post ID.
Loop Over Comments (Split In Batches n8n node): Ensures that each comment is processed sequentially by the toxicity detector, which is crucial for maintaining flow control in this n8n workflow.
Detect Toxicity (HTTP Request n8n node): Sends comment data to the Perspective API for toxicity analysis. Key Configuration: Uses a POST request with the comment text embedded in the JSON body, requiring the user's Perspective API key.
IF Toxic (If n8n node): The core decision maker of this n8n node setup. It routes the flow based on a toxicity score threshold (>0.7).
Hide Comment (HTTP Request n8n node): Executes the moderation action by posting a 'hide: true' payload back to the Instagram API.
Alert Team (Slack n8n node): Sends a detailed, formatted alert containing the comment text and score to the team Slack channel.


  • Store Evidence (Google Sheets n8n node): Appends the toxic comment details to a designated Google Sheet for audit logging and reporting.

Related n8n Workflows

Free

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

The AI Squad Initiative is a pioneering effort to build, automate and scale AI-powered workflows using n8n.io. Our mission is to help individuals and businesses integrate AI agents seamlessly into their daily operations from automating tasks and enhancing productivity to creating innovative, intelligent solutions. We design modular, reusable AI workflow templates that empower creators, developers and teams to supercharge their automation with minimal effort and maximum impact.

Featured*