← All N8N workflows
AI & researchCodeFacebook Graph ApiHTTP RequestIfMerge

Generate Instagram Content from Top Trends with AI Image Generation

Configured with Facebook Graph Api, HTTP Request, Open Ai, Postgres, and additional nodes. Review the connections and setup before adapting this template.

Workflow preview
RoutingIf media status isfinishedIfRoutingIf media status isfinished1IfMessagingTelegramTelegramMessagingTelegram1TelegramMessagingTelegram2TelegramRoutingLoop Over ItemsLoop Over ItemsTriggerSchedule Trigger1Schedule TriggerTransformTelegram ParamsEdit FieldsTransformInstagram paramsEdit FieldsTransformRapid Api paramsEdit FieldsCodefilter the imagecontentCodeWeb / APIget top trends oninstagram #blender3dHTTP RequestWeb / APIget top trends oninstagram #isometricHTTP RequestTransformmerge the array contentMergeData storeCheck Data on DatabaseIs ExistPostgresRoutingIf Data is ExistIfMessagingsend error message totelegramTelegramData storeinsert data on dbPostgresAI & modelsAnalyze Image and givethe contentOpen AiAI & modelsAnalyze Content AndGenerate Instagram…Open AiIntegrationPrepare data onInstagramFacebook Graph ApiIntegrationCheck Status Of MediaBefore UploadedFacebook Graph ApiIntegrationPublish Media onInstagramFacebook Graph ApiIntegrationCheck status of post Facebook Graph ApiCodefilter the imagecontent-2CodeTransformReplicate paramsEdit FieldsWeb / APIGenerate image on fluxHTTP Request

Node categories in this workflow

  • Routing
  • Messaging
  • Trigger
  • Transform
  • Code
  • Web / API
  • Data store
  • AI & models
  • Integration

Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.

Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.

How it works

The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.

Workflow node names, types, and operations
NodeCategoryTypeOperation
If media status is finishedRoutingIfSee node parameters
If media status is finished1RoutingIfSee node parameters
TelegramMessagingTelegramSee node parameters
Telegram1MessagingTelegramSee node parameters
Telegram2MessagingTelegramSee node parameters
Loop Over ItemsRoutingLoop Over ItemsSee node parameters
Schedule Trigger1TriggerSchedule TriggerSee node parameters
Telegram ParamsTransformEdit FieldsSee node parameters
Instagram paramsTransformEdit FieldsSee node parameters
Rapid Api paramsTransformEdit FieldsSee node parameters
filter the image contentCodeCodeSee node parameters
get top trends on instagram #blender3dWeb / APIHTTP RequestSee node parameters
get top trends on instagram #isometricWeb / APIHTTP RequestSee node parameters
merge the array contentTransformMergeSee node parameters
Check Data on Database Is ExistData storePostgresselect
If Data is ExistRoutingIfSee node parameters
send error message to telegramMessagingTelegramSee node parameters
insert data on dbData storePostgresSee node parameters
Analyze Image and give the contentAI & modelsOpen Aiimage / analyze
Analyze Content And Generate Instagram CaptionAI & modelsOpen AiSee node parameters
Prepare data on InstagramIntegrationFacebook Graph ApiSee node parameters
Check Status Of Media Before UploadedIntegrationFacebook Graph ApiSee node parameters
Publish Media on InstagramIntegrationFacebook Graph ApiSee node parameters
Check status of post IntegrationFacebook Graph ApiSee node parameters
filter the image content-2CodeCodeSee node parameters
Replicate paramsTransformEdit FieldsSee node parameters
Generate image on fluxWeb / APIHTTP RequestPOST

Setup

  1. Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
  2. Connect your own credentials through n8n’s credential store. Replace REPLACE_WITH_* values with your resource identifiers.
  3. Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
  4. Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.

Requirements

An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.

Credential types declared in the source

  • facebookGraphApi
  • openAiApi
  • postgres
  • telegramApi

Workflow notes

All Credentials You Need

All Credentials You Need

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

Rapid Api params

test

Guide

Guide

** Guide of getting of Instagram Business Account Id

Guide

Guide

** Guide of Getting of Telegram Chat Id

Guide

Guide

** Guide of Getting of Rapid Api Key

Warning

Warning

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

Getting Top Trend Posts On Instagram

Getting Top Trend Posts On Instagram

** Change the topic you want to get on http request

Looping Data And Checking For Is Exist On Database

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

Analyze Post Content

Analyze Post Content

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

For More About Api

For More About Api

** Facebook Scraper Api Guide

Guide

Guide

** Guide of getting of Replicate Token

For top_trends Table

For top_trends Table

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
);
Warning

Warning

** Don't forgot the create top_trends table

Automated Instagram Content Creation from Trending Posts

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
  2. 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
  3. 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.

Sticky Note15

##Warning ** Dont forgot the subscribe Instagram Scraper Api

Warning

Warning

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

Generate Instagram Content from Top Trends with AI Image Generation

Generate Instagram Content from Top Trends with AI Image Generation

Purpose and structure

This folder contains the Generate Instagram Content from Top Trends with AI Image Generation workflow. Its executable nodes use code, facebookGraphApi, httpRequest, if, merge, openAi, postgres, scheduleTrigger, set, splitInBatches, telegram. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.

Setup

Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.

Entry points

Schedule Trigger1

Verification

Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.

Attribution

https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Telegram/1482_Telegram_Code_Create_Webhook.json MIT; preserve source notices.

Canvas section labels

These name areas of the original canvas; they do not include explanatory instructions.

  • Schedule Your Time To Post
  • Publish On Instagram And Send Message When Published via Telegram

More in AI & research