Block 1 - Filter
- Type / Role
- n8n-nodes-base.filter - filter
- Config choices
- Version 2.3
Never miss a lead from your Instagram ads again. This workflow automatically monitors every comment on your Instagram ad posts in real time, classifies the comment using AI, and takes the right act...
n8n-nodes-base.filter, n8n-nodes-base.webhook, n8n-nodes-base.if, n8n-nodes-base.set, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.outputparserstructured, @n8n/n8n-nodes-langchain.lmchatopenrouter, n8n-nodes-base.httprequest
This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Salman Mehboob.
Original n8n.io sourceNever miss a lead from your Instagram ads again. This workflow automatically monitors every comment on your Instagram ad posts in real time, classifies the comment using AI, and takes the right action instantly — whether that is replying with accurate information from your knowledge base, thanking a happy customer, or alerting your team about a negative review that needs human attention.
Built for agencies, service businesses, and ecommerce brands running Instagram ad campaigns who are losing potential clients because comments go unanswered for hours — or worse, never get a reply at all.
When you run Instagram ads, your comment section becomes your most active sales channel. Potential customers ask about pricing, timelines, and services directly in the comments. Happy customers leave reviews. Unhappy ones post complaints. Competitors spam your section with their own links.
Managing all of this manually is impossible at scale:
This workflow solves every one of these problems automatically.
Step 1 — Real-Time Instagram Webhook Trigger
The workflow fires the instant someone comments on your Instagram ad post. No polling. No delays. The comment is received within seconds via the Meta Graph API webhook, giving you a response time advantage that manual management can never match.
Step 2 — Smart Filter
Before any processing happens, the workflow checks three things:
This ensures only relevant, genuine comments from real users trigger the workflow.
Step 3 — Fetch Full Comment Details
The workflow calls the Instagram Graph API to retrieve the full comment data including the commenter username, exact comment text, and comment ID needed for replying.
Step 4 — Fetch Ad Post Content
The workflow fetches the caption and details of the ad post the comment was left on. This is critical context for the AI — it needs to understand what is being advertised before it can classify or answer the comment accurately.
Step 5 — Clean and Normalize Data
All extracted data is normalized into clean variables: post text, post permalink, comment text, comment ID, and commenter username. This makes all downstream nodes simple and reliable.
Step 6 — AI Comment Classifier
An AI agent powered by OpenRouter (GPT-4o) reads both the post caption and the comment together and classifies the comment into one of four categories:
The classifier also returns a confidence level: HIGH, MEDIUM, or LOW. This structured output is enforced via a JSON output parser ensuring 100% reliable downstream routing.
Step 7 — Switch Node Routes to the Right Branch
Based on the classification the workflow splits into four paths:
QUERY Branch: The AI reply agent searches your Google Docs knowledge base for the answer. If found it writes a clear, helpful, human-sounding public reply that answers the question and ends with a soft call to action. If the answer is not in the knowledge base it redirects the user to your DM or WhatsApp without making up information. The reply is posted directly to Instagram via the Graph API.
POSITIVE_REVIEW Branch: The AI reply agent writes a warm, genuine thank-you reply without consulting the knowledge base. It keeps it short, sounds human, and subtly encourages others to try the service. The reply is posted directly to Instagram via the Graph API.
NEGATIVE_REVIEW Branch: No auto reply is posted. Instead a detailed Slack alert is sent immediately to your team with the commenter username, the full comment text, and a prompt to handle it manually. Negative comments require human judgment and empathy — this workflow keeps humans in control of the most sensitive interactions.
SPAM Branch: No action taken. The comment is ignored completely. No reply, no alert, no wasted API calls.
Most Instagram comment automation tools either reply to everything with the same canned message, or require expensive third-party subscriptions like ManyChat or Spur. This workflow does something none of them do:
Built with Meta Graph API v25.0 and OpenRouter. Tested on Instagram Business accounts connected via Facebook Business Portfolio System Users.
This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.
| Workflow | Reply to Instagram ad comments with GPT-4o, Google Docs, and Slack |
|---|---|
| Complexity | advanced |
| Nodes | 20 |
| Categories | Social Media, AI RAG |
| Author | Salman Mehboob |
| Published | 08 Apr 2026 |
Use the JSON export at /data/workflows/14893/14893.json as the source template for this automation.
Open n8n, import the downloaded JSON, and review each node before activating the workflow.
Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.
Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.
Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.
Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.
Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.
Never miss a lead from your Instagram ads again. This workflow automatically monitors every comment on your Instagram ad posts in real time, classifies the comment using AI, and takes the right act...
Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.
Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Social Media, AI RAG use case.