AI Agent for Instagram Trend Content Generation & Publishing
Integrates with:
Overview
Unlock Automated & Engaging Instagram Content with this AI Agent
This n8n workflow acts as an AI Agent designed to keep your Instagram presence vibrant and up-to-date with minimal effort. It starts by scraping top trending posts for specified hashtags (e.g., #blender3d, #isometric) via RapidAPI. The Agent then uses OpenAI's GPT-4o-mini to analyze the visual content of these trending images and generate compelling, Instagram-ready captions. Leveraging Replicate's Flux AI model, it creates entirely new, unique images inspired by the analyzed trends and descriptions. Before posting, it checks a PostgreSQL database to avoid duplicate content. Finally, it seamlessly publishes the AI-generated image and caption to your Instagram Business account and notifies you via Telegram about the post status or any issues.
This AI Agent's abilities include:
- Trend Discovery: Scans Instagram for top posts based on your chosen hashtags.
- AI Image Analysis: Understands key visual elements of trending images using OpenAI.
- AI Caption Generation: Crafts engaging Instagram captions with relevant hashtags using OpenAI.
- AI Image Generation: Produces novel images based on trend analysis using Replicate (Flux AI).
- Automated Publishing: Posts content directly to your Instagram Business account.
- Status Monitoring & Notification: Keeps you updated via Telegram.
Key Features & Benefits
- Stay Relevant: Automatically taps into current Instagram trends to create timely content.
- AI-Powered Creativity: Leverages advanced AI for image analysis, caption writing, and unique image generation, ensuring fresh and original posts.
- Consistent Posting Schedule: Runs on a customizable schedule (default: twice daily) for consistent audience engagement.
- Time-Saving Automation: Drastically reduces manual effort in content creation, from ideation to publishing.
- Duplicate Prevention: Smartly checks against previously posted content to maintain originality.
- Extensible & Customizable: Easily modify hashtags, AI prompts, and posting schedules to fit your brand's voice and strategy.
- Error Handling & Notifications: Provides Telegram alerts for successful posts and any operational issues.
Use Cases
- B2C E-commerce: Automatically generate and post eye-catching, trend-aligned product showcases or lifestyle images to boost online store visibility and customer engagement.
- B2B SaaS: Create a consistent stream of visually interesting and informative posts based on industry trends or software features, enhancing brand presence and thought leadership on Instagram.
- Solopreneurs & Content Creators: Maintain an active and dynamic Instagram feed with AI-generated content inspired by niche trends, freeing up valuable time for core business activities.
- Digital Marketing Agencies: Efficiently scale Instagram content production for multiple clients by automating the generation and scheduling of trend-driven posts.
Prerequisites
- An n8n instance (Cloud or self-hosted).
- OpenAI API Key with access to a model like gpt-4o-mini (for image analysis and text generation).
- Replicate API Token (for Flux AI image generation via
black-forest-labs/flux-schnell
model). - Instagram Business Account ID.
- Facebook Developer App with Graph API access configured for your Instagram Business Account.
- RapidAPI Key with a subscription to an Instagram Scraper API (e.g.,
instagram-scraper-api2
). - Telegram Bot Token and your Telegram Chat ID for notifications.
- PostgreSQL database credentials and a table named
top_trends
created with the following schema:CREATE TABLE top_trends ( id SERIAL PRIMARY KEY, isposted BOOLEAN DEFAULT false, createdat TIMESTAMP WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP, updatedat TIMESTAMP WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP, deletedat TIMESTAMP WITHOUT TIME ZONE, prompt TEXT NOT NULL, thumbnail_url TEXT, code TEXT, tag TEXT );
Setup Instructions
- Download the n8n workflow JSON file.
- Import the workflow into your n8n instance.
- Configure Credentials & Parameters:
- Replicate params (Set node): Enter your
replicate_token
. - Instagram params (Set node): Enter your
instagram_business_account_id
. - Telegram Params (Set node): Enter your
telegram_chat_id
. - Rapid Api params (Set node): Enter your
x-rapid-api-key
. - OpenAI Node ('Analyze Image and give the content'): Select or add your OpenAI credential. Ensure the model (e.g.,
gpt-4o-mini
) is selected. - OpenAI Node ('Analyze Content And Generate Instagram Caption'): Select or add your OpenAI credential.
- Facebook Graph API Nodes ('Prepare data on Instagram', etc.): Select or add your Facebook Graph API credential.
- Telegram Nodes: Select or add your Telegram API credential.
- PostgreSQL Nodes ('Check Data on Database Is Exist', 'insert data on db'): Select or add your PostgreSQL credential.
- Replicate params (Set node): Enter your
- Verify the
top_trends
table exists in your PostgreSQL database with the correct schema (see Prerequisites). - In the 'get top trends on instagram' HTTP Request nodes, customize the
hashtag
query parameter if you want to track different trends (default: 'blender3d', 'isometric'). Update thex-rapidapi-host
if using a different RapidAPI Instagram scraper. - Review and optionally customize the prompts in the 'Analyze Image and give the content', 'Analyze Content And Generate Instagram Caption' (OpenAI nodes), and 'Generate image on flux' (Replicate HTTP Request node) to tailor the AI's output style.
- Adjust the cron expression in the 'Schedule Trigger1' node to set your desired posting frequency.
- Activate the workflow.
Want your own unique AI agent?
Talk to us - we know how to build custom AI agents for your specific needs.
Schedule a Consultation