ChatGPTCreativeWritingAI score · PendingAI-assisted edit · no obvious prompt-injection riskn8n.io

Auto-Generate Instagram Content from Top Trends with AI Images

Input: trending Instagram hashtag posts; Process: scrape → deduplicate → GPT analyze → Flux generate → publish; Output: scheduled Instagram posts with Telegram notifications

Some experienceStepsWorkflowPromptTip
Who
Content creators or small teams with n8n experience who need to maintain an active Instagram presence
You get
Automatically discover trending content, generate original AI images and captions, publish to Instagram, and receive Telegram status alerts on a set schedule
You need
n8n · telegram

Constraints

Requires an n8n instance; Instagram Business Account; Telegram Bot; RapidAPI account (Instagram Scraper API); Replicate account (Flux); OpenAI API Key; PostgreSQL database. Estimated setup 15–20 minutes. RapidAPI free tier limited to 500 requests/month.

What they did

Author mustafakendiguzel published a template workflow on n8n. The workflow triggers on a schedule, fetches top posts for #blender3d and #isometric via RapidAPI's Instagram Scraper API, filters out videos, and stores them in PostgreSQL for deduplication. It then uses GPT-4o-mini to analyze image content and generate an Instagram caption, calls Replicate's Flux model to generate a similar-style AI image, and publishes via Facebook Graph API to an Instagram Business Account, with Telegram Bot status notifications.

How it went

The author states the workflow automates the full pipeline from trend discovery to publication, suitable for creators and businesses maintaining an active Instagram presence. The template has significant views on n8n.io (89412). Specific success rates, API stability, or long-term reliability data are not provided. (author_report)

Worth knowing

1. RapidAPI Instagram Scraper API free tier is limited to 500 requests/month; paid subscription required beyond that. 2. Default hashtags are #blender3d and #isometric; modify in the HTTP Request nodes as needed. 3. Default cron schedule is 13:05 and 19:05 daily (5 13,19 * * *), timezone Europe/Istanbul. 4. You must create a Telegram Bot and send it a message before obtaining chat_id. 5. The top_trends table must be created in PostgreSQL before running; otherwise deduplication nodes will fail. 6. The workflow is inactive (active=false) after import; enable manually. 7. This site has not executed or verified the workflow; reproduction=not_tested.

n8n workflow template

Structure checked · Not run-tested

Use “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.

Setup and test checklist

Credentials to connect

  • Telegram node: connect Telegram API credentials.
  • Telegram1 node: connect Telegram API credentials.
  • Telegram2 node: connect Telegram API credentials.
  • Check Data on Database Is Exist node: connect Postgres credentials.
  • send error message to telegram node: connect Telegram API credentials.
  • insert data on db node: connect Postgres credentials.
  • Analyze Image and give the content node: connect OpenAI API credentials.
  • Analyze Content And Generate Instagram Caption node: connect OpenAI API credentials.
  • Prepare data on Instagram node: connect facebookGraphApi credentials.
  • Check Status Of Media Before Uploaded node: connect facebookGraphApi credentials.
  • Publish Media on Instagram node: connect facebookGraphApi credentials.
  • Check status of post node: connect facebookGraphApi credentials.

Configuration to replace

  • Source template is n8n public workflow #2803 (~44 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
  • Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.

Test input and expected output

  • Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
  • Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.

Template changes

  • Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
  • No business-logic edits; verify keys, quotas and privacy compliance before use.

Template retrieved: 2026-10-25

Steps

  1. Configure credentials and parameters

    After importing the template into n8n, configure the following credential and parameter nodes: - Replicate params: enter your replicate_token - Instagram params: enter your instagram_business_account_id - Telegram Params: enter your telegram_chat_id (create a Bot and send it a message first) - Rapid Api params: enter your x-rapid-api-key Replace all empty values with actual credentials.

  2. Fetch and filter trending posts

    The workflow uses two HTTP Request nodes to call the Instagram Scraper API for top posts under #blender3d and #isometric (feed_type=top). Code nodes then filter out videos (is_video=true), keeping only images, and extract id, caption.text (as prompt), code, thumbnail_url, and tag. Results from both sources are merged via a Merge node.

    Execution prompt · Source text。Code node 'filter the image content' and 'filter the image content-2' JS Code field

    const filteredData = $input.first().json.data.items.filter(item=> !item.is_video)
    return filteredData.map((item)=>{
      return {
        id: item.id,
        prompt: item.caption.text,
        content_code: item.code,
        thumbnail_url: item.thumbnail_url,
        tag: $input.first().json.data.additional_data.name
      }
    })
  3. Loop, deduplicate, and write to database

    The Loop Over Items node processes merged posts one by one. For each item: 1. Check Data on Database Is Exist: queries the top_trends table in PostgreSQL by code to check for duplicates 2. If Data is Exist: if found, loop to next item; if not found, continue 3. insert data on db: writes tag, code, prompt, thumbnail_url into top_trends (isposted=false) The top_trends table must be created beforehand.

    Setup guidance · Source text。PostgreSQL database; execute this CREATE TABLE statement

    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
    );
  4. AI image analysis and caption generation

    For each new (non-duplicate) post, the workflow runs: 1. Analyze Image and give the content: uses GPT-4o-mini image analyze on the thumbnail_url, extracting physical features (shape, texture, material, design) while ignoring background, lighting, and colors 2. Analyze Content And Generate Instagram Caption: uses GPT-4o-mini to turn the description into an under-150-word Instagram caption with a friendly tone and hashtags like #Blender3D #3DArt

    Execution prompt · Source text。OpenAI node 'Analyze Image and give the content' text field

    Create a clear and concise description of the object in the image, focusing on its physical and general features. Avoid detailed environmental aspects like background, lighting, or colors. Describe the shape, texture, size, and any unique characteristics of the object. Mention any notable features that make the object stand out, such as its surface details, materials, and design. The description should be focused on the object itself, not its surroundings.
    
    For example, describe the following image:

    Execution prompt · Source text。OpenAI node 'Analyze Content And Generate Instagram Caption' messages.values[0].content field

    =
    Summarize the following content description into a short, engaging Instagram caption under 150 words. The caption should focus on the content of the image, not the app. Keep it appealing to social media users, and highlight the visual details of the image. Include hashtags relevant to 3D modeling and design, such as #Blender3D, #3DArt, #DigitalArt, #3DModeling, and #ArtCommunity. Ensure the tone is friendly and inviting.
    
    
    Content description to summarize:
    {{ $json.content }}
    
    Make sure to craft the caption around the content's features, such as the color contrast, reflective surface, and artistic nature of the image.
  5. Generate AI image

    The GPT-generated description is cleaned (newlines, tabs, extra spaces removed) and embedded into a preset Flux prompt template. The workflow then calls the Replicate API (black-forest-labs/flux-schnell) to generate the image. Request parameters include output_format=jpg, output_quality=100, go_fast=false. Headers require Authorization: Bearer {replicate_token} and Prefer: wait.

    Execution prompt · Source text。HTTP Request node 'Generate image on flux' JSON Body field

    ={
      "input": {
        "prompt": "A highly detailed 3D isometric model of {{$('Analyze Image and give the content').item.json.content   .replace(/\\n/g, ' ') 
    .replace(/\\t/g, ' ') 
    .replace(/\s+/g, ' ')
    .trim(); }} rendered in a stylized miniature toy aesthetic. Materials: Matte plastic/painted metal/weathered stone texture with no self-shadowing. Lighting: - Completely shadowless rendering - Ultra bright and perfectly even illumination from all angles - Pure ambient lighting without directional shadows - Flat, consistent lighting across all surfaces - No ambient occlusion. Style specifications: - Clean, defined edges and surfaces - Slightly exaggerated proportions - Miniature/toy-like scale - Subtle wear and texturing - Rich color palette with muted tones - Isometric 3/4 view angle - Crisp details and micro-elements. Technical details: - 4K resolution - PBR materials without shadows - No depth of field - High-quality anti-aliasing - Perfect uniform lighting. Environment: Pure white background with zero shadows or gradients. Post-processing: High key lighting, maximum brightness, shadow removal.",
        "output_format": "jpg",
        "output_quality": 100,
        "go_fast":false
      }
    }
  6. Publish to Instagram

    Uses Facebook Graph API to publish to an Instagram Business Account: 1. Prepare data on Instagram: POST to /{instagram_business_account_id}/media with image_url (Flux output) and caption (GPT-generated) 2. Check Status Of Media Before Uploaded: query media status, check if status_code equals FINISHED 3. If FINISHED, execute Publish Media on Instagram: POST to /{instagram_business_account_id}/media_publish with creation_id 4. Check final post status to confirm PUBLISHED If status is abnormal, branches send Telegram error notifications.

  7. Telegram status notifications

    Telegram notifications are set at multiple points: - Success: Telegram1 sends "Instagram Content is shared" - Publish failure: Telegram2 sends "There was a problem when execution a upload content to instagram" - Media not ready: Telegram sends "Video upload edilmeden önce bir problem oldu" - Database error: send error message to telegram sends "There was a problem execution a postgresql content" All messages go to the same telegram_chat_id.

Prompt you can copy

Setup guidance · Editorial suggestion。Hand to setup assistant; confirm inputs and permissions first

This block is the prompt. Ads are never placed here.

You are an n8n workflow setup assistant. The user wants to replicate a template that automatically discovers trending Instagram content, generates AI images and captions, and publishes them. First confirm the user has: an n8n instance (self-hosted or cloud), Instagram Business Account, Telegram Bot, RapidAPI account, Replicate account, OpenAI API Key, and PostgreSQL database. Then guide them to import the workflow JSON, configure credentials, create the database table, modify hashtags and scheduling rules, and finally test a run. Do not perform any API calls or publishing actions on behalf of the user.

Before starting, ensure all API credentials are ready and execute the CREATE TABLE statement in PostgreSQL first.

Source

Generate Instagram content from top trends with AI image generation · mustafakendiguzel · n8n.io · 2025-01-26

Comments & feedback

Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.

Loading…

    Related