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
Automate Instagram comments with n8n and AI

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

Learn how to Build this Workflow with AI:

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.


Automate Instagram comments with n8n and AI

Visit through Desktop to Interact with the Workflow.

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.
Author
Written By
Vikash Kumar
Building AI agents, n8n workflows and end-to-end automation for 30+ Brands across India, the US, Europe, Dubai & Australia. 7+ years of Experience saving founders real hours every week - no code required.

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.