πŸ“± Automate Instagram comment replies with OpenAI and Redis tracking

⚑ 787 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

This workflow automatically replies to new comments on your Instagram posts using smart AI.
It checks your recent posts, finds unread comments, and skips spam or duplicates.
The AI reads the post and comments to create a friendly, natural reply with emojis.
It posts the reply instantly and logs everything so you can track engagement.
Perfect for busy creators β€” stays active 24/7 without you lifting a finger!

What It Monitors

Features

Workflow Steps

Node NameDescription
Schedule TriggerTriggers workflow based on traffic level (2–10 min intervals).
Get Recent PostsFetches recent posts using Instagram Graph API. Returns post IDs needed to fetch comments.
Split PostsSplits batch of posts into individual items for parallel processing.
Get CommentsFor each post, retrieves comments with content, username, timestamp, like count.
Split CommentsSplits comments into individual items for granular processing.
Add Post ContextCombines comment + original post caption to generate relevant replies.
Check if RepliedChecks if AI has already replied to this comment (prevents duplicate replies).
Not Replied Yet?Routes only unreplied comments forward.
Spam FilterFilters out spam using:
β€’ Spam keywords
β€’ Empty/one-word comments
β€’ Excessive emojis
β€’ Known spam patterns
Should Reply?Final logic gate:
β€’ If reply key exists β†’ Skip
β€’ If spam β†’ Skip
β€’ Else β†’ Proceed
Generate AI ReplyUses OpenAI (or compatible LLM):
β€’ Input: Post caption + comment
β€’ Tone: Friendly & engaging
β€’ Max tokens: 150
β€’ Temperature: 0.8 (creative)
Post ReplyPosts AI-generated reply via Instagram API:
β€’ Method: POST
β€’ Body: message parameter
β€’ TTL: 30 days
Mark As RepliedUpdates internal tracking to prevent duplicate replies.
Log ReplyLogs full reply details:
β€’ Post ID
β€’ Comment ID
β€’ Username
β€’ Reply text
β€’ Timestamp
β€’ Used for analytics & reporting

How to Use

  1. Copy the JSON configuration of the workflow.
  2. Import it into your n8n workspace.
  3. Configure Instagram Graph API credentials (Business/Creator Account required).
  4. Set up OpenAI API key in the Generate AI Reply node.
  5. Activate the workflow.
  6. Monitor replies in Instagram and execution logs in n8n.

> The bot will only reply once per comment, skip spam, and use full post context for natural responses.


Requirements


Customizing this Workflow

Explore More AI Workflows: https://www.oneclickitsolution.com/contact-us/

πŸ”— Nodes Used

HTTP Request, Redis, Schedule Trigger, OpenAI

πŸ“₯ Import

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

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