πŸ“± Reply to Instagram ad comments with GPT-4o, Google Docs, and Slack

⚑ 162 views Β· πŸ“± Social Media & Email Marketing

πŸ’‘ Pro Tip β€” Heads up β€” if this workflow’s Instagram scraping breaks (it happens whenever Meta updates their frontend), ScraperNode is a community node that handles profiles, posts, reels, and comments without any HTML parsing.

View All Scrapers

Description

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 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.


The Problem This Solves

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.


How It Works

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.


What Makes This Workflow Unique

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:


Requirements


Setup Steps

  1. Create your Meta Developer App and configure Instagram webhooks pointing to your n8n webhook URL
  2. Subscribe your Instagram Business Account to the app using the Facebook Page subscribed_apps endpoint
  3. Generate a System User token in Meta Business Portfolio with the required permissions
  4. Create your knowledge base as a Google Doc with your services, prices, FAQs and contact information
  5. Add your OpenRouter API key to n8n credentials
  6. Connect your Google Docs OAuth2 account and update the document ID in the Knowledge Base tool node
  7. Connect your Slack account and update the channel or user ID in the Inform User node
  8. Update the filter condition with your Instagram username to prevent reply loops
  9. Activate the workflow and test by commenting on one of your Instagram ad posts

Customization Options


Use Cases


Nodes Used


Built with Meta Graph API v25.0 and OpenRouter. Tested on Instagram Business accounts connected via Facebook Business Portfolio System Users.

πŸ“© Support & Contact

πŸ”— Nodes Used

HTTP Request, Slack, Webhook, Filter, AI Agent, Structured Output Parser

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup