AI-Powered Instagram Content Generator from Top Trends
Integrates with:
Overview
Unlock Automated & Trending Instagram Content with this AI Agent
Tired of the content treadmill? This AI Agent is your automated partner for keeping your Instagram feed vibrant and engaging. It intelligently scours Instagram for top-performing posts based on hashtags you define (like #blender3d or #isometric), then springs into action.
Using advanced AI, it analyzes the visual essence of trending images with OpenAI's GPT-4o-mini. Next, it crafts compelling, SEO-friendly Instagram captions, complete with relevant hashtags, also using GPT-4o-mini. The real magic happens when it leverages Replicate (specifically the Flux Schnell model) to generate a brand new, unique image inspired by the trend but distinctively yours.
Finally, this agent seamlessly posts the AI-generated image and caption to your Instagram Business Account, all on a schedule you set. It even checks your PostgreSQL database to ensure no duplicate content ideas are re-processed and keeps you updated via Telegram on its progress or any hiccups.
Key Features & Benefits
- Automated Trend Discovery: Fetches top posts for specified Instagram hashtags via RapidAPI, ensuring your content is always relevant.
- AI-Powered Image Analysis: Leverages OpenAI (GPT-4o-mini Vision) to understand the core elements and style of trending images.
- Intelligent Caption Generation: OpenAI (GPT-4o-mini) crafts engaging and relevant Instagram captions, complete with appropriate hashtags.
- Unique AI Image Creation: Uses Replicate (Flux Schnell model) to generate novel images based on the analyzed trend, giving you original content.
- Scheduled & Automated Posting: Directly posts to your Instagram Business Account via the Facebook Graph API at your preferred times.
- Duplicate Prevention: Integrates with PostgreSQL to track processed trends and avoid redundant content.
- Real-time Notifications: Get instant updates on successes or errors directly to your Telegram.
- Fully Customizable: Easily modify target hashtags, AI prompts for image/caption generation, and posting schedules to fit your brand's voice and strategy.
- Error Handling: Built-in checks and notifications for robust, unattended operation.
Use Cases
- Automatically populate your Instagram feed with fresh, AI-generated content based on current trends.
- Maintain an active Instagram presence without the daily grind of manual content creation.
- Experiment with diverse AI-generated art styles and content themes for your brand.
- Save significant time on content research, image creation, caption writing, and scheduling, ideal for solopreneurs and small marketing teams.
Prerequisites
- An n8n instance (Cloud or self-hosted).
- OpenAI API Key with access to GPT-4o-mini (or a comparable vision/text model).
- Replicate API Token.
- RapidAPI Key and a subscription to the 'Instagram Scraper API2' (or a similar Instagram scraping service configured in the HTTP Request nodes).
- Facebook Developer App with necessary permissions (e.g.,
instagram_basic
,instagram_content_publish
,pages_show_list
,pages_read_engagement
) and an Instagram Business Account ID linked to a Facebook Page. - PostgreSQL database credentials. You'll need to create a table named
top_trends
using a schema like the one provided in the workflow's 'Sticky Note12' (typically includes fields likeid
,prompt
,code
,tag
,isposted
,thumbnail_url
). - Telegram Bot Token and the Chat ID for receiving notifications.
Setup Instructions
- Download the n8n workflow JSON file.
- Import the workflow into your n8n instance.
- Configure Credentials:
- Open the 'OpenAI' nodes ('Analyze Image and give the content', 'Analyze Content And Generate Instagram Caption') and select/create your OpenAI credentials.
- Ensure the 'Generate image on flux' (HTTP Request) node's
Authorization
header uses your Replicate token (configured via the 'Replicate params' Set node output). - Ensure the 'get top trends on instagram' HTTP Request nodes'
x-rapidapi-key
header uses your RapidAPI key (configured via the 'Rapid Api params' Set node output). - Open the Facebook Graph API nodes ('Prepare data on Instagram', 'Check Status Of Media Before Uploaded', 'Publish Media on Instagram', 'Check status of post ') and select/create your Facebook Graph API credentials.
- Open the PostgreSQL nodes ('Check Data on Database Is Exist', 'insert data on db') and select/create your PostgreSQL credentials.
- Open the Telegram nodes and select/create your Telegram API credentials.
- Set Workflow Parameters (in the correspondingly named Set nodes at the beginning of the workflow):
- 'Replicate params': input your
replicate_token
. - 'Instagram params': input your
instagram_business_account_id
. - 'Telegram Params': input your
telegram_chat_id
. - 'Rapid Api params': input your
x-rapid-api-key
.
- 'Replicate params': input your
- Database Setup: Connect to your PostgreSQL database and create the
top_trends
table if it doesn't exist. A sampleCREATE TABLE
statement is often found in a Sticky Note within the workflow (e.g., 'Sticky Note12'). - Customize Hashtags & API Endpoints:
- Modify the URLs and parameters in the 'get top trends on instagram #blender3d' and 'get top trends on instagram #isometric' HTTP Request nodes if you want to change hashtags or use a different Instagram scraping API.
- Review and Tune AI Prompts:
- Adjust the prompt in the 'Analyze Image and give the content' OpenAI node to guide image description.
- Refine the prompt in the 'Analyze Content And Generate Instagram Caption' OpenAI node for desired caption style.
- Modify the JSON body in the 'Generate image on flux' HTTP Request node, especially the
prompt
field, to control the Replicate image generation.
- Set Schedule: Configure the 'Schedule Trigger1' node to your desired posting frequency (e.g., '5 13,19 * * *' for 1:05 PM and 7:05 PM daily, adjust timezone in workflow settings).
- Activate the workflow and monitor the first few runs via Telegram notifications.
Want your own unique AI agent?
Talk to us - we know how to build custom AI agents for your specific needs.
Schedule a Consultation