Automate Instagram AI Comment Replies with n8n

Discover how to automate intelligent responses to Instagram comments using n8n and AI. This workflow handles verification, filters comments, and replies contextually, saving hours of manual moderation.
Webhook
AI Agent
HTTP Request
+4
Workflow Identifier: 2150
NODES in Use: Webhook, Respond to Webhook, Set, Filter, HTTP Request, AI Agent, OpenRouter Chat Model

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

What this workflow does

This workflow listens for new Instagram comments on posts about AI and automation.
It blocks comments made by the account owner.
Then, it uses AI to read each comment and make a smart reply in Brazilian Portuguese.
Finally, it posts that reply back to the Instagram comment.
This saves time and keeps engagement fast and relevant.

The workflow helps users avoid long manual answers and bad or slow responses.
The main goal is to keep the Instagram page active without work overload.


Input → Processing → Output

Inputs

  • Instagram webhook: Sends comment updates including comment text, user info, and post ID.
  • User IDs: To check if comment is from account owner.
  • OpenRouter API key: For AI text generation.
  • Instagram Graph API credentials: To get post data and send replies.

Processing Steps

  • Verify webhook: Answer Instagram GET challenges to confirm ownership of webhook URL.
  • Read comment data: Extract comment ID, text, user info, post ID from webhook.
  • Filter out owner comments: Skip comments if commenter is the Instagram account itself.
  • Get post context: Call Instagram API for the post caption or content to provide AI more information.
  • Generate AI reply: Send comment and post info to Gemini 2.0 AI model via OpenRouter API with a prompt that decides if comment is question, praise, critic, or irrelevant.
  • Post reply: Send AI-generated text as a reply comment on Instagram via the Graph API.

Output

A new comment reply on Instagram, made by AI, matching the comment’s tone and content.
Non-owner comments get thoughtful answers quickly.


Tools and services used

  • n8n Workflow Automation: To build the automation and connect services.
  • Instagram Graph API: To receive comment webhook data and post replies.
  • OpenRouter API with Gemini 2.0 model: To analyze comment and generate reply in Brazilian Portuguese.
  • HTTP Requests with header authentication: To communicate securely with Instagram API.

Beginner step-by-step: How to use this workflow in n8n production

Step 1: Download and import the workflow

  1. Click the Download button on this workflow page to get the workflow file.
  2. Open the n8n editor where you want to run this automation.
  3. Use the menu option Import from File and select the downloaded workflow file.

Step 2: Configure credentials and settings

  1. Add the Instagram Graph API credentials with permission to read comments and post replies.
  2. Fill in the OpenRouter API key for the Gemini 2.0 language model.
  3. Enter your Instagram account ID and verify tokens in the filter and webhook nodes to match your page.
  4. If there are any URLs, IDs, or prompts in the workflow inputs, double-check they reflect your account or intentions.

Step 3: Test the workflow

  1. Trigger a test comment on your Instagram post or simulate webhook data to watch the workflow run.
  2. Check the execution logs to confirm each step works properly and a reply comment is sent back.

Step 4: Activate the workflow

  1. After successful tests, toggle the workflow to active mode in n8n.
  2. Make sure your webhook URL is publicly accessible so Instagram can send live comment events.
  3. Keep API keys updated to prevent failures from expired tokens.

If using self hosting n8n for more control, see self-host n8n for setup options.


Customization ideas

  • Change AI reply language or style by editing the prompt in the AI Agent node.
  • Extend filters to ignore comments with certain words or spam patterns inside the Filter node.
  • Add emoji reaction calls before replying based on sentiment analysis.
  • Use other AI models supported by OpenRouter or integrate multiple AI endpoints.
  • Duplicate workflow to manage multiple Instagram accounts by passing different IDs and credentials dynamically.

Common errors and fixes

  • No webhook events: Usually means webhook URL is not public or verify token mismatch. Check URL accessibility and tokens in Instagram App and Respond to Webhook node.
  • No AI replies or bad replies: Check OpenRouter API key and ensure prompt instructions are clear in AI Agent node.
  • Replies not posting: Validate HTTP Request node settings. Check Instagram Graph API endpoints, token validity, and JSON body formatting.

Result summary

✓ Save hours by automating Instagram comment replies.
✓ Reply fast with AI-generated, context-aware answers.
✓ Keep audience engaged without manual work.
✓ Avoid replying to own comments and spam.
→ Increase Instagram interaction and follower trust.


Frequently Asked Questions

Yes, users can switch the AI node to models like OpenAI GPT or local LangChain models by adjusting prompts and API keys accordingly.
Yes, both Instagram Graph API calls and OpenRouter API requests consume service quotas depending on usage volume.
User data is transmitted via authenticated API calls within the secured n8n environment; keep credentials private and n8n updated.
It can handle moderate volumes well, but large accounts may require scaling n8n instances and rate limiting to avoid API limits.

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free