Generate Instagram Content from Top Trends with AI Image Generation n8n Workflow Template

n8n workflow template · 27 nodes · Telegram

Generate Instagram Content from Top Trends with AI Image Generation is a free n8n workflow template that runs on a schedule and works with Telegram, Postgres, OpenAI and Facebook Graph API. It has 27 nodes, 2 of them AI nodes (OpenAI). To run it, you add your own credentials for Facebook Graph API, OpenAI API, Postgres and Telegram Bot API.

At a glance

Trigger
Schedule Trigger (Schedule Trigger1)
Nodes
27
Apps
Telegram, Postgres, OpenAI and Facebook Graph API
AI nodes
2
Credentials
4 types
Category
Content, SEO and social media

Apps and integrations

  • Telegram
  • Postgres
  • OpenAI
  • Facebook Graph API

Node types used

  • If
  • Telegram
  • Loop Over Items
  • Schedule Trigger
  • Edit Fields (Set)
  • Code
  • HTTP Request
  • Merge
  • Postgres
  • OpenAI
  • Facebook Graph API

How it works

The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.

Schedule Your Time To Post

Guide

Guide of getting of Replicate Token

Guide

Guide of getting of Instagram Business Account Id

Guide

Guide of Getting of Telegram Chat Id

Warning

Don't forgot the create bot and send a message to bot first

Warning

Dont forgot the subscribe Instagram Scraper Api

Warning

You can check the rate limit of the Instagram Scraper Api on Rapid Api Free version is monthly 500 request

Getting Top Trend Posts On Instagram

Change the topic you want to get on http request

For More About Api

Facebook Scraper Api Guide

For top_trends Table

Looping Data And Checking For Is Exist On Database

We are checking until find a data we did not insert because we don't want to create content about in same content

Warning

Don't forgot the create top_trends table

Analyze Post Content

We are analyzing the image We are generating a instagram caption by content Then we are generating the image

Publish On Instagram And Send Message When Published via Telegram

Setup notes

The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.

Automated Instagram Content Creation from Trending Posts

This workflow automates the process of discovering and recreating trending content on Instagram

  1. Content Discovery
  • Scrapes top trending posts from specific hashtags (#blender3d, #isometric)
  • Filters for image-only content (excludes videos)
  • Checks database to avoid duplicate content
  1. AI-Powered Content Generation
  • Analyzes trending images using GPT-4 Vision
  • Generates detailed descriptions of visual elements
  • Creates engaging Instagram captions with relevant hashtags
  • Uses Flux AI to generate similar but unique images
  1. Publishing & Monitoring
  • Automatically posts content to Instagram Business Account
  • Monitors post status and publishing process
  • Sends status updates via Telegram

Perfect for content creators and businesses looking to maintain an active Instagram presence with AI-generated content inspired by current trends. The workflow runs on schedule and handles everything from content discovery to publication automatically.

Note: Requires Instagram Business Account, Telegram Bot, OpenAI, and Replicate API credentials.

All Credentials You Need

Instagram Business Account Id Telegram Chat Id Rapid Api Key Replicate Token

Guide

Guide of Getting of Rapid Api Key

Nodes in this workflow

The 27 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:

  1. If media status is finished (If)
  2. If media status is finished1 (If)
  3. Telegram (Telegram)
  4. Telegram1 (Telegram)
  5. Telegram2 (Telegram)
  6. Loop Over Items (Loop Over Items)
  7. Schedule Trigger1 (Schedule Trigger)
  8. Telegram Params (Edit Fields (Set))
  9. Instagram params (Edit Fields (Set))
  10. Rapid Api params (Edit Fields (Set))
  11. filter the image content (Code)
  12. get top trends on instagram #blender3d (HTTP Request)
  13. get top trends on instagram #isometric (HTTP Request)
  14. merge the array content (Merge)
  15. Check Data on Database Is Exist (Postgres)
  16. If Data is Exist (If)
  17. send error message to telegram (Telegram)
  18. insert data on db (Postgres)
  19. Analyze Image and give the content (OpenAI)
  20. Analyze Content And Generate Instagram Caption (OpenAI)
  21. Prepare data on Instagram (Facebook Graph API)
  22. Check Status Of Media Before Uploaded (Facebook Graph API)
  23. Publish Media on Instagram (Facebook Graph API)
  24. Check status of post (Facebook Graph API)
  25. filter the image content-2 (Code)
  26. Replicate params (Edit Fields (Set))
  27. Generate image on flux (HTTP Request)

Credentials you need

  • Facebook Graph API – used by Check Status Of Media Before Uploaded, Check status of post, Prepare data on Instagram and Publish Media on Instagram
  • OpenAI API – used by Analyze Content And Generate Instagram Caption and Analyze Image and give the content
  • Postgres – used by Check Data on Database Is Exist and insert data on db
  • Telegram Bot API – used by Telegram, Telegram1, Telegram2 and send error message to telegram

Configure your own credentials after importing. Create each credential in n8n, then select it in the node.

How to import into n8n

  1. Download the JSON file with the button above.
  2. In n8n, open a new workflow, select the ... menu and choose Import from File. You can also paste the JSON straight into the editor canvas.
  3. Open each node that shows a warning and select or create its credential.
  4. Read the notes on the canvas, test the workflow with sample data, then activate it.

Do you need somewhere to run it? Read our guide to self-hosted n8n.

Need this customised?

We can adapt this workflow to your apps, data and process, then deploy and support it.

Contact Us