ChatGPT创意写作AI 评分 · 待评分AI 辅助编辑·未发现明显提示词注入风险n8n.io

从 Instagram 热门趋势自动生成 AI 图片与文案并发布

输入:Instagram 热门标签帖子;处理:爬取→去重→GPT 分析→Flux 生图→发布;输出:定时发布的 Instagram 图文与 Telegram 通知

有一点经验步骤流程提示词贴士
给谁
有 n8n 基础、需维护 Instagram 账号的内容创作者或小团队
你会得到
按设定时间自动发现热门趋势,生成原创 AI 图片与文案,发布到 Instagram 并接收 Telegram 通知
你需要
n8n · telegram

硬约束

需要 n8n 实例;Instagram Business 账号;Telegram Bot;RapidAPI 账号(Instagram Scraper API);Replicate 账号(Flux);OpenAI API Key;PostgreSQL 数据库。预计搭建 15–20 分钟。RapidAPI Free 版每月限 500 请求。

他们做了什么

作者 mustafakendiguzel 在 n8n 上发布了一个模板工作流。该工作流定时触发,通过 RapidAPI 的 Instagram Scraper API 获取 #blender3d 和 #isometric 的热门帖子,过滤视频后存入 PostgreSQL 去重。随后用 GPT-4o-mini 分析图片内容并生成 Instagram 文案,再调用 Replicate 的 Flux 模型生成类似风格的 AI 图片,最终通过 Facebook Graph API 发布到 Instagram Business Account,并用 Telegram Bot 发送状态通知。

效果如何

作者声称该工作流可自动完成从趋势发现到内容发布的全过程,适合希望保持 Instagram 活跃度的创作者和企业。模板在 n8n.io 上获得较高浏览量(89412 views)。具体发布成功率、API 稳定性等未提供实测数据。(author_report)

值得知道

1. RapidAPI Instagram Scraper API 的免费版每月限 500 请求,超出需付费订阅。 2. 默认 hashtag 为 #blender3d 和 #isometric,可在 HTTP Request 节点修改。 3. 定时规则默认为每天 13:05 和 19:05(cron: 5 13,19 * * *),时区 Europe/Istanbul。 4. Telegram Bot 需先创建并向其发送消息,否则无法获取 chat_id。 5. 必须预先在 PostgreSQL 创建 top_trends 表,否则去重节点会失败。 6. 工作流未激活(active=false),导入后需手动启用。 7. 本站未对该工作流进行实际运行验证,reproduction=not_tested。

n8n 工作流模板

结构已检查 · 未实际运行

下载后在 n8n 选择“Import from File”,或复制 JSON 后粘贴到编辑器。先配置自己的账号,再用测试数据运行;模板默认未启用。

配置与测试清单

需要绑定的凭证

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

需要替换的配置

  • 源模板来自 n8n 公开库 #2803(约 44 个节点)。导入后先保持未启用,核对触发器、表达式与外部 API 端点。
  • Sticky Note 中的说明仅供参考;按自己的账号、表结构或频道 ID 替换占位配置。

测试输入与预期结果

  • 在测试环境手动执行一次主路径,确认每个需凭证的节点已连接且无鉴权错误。
  • 用一条合成/脱敏样例数据跑通,核对输出字段与下游写入目标,再考虑生产启用。

模板处理说明

  • 已移除原作者凭证绑定、webhookId 与执行数据,工作流设为未启用;节点、连线与原文提示词保持原样。未在 n8n 中实际运行。
  • 未改业务逻辑;运行前请自行核对密钥、配额与隐私合规。

模板获取日期: 2026-10-25

步骤

  1. 配置凭证与参数

    在 n8n 中导入模板后,先配置以下凭证和参数节点: - Replicate params:填入 replicate_token - Instagram params:填入 instagram_business_account_id - Telegram Params:填入 telegram_chat_id(需先创建 Bot 并向其发送消息) - Rapid Api params:填入 x-rapid-api-key 各值留空处需替换为实际凭证。

  2. 获取并过滤热门帖子

    工作流通过两个 HTTP Request 节点分别请求 Instagram Scraper API,获取 #blender3d 和 #isometric 的热门帖子(feed_type=top)。 随后 Code 节点过滤掉视频(is_video=true),仅保留图片,并提取 id、caption.text(作为 prompt)、code、thumbnail_url、tag。 两个来源的结果经 Merge 节点合并。

    运行提示词 · 来源原文。Code 节点 'filter the image content' 与 'filter the image content-2' 的 JS Code 字段

    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 Over Items 节点逐条处理合并后的帖子。对每条数据: 1. Check Data on Database Is Exist:查询 PostgreSQL 的 top_trends 表,按 code 字段检查是否已存在 2. If Data is Exist:若已存在则返回循环下一条;若不存在则继续 3. insert data on db:将 tag、code、prompt、thumbnail_url 写入 top_trends 表(isposted=false) 数据库需预先创建 top_trends 表。

    搭建指导 · 来源原文。PostgreSQL 数据库,执行建表语句

    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 分析图像并生成文案

    对去重后的新帖子,依次执行: 1. Analyze Image and give the content:使用 GPT-4o-mini 的 image analyze 功能,分析 thumbnail_url 中的图像,提取物体的物理特征(形状、纹理、材质、设计等),忽略背景、光照、颜色 2. Analyze Content And Generate Instagram Caption:使用 GPT-4o-mini,将上一步的描述转为 150 词以内的 Instagram 文案,语气友好,并附带 #Blender3D #3DArt 等标签

    运行提示词 · 来源原文。OpenAI 节点 'Analyze Image and give the content' 的 text 字段

    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:

    运行提示词 · 来源原文。OpenAI 节点 'Analyze Content And Generate Instagram Caption' 的 messages.values[0].content 字段

    =
    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. 生成 AI 图像

    将 GPT 分析得到的图像描述清理后(去除换行、制表符、多余空格),嵌入预设的 Flux prompt 模板,调用 Replicate API(black-forest-labs/flux-schnell)生成图片。 请求参数包括 output_format=jpg、output_quality=100、go_fast=false。Header 需携带 Authorization: Bearer {replicate_token} 和 Prefer: wait。

    运行提示词 · 来源原文。HTTP Request 节点 'Generate image on flux' 的 JSON Body 字段

    ={
      "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. 发布到 Instagram

    使用 Facebook Graph API 发布到 Instagram Business Account: 1. Prepare data on Instagram:POST 到 /{instagram_business_account_id}/media,携带 image_url(Flux 输出)和 caption(GPT 生成的文案) 2. Check Status Of Media Before Uploaded:查询媒体状态,检查 status_code 是否为 FINISHED 3. 若 FINISHED,执行 Publish Media on Instagram:POST 到 /{instagram_business_account_id}/media_publish,携带 creation_id 4. 再次检查帖子状态,确认 PUBLISHED 若状态异常,分支会发送 Telegram 错误通知。

  7. Telegram 状态通知

    工作流在多个节点设置 Telegram 通知: - 发布成功:Telegram1 发送 "Instagram Content is shared" - 发布失败:Telegram2 发送 "There was a problem when execution a upload content to instagram" - 媒体未就绪:Telegram 发送 "Video upload edilmeden önce bir problem oldu" - 数据库错误:send error message to telegram 发送 "There was a problem execution a postgresql content" 所有消息发送至同一 telegram_chat_id。

可复制提示词

搭建指导 · 本站建议版本。交给搭建助手,先确认输入和权限

这一段是提示词,页面不会在这里插入广告。

你是一个 n8n 工作流搭建助手。用户希望复现一个自动从 Instagram 热门趋势生成 AI 内容并发布的 n8n 模板。请先确认用户已具备以下前提:n8n 实例(自托管或云)、Instagram Business Account、Telegram Bot、RapidAPI 账号、Replicate 账号、OpenAI API Key、PostgreSQL 数据库。然后引导用户按步骤导入 workflow JSON、配置凭证、创建数据库表、修改 hashtag 与定时规则,最后测试运行。不要替用户执行任何 API 调用或发布操作。

搭建前请确认所有 API 凭证已就绪,并先在 PostgreSQL 执行建表语句。

来源

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

留言与反馈

试过这个方法吗?分享效果、遇到的问题或改进建议。留言审核后公开,请勿填写敏感信息。

正在加载…

    相关用例