AutomationFlowsSocial Media › Auto-moderate Instagram Comments with Perspective API & Slack Alerts

Auto-moderate Instagram Comments with Perspective API & Slack Alerts

ByOneclick AI Squad @oneclick-ai on n8n.io

Automatically detects and hides hate speech/toxic comments, alerts your team, and logs flagged content for review. Trigger: A Schedule node runs every 15 minutes to poll for new comments (Instagram doesn't natively push notifications easily, so polling is used). You could…

Cron / scheduled trigger★★★★☆ complexity15 nodesHTTP RequestSlackGoogle Sheets
Social Media Trigger: Cron / scheduled Nodes: 15 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #10319 — we link there as the canonical source.

This workflow follows the Google Sheets → HTTP Request recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "m2mL2bEzyCxMyMUm",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Instagram Toxic Comment Moderation & Auto-Defense Workflow",
  "tags": [],
  "nodes": [
    {
      "id": "042e2d57-9f5b-4990-9f8c-96c571f4afb9",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.cron",
      "position": [
        -544,
        240
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "fbcd13d4-752b-47bf-9486-83c6d4d0ba36",
      "name": "Get Comments",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -96,
        336
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v12.0/{{$node[\"Get Instagram Posts\"].json[\"data\"][0][\"id\"]}}/comments?access_token=YOUR_INSTAGRAM_ACCESS_TOKEN",
        "options": {},
        "authentication": "headerAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4f906e36-0ce8-4fdf-a1e3-f6eafdec200a",
      "name": "Detect Toxicity",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        352,
        336
      ],
      "parameters": {
        "url": "https://api.moderatehate.com/v1/toxicity",
        "options": {},
        "requestMethod": "POST",
        "jsonParameters": true,
        "bodyParametersJson": "={\"comment\": {\"text\": \"{{$json[\"text\"]}}\"}, \"requestedAttributes\": {\"TOXICITY\": {}}, \"clientToken\": \"YOUR_PERSPECTIVE_API_KEY\"}"
      },
      "typeVersion": 1
    },
    {
      "id": "7ee26cdf-d244-4e29-b501-fd938ad9ccc7",
      "name": "IF Toxic",
      "type": "n8n-nodes-base.if",
      "position": [
        576,
        336
      ],
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{$json[\"attributeScores\"][\"TOXICITY\"][\"summaryScore\"][\"value\"]}}",
              "value2": 0.7,
              "operation": "larger"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2dec3548-e9b4-4706-98c3-2b6a09c08812",
      "name": "Hide Comment",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        800,
        48
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v12.0/{{$json[\"id\"]}}?access_token=YOUR_INSTAGRAM_ACCESS_TOKEN",
        "options": {},
        "requestMethod": "POST",
        "jsonParameters": true,
        "bodyParametersJson": "={\"hide\": true}"
      },
      "typeVersion": 1
    },
    {
      "id": "bfc8fd2d-d547-4bd4-acea-c5e5df672ab4",
      "name": "Alert Team (Slack)",
      "type": "n8n-nodes-base.slack",
      "position": [
        800,
        240
      ],
      "parameters": {
        "text": "=Toxic Comment Detected!\nText: {{$json[\"text\"]}}\nUser: {{$json[\"username\"]}}\nToxicity Score: {{$node[\"Detect Toxicity\"].json[\"attributeScores\"][\"TOXICITY\"][\"summaryScore\"][\"value\"]}}\nPost ID: {{$node[\"Get Instagram Posts\"].json[\"data\"][0][\"id\"]}}",
        "channel": "your-slack-channel",
        "attachments": [],
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "90946996-b976-40a5-a80d-f869b79b30c3",
      "name": "Store Evidence (Google Sheet)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        800,
        432
      ],
      "parameters": {
        "range": "A:Z",
        "options": {},
        "sheetId": {
          "__rl": true,
          "mode": "list",
          "value": "your-google-sheet-id",
          "cachedResultName": "Your Evidence Sheet"
        },
        "operation": "append"
      },
      "credentials": {
        "googleApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b31bf33e-5be7-41da-be9b-89cac55e33dd",
      "name": "End (Non-Toxic Path)",
      "type": "n8n-nodes-base.set",
      "position": [
        800,
        624
      ],
      "parameters": {
        "options": {},
        "keepOnlySet": true
      },
      "typeVersion": 1
    },
    {
      "id": "2452c3a8-68ef-4e46-b2c3-04b10e76c2e9",
      "name": "Get Instagram Posts",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -320,
        336
      ],
      "parameters": {
        "url": "https://graph.facebook.com/v12.0/YOUR_INSTAGRAM_BUSINESS_ACCOUNT_ID/media?access_token=YOUR_TOKEN_HERE",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "c07fa30c-3c9b-46b6-9cd7-bd186ad641bd",
      "name": "Loop Over Comments",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        128,
        336
      ],
      "parameters": {
        "options": {},
        "batchSize": 1
      },
      "typeVersion": 1
    },
    {
      "id": "d0b8d990-b005-4827-8033-54c5649db2ec",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -544,
        432
      ],
      "parameters": {
        "path": "8a81934f-bd1e-400e-9eb4-bb540db73b2b",
        "options": {}
      },
      "typeVersion": 2.1
    },
    {
      "id": "c9200031-8fa3-4c6e-9684-1ea457cd3cfa",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        32
      ],
      "parameters": {
        "width": 432,
        "height": 528,
        "content": "A Schedule node runs every 15 minutes to poll for new comments (Instagram doesn't natively push notifications easily, so polling is used). You could replace this with a Webhook if you set up Instagram webhooks via Graph API."
      },
      "typeVersion": 1
    },
    {
      "id": "8f5a8cfd-09ac-4d23-a1c1-7f1246f1becb",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -144,
        32
      ],
      "parameters": {
        "color": 5,
        "width": 416,
        "height": 528,
        "content": "Uses Instagram Graph API (via HTTP Request) to fetch recent posts and their comments. Assumes you have an Instagram Business Account and a valid access token (from Facebook Developer Portal)."
      },
      "typeVersion": 1
    },
    {
      "id": "57d6f1fe-6179-4425-b661-aec2c1dc735d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        32
      ],
      "parameters": {
        "width": 416,
        "height": 528,
        "content": "For each comment, it sends the text to Google's Perspective API (a free toxicity detection API; sign up at https://perspectiveapi.com/ for an API key). Threshold for \"toxic\" is set to >0.7 toxicity score (configurable)."
      },
      "typeVersion": 1
    },
    {
      "id": "e2b718f0-28ea-4bf1-a5d5-26e84be318c9",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        -224
      ],
      "parameters": {
        "color": 5,
        "height": 992,
        "content": "**Auto-Hide Offensive Ones**: If toxic, uses Instagram API to hide the comment.\n\n**Alert Team**: Sends a Slack notification (or email; configurable) with details.\n\n**Store Evidence**: Appends the toxic comment details (text, user, score, timestamp) to a Google Sheet for auditing."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a867b0b0-5297-42da-aa5c-f2dca4f413f9",
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Get Instagram Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF Toxic": {
      "main": [
        [
          {
            "node": "Hide Comment",
            "type": "main",
            "index": 0
          },
          {
            "node": "Alert Team (Slack)",
            "type": "main",
            "index": 0
          },
          {
            "node": "Store Evidence (Google Sheet)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "End (Non-Toxic Path)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Comments": {
      "main": [
        [
          {
            "node": "Loop Over Comments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Detect Toxicity": {
      "main": [
        [
          {
            "node": "IF Toxic",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get Instagram Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Comments": {
      "main": [
        [
          {
            "node": "Detect Toxicity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Instagram Posts": {
      "main": [
        [
          {
            "node": "Get Comments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Automatically detects and hides hate speech/toxic comments, alerts your team, and logs flagged content for review. Trigger: A Schedule node runs every 15 minutes to poll for new comments (Instagram doesn't natively push notifications easily, so polling is used). You could…

Source: https://n8n.io/workflows/10319/ — original creator credit. Request a take-down →

More Social Media workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Social Media

This n8n workflow automatically monitors positive reactions on Facebook Page posts, stores them in Airtable and notifies your team in Slack to create a motivational “Wall of Love.” It runs on a schedu

HTTP Request, Airtable, Slack
Social Media

Automatically analyze your Instagram posts’ engagement and audience sentiment using GPT-4 to uncover top-performing content and improvement opportunities. 💬📈 This workflow fetches your latest Instagra

Facebook Graph Api, Agent, Memory Buffer Window +5
Social Media

This template is ideal for sales teams, recruiters, business development professionals, and relationship managers who need to monitor changes in their network's LinkedIn profiles. Perfect for agencies

Google Sheets, HTTP Request, Slack
Social Media

This enterprise-grade n8n workflow automates the Instagram complaint handling process — from detection to resolution — using Claude AI, dynamic ticket assignment, and SLA enforcement. It converts cust

HTTP Request, Google Sheets, Slack
Social Media

This n8n workflow is an automated Instagram DM responder that checks messages and replies with affiliate links based on keywords.

HTTP Request, Read Write File