Automate Instagram Content Creation with n8n & AI [Full Workflow 2026]

Generate and schedule Instagram posts automatically using n8n and AI. Covers caption writing, hashtag generation, image creation, and auto-posting.
if
telegram
splitInBatches
+9
Workflow Identifier: 1262
NODES in Use: If, Telegram, SplitInBatches, ScheduleTrigger, Set, HttpRequest, Code, Merge, Postgres, FacebookGraphApi, OpenAI, StickyNote
Automate Instagram posts with n8n and OpenAI

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

Learn how to Build this Workflow with AI:

What This Workflow Does ⚙️

This workflow runs twice a day to find popular Instagram posts under hashtags like #blender3d and #isometric.
It picks images only, not videos, and skips repeated content using a database check.
Then AI explains what the image shows and writes a catchy caption.
It also makes a similar but new image in a 3D toy style using AI.
Finally, it posts the new image and caption to an Instagram Business Account automatically.

The workflow sends messages by Telegram for status or errors.


Tools and Services Used

  • n8n: Automates the workflow with scheduling and API calls.
  • Instagram Business Account: Receives the final posts via Facebook Graph API.
  • Telegram Bot API: Sends progress and error updates.
  • OpenAI GPT-4 Vision API: Analyzes images and generates captions.
  • Replicate API with Flux AI: Creates new AI images based on prompts.
  • RapidAPI Instagram Scraper: Gets trending Instagram posts by hashtag.
  • PostgreSQL Database: Stores posts info to prevent duplicates.

How the Workflow Works (Input → Process → Output)

Input:

  • Scheduled trigger at 1:05 PM and 7:05 PM Istanbul Time.
  • Hashtags to search: #blender3d and #isometric.
  • API keys and IDs for Instagram, Telegram, OpenAI, Replicate, RapidAPI, and PostgreSQL.

Processing Steps:

  • Scrape top posts on Instagram by each hashtag.
  • Filter out videos, keep only image posts.
  • Merge results from both hashtags into one list.
  • Loop through each post to check if it exists in the PostgreSQL database.
  • Add new posts to the database if not found, marking them as unposted.
  • Analyze each new image with OpenAI GPT-4 Vision to describe it.
  • Generate Instagram caption using OpenAI with relevant hashtags.
  • Use Replicate API (Flux AI) to make a unique 3D isometric style image based on the description.
  • Upload the AI-generated image and caption to Instagram Business Account as unpublished media.
  • Check upload status until it shows as “FINISHED”.
  • Publish the media on Instagram when ready.
  • Send Telegram notifications for progress, success, or errors.

Output:

  • New, unique Instagram posts with AI-generated images and captions.
  • Real-time Telegram updates about posting status.

Who Should Use This Workflow

This workflow is good for digital artists, content creators, and social media managers.
If you spend hours each week hunting for trendy Instagram content and want to save time, this helps.
It works well if you have an Instagram Business Account and want fresh, eye-catching posts without repeating old ones.

It also suits users familiar with connecting APIs and databases but prefer an easy way to post automatically.


Beginner Step-by-Step: How to Activate This Workflow in n8n

Step 1: Import the Workflow

  1. Download the workflow file from this page.
  2. Open your n8n editor.
  3. Use the Import from File feature to upload the workflow.

Step 2: Add Your Credentials

  1. Locate Instagram params node and enter your Instagram Business Account ID.
  2. Fill Telegram Params with your Telegram Bot API chat ID.
  3. Update Rapid Api params with your RapidAPI key for Instagram Scraper.
  4. Add your OpenAI API key in the relevant nodes for image analysis and captioning.
  5. Put your Replicate API token in the Replicate params node.
  6. Check your PostgreSQL database connection and table setup (table named top_trends).

Step 3: Customize IDs or Details if Needed

  1. Change hashtags queried in the get top trends on instagram #blender3d and get top trends on instagram #isometric nodes if desired.
  2. Check any other IDs or tokens in Set nodes and update.

Step 4: Test the Workflow

  1. Run the workflow once manually inside n8n.
  2. Verify if steps pass without errors.
  3. Check Telegram for any status messages.

Step 5: Turn the Workflow On

  1. Activate the workflow by toggling it to “active” in the editor.
  2. It will now run automatically at scheduled times.

If using self-host n8n, see self-host n8n to optimize server performance.


Customization Ideas

  • Change hashtags in the two Instagram Scraper nodes to suit a different niche.
  • Edit the prompt in Analyze Content And Generate Instagram Caption node to adjust caption tone or tags.
  • Modify the JSON body of Generate image on flux to try different image styles or resolutions.
  • Adjust scheduled times in Schedule Trigger if a different posting window works better.
  • Add extra columns to PostgreSQL table top_trends for tracking likes or original post link.

Common Problems and Solutions

  • Instagram Scraper API no data: Key expired or quota used up. Renew RapidAPI subscription.
  • OpenAI failures: Wrong API key or usage limits hit. Check OpenAI account and key status.
  • Instagram post not finishing upload: Permissions or network issues. Check Facebook Graph API access and retry.
  • Telegram messages missing: Bot not started by messaging or wrong chat ID. Send /start and verify chat ID.

Pre-Production Checklist ✅

  • Confirm Instagram Business Account ID and Facebook Graph API keys are valid.
  • Verify Telegram Bot is active, sent /start and chat ID correct.
  • Check RapidAPI Instagram Scraper subscription and keys.
  • Test OpenAI and Replicate API keys with sample requests.
  • Ensure PostgreSQL table top_trends exists with proper schema.
  • Run the workflow manually to confirm no errors before scheduling.

Summary

→ Finds trending Instagram images twice a day under chosen hashtags.
→ Checks database to avoid reposting duplicate content.
→ Uses AI to analyze images and write good captions.
→ Creates new AI-generated 3D style images for posts.
→ Automatically uploads and publishes to Instagram Business Account.
→ Sends Telegram messages to keep updated about progress.
→ Saves over 8 hours weekly by removing manual searching and posting.


Automate Instagram posts with n8n and OpenAI

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

Yes. Replace the HTTP Request node named Generate image on flux with another API call. Adjust the request body as needed for the new service.
Lower how often the workflow runs or reduce the number of posts scraped per run. Monitor API usage on dashboards regularly.
Check Facebook Graph API permissions and ensure the Instagram Business Account is properly linked. Retry uploading media if network issues occur.
Make sure the Telegram Bot was started by sending a message. Verify the chat ID matches the one used in the Telegram Params node.

Promoted by BULDRR AI

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.