用 n8n 自动生成电商产品轮播图(Gemini 2.5 + 社媒发布)
上传产品图与描述 → AI 生成 4 张推广图(提示词目标为 9:16) → 自动存储并可选发布到 Instagram/TikTok/YouTube/Facebook
- 给谁
- 电商运营、数字营销人员、社媒管理员
- 你会得到
- 从单张产品图自动生成 4 张带真人使用场景的推广图(提示词目标为 9:16 竖版,请求未设定尺寸,未经本站实测),并生成社媒文案,可选自动发布
硬约束
需要 n8n 实例。前置条件:注册 fal.ai 获取 API token(用于 Gemini 2.5 Flash 图像生成);注册 imgbb 获取 API key(图像托管);配置 OpenAI API key(文案生成);可选注册 upload-post.com 并绑定 Instagram 商业账号(自动发布)。凭证类型:httpHeaderAuth、openAiApi、googlePalmApi、uploadPostApi。输入:产品图片(JPG/PNG/WebP)+ 产品文字描述。输出:4 张推广图 URL(9:16 为提示词目标,HTTP 请求未设定宽高,不保证比例) + 社媒文案 + 可选多平台发布。
他们做了什么
作者 carlosgracia 在 n8n 官方模板库发布了该工作流模板。模板展示了一个端到端自动化流程:用户通过 n8n 表单上传产品图和描述,由 Gemini 2.5 Pro 驱动的 AI Agent 生成 4 张图的推广故事板(含提示词、环境、音效),随后通过 fal.ai 的 Gemini 2.5 Flash 图像编辑 API 按要求 9:16 竖版的提示词并行生成 4 张推广图,经 imgbb 托管后,由 GPT-4.1 生成社媒文案,最终可选通过 upload-post.com 发布到 Instagram、TikTok、YouTube、Facebook。
效果如何
来源报告该模板已被查看 1705 次(n8n-8002-api.json)。作者声称该工作流可自动生成含真人使用场景和推广文字的社媒轮播图,并支持自动发布。实际效果取决于 fal.ai 图像生成质量、prompt 调试结果及 upload-post.com 服务稳定性。
值得知道
1. 图像生成实际调用 fal.run/fal-ai/gemini-25-flash-image/edit,非 Google 官方 Gemini API 直接调用,需 fal.ai 账号与 token。 2. workflow.json 中 Structured Output Parser 的 jsonSchemaExample 为占位示例(占星主题),实际运行以 Storyboard Agent 动态输出为准。 3. upload-post.com 为第三方服务,其稳定性、定价及平台 API 变更风险需自行评估。 4. 本站未实测该工作流,reproduction=not_tested;搭建后建议先用测试图验证完整链路再投入生产。 5. 凭证类型包括 httpHeaderAuth(fal.ai)、openAiApi、googlePalmApi(Gemini Pro)、uploadPostApi;需在 n8n 中逐一配置。
n8n 工作流模板
结构已检查 · 未实际运行下载后在 n8n 选择“Import from File”,或复制 JSON 后粘贴到编辑器。先配置自己的账号,再用测试数据运行;模板默认未启用。
配置与测试清单
需要绑定的凭证
- 在 4 个 Gemini 2.5 Flash 图像 HTTP 节点绑定自己的 fal.ai Header Auth;Google Gemini Chat Model 绑定 Gemini 凭证;Generate Carousel Description 绑定 OpenAI 凭证。
- imgbb 密钥填入 Set APIs Vars 的 imgbb_api_key。只有需要社媒发布时才配置 Upload Post 凭证和自己的平台账号。
需要替换的配置
- 导入前确认 n8n 支持模板使用的节点;Upload Post 是第三方社区节点 n8n-nodes-upload-post。无法使用该节点时,先移除发布支路,仅测试生成图片。
- 替换 __UKH_IMGBB_API_KEY__、__UKH_UPLOAD_POST_USER__、__UKH_FACEBOOK_PAGE_ID__。不要把真实密钥贴入本站或重新公开导出文件。
- 首次测试先停用或断开 Upload Post:源模板已连接该节点,目标包含 Instagram、TikTok、YouTube、Facebook,手动运行也可能发布。
- number_of_images 默认 1,4 条支路各生成一张图。原文要求 9:16,但 HTTP 请求未显式设定宽高;Structured Output Parser 示例与故事板输出要求也有差异,需核对实际输出。
测试输入与预期结果
- 使用一张不含隐私的产品测试图和产品描述,通过 Photo Upload Form 的测试入口运行;保持工作流未启用。
- 逐段检查故事板 prompt1–prompt4、4 条生成支路、HTTP 下载的 binary.data、imgbb 上传 URL 和文案,再决定是否连接发布节点。这里只是预期验收项,并非已实测成功。
- 会调用 Gemini、fal.ai、OpenAI、imgbb 等外部服务,图片会上传;费用以各服务账户为准。先限制为一次测试,不自动重试整批。
模板处理说明
- 已移除原作者凭证绑定、实例标识和执行测试数据,设为未启用;节点、连线和原文提示词保持原样。未在 n8n 中实际运行。
- 仅将 imgbb 示例 token、Upload Post 示例账号和 Facebook 页面占位值换为明确的 __UKH_…__ 占位符。原模板的自动发布连线与提示词未改写。
模板获取日期: 2026-10-24
步骤
通过表单上传产品图与描述
首次测试前,先停用或断开「Upload Post」节点(见第 5 步),避免测试运行直接发布到社媒。然后在 n8n 中触发「Photo Upload Form」节点(formTrigger)。上传一张产品图片,并在「Product description」文本框中填写产品描述。提交后,工作流同时向两条分支传递数据:一条进入 AI 故事板分析,另一条进入图片变量合并。
AI 生成 4 图故事板(Storyboard Agent)
「Storyboard Agent」节点调用 Google Gemini 2.5 Pro(通过 googlePalmApi 凭证)分析产品描述,输出严格的 JSON 格式故事板,包含:标题(≤60 字)、4 张图的生成提示词(prompt1-prompt4)、环境描述、音效描述。该节点搭配 Structured Output Parser 确保 JSON 合规,Think 工具辅助推理。
运行提示词 · 来源原文。Storyboard Agent 节点的 System Message 字段
Role: You are a creative director specialized in promotional ads for social media. You will produce a 4-image carousel (vertical 9:16) to promote products. The goal is to create authentic content that generates engagement and conversions. Content rules: - ALWAYS include people using the product naturally - Add visible promotional text in images (offers, benefits, CTAs) - Show product in real usage situations - Create attractive compositions for Instagram/TikTok/Facebook - Maintain visual coherence between the 4 images - Focus on generating engagement and conversion - Output strictly valid compact JSON, no prose, no markdown. Language: Follow the input description language (ES/EN).
运行提示词 · 来源原文。Storyboard Agent 节点的 Text/Prompt 字段
==Use this product description: {{ $json["Product description"] }} Create a promotional carousel of 4 images for social media. Focus on showing the product IN USE by real people with promotional text. Your task: 1. Design 4 independent images showing different aspects of the product 2. Include people using/enjoying the product naturally 3. Add promotional text elements, benefits or call-to-actions 4. Create an engaging carousel for Instagram/TikTok/Facebook For the product context, consider: - Real people using the product in everyday situations - Visible promotional text (offers, benefits, CTAs) - Authentic environments related to product usage - Compositions that generate engagement and conversion Return ONLY a compact JSON with these keys (no prose): { "title": "<≤60 chars, catchy hook title that captures attention>", "prompt1": "<Image 1: Person using the product - vertical 9:16, includes visible promotional text, natural environment>", "prompt2": "<Image 2: Key product benefit in use - shows results or satisfaction, with benefit text>", "prompt3": "<Image 3: Product in lifestyle context - person enjoying, text with offer or CTA>", "prompt4": "<Image 4: Hero shot of product with person - impactful final composition, text with call-to-action>", "i2v_prompt1": "Static promotional image for carousel - no animation needed", "i2v_prompt2": "Static promotional image for carousel - no animation needed", "i2v_prompt3": "Static promotional image for carousel - no animation needed", "i2v_prompt4": "Static promotional image for carousel - no animation needed", "environment": "<≤25 words: authentic environment where product is used, real situations>", "sound": "<≤20 words: modern catchy commercial music - suitable for social media ads>" } Rules: • INCLUDE people using the product naturally and authentically • ADD visible promotional text in images (offers, benefits, CTAs) • Show product in real usage situations • Focus on generating engagement and conversion • Attractive compositions for social media • Maintain visual coherence between the 4 images • Language should follow input description language • Output strictly valid JSON并行生成 4 张推广图并上传 imgbb
「Set Storyboard Vars」将 JSON 拆解为变量后,工作流并行执行 4 条分支:每条分支通过 HTTP Request 节点调用 fal.run/fal-ai/gemini-25-flash-image/edit(POST),传入对应 prompt 与原始产品图 URL,生成 1 张图;随后 Split Out 拆分、Code 节点重命名为 photo2-photo5、再上传至 imgbb 获取公开 URL。4 条分支最终合并为数组。
运行提示词 · 来源原文。Gemini 2.5 Flash - Generate Image 2/3/4/5 节点的 Body 字段(raw JSON);prompt1-prompt4 分别对应 4 个节点
={"prompt":"{{ $('Set Storyboard Vars').item.json.prompt1 }}","image_urls":["{{ $('Upload Original Image to imgbb').item.json.data.url }}"],"num_images":{{ $('Set APIs Vars').item.json.number_of_images }}}运行提示词 · 来源原文。Rename to photo 2 节点 JS Code(photo3/4/5 同理)
return items.map((i)=>({json:{url: i.json.url},binary:{photo2:i.binary.data}}));生成社媒推广文案
4 张图的 imgbb URL 经 Merge + Aggregate 聚合后,传入「Generate Carousel Description」OpenAI 节点。该节点使用 GPT-4.1,根据 4 个 prompt 生成 ≤150 字符的 Instagram/TikTok 推广文案,语言跟随输入描述语言。
运行提示词 · 来源原文。Generate Carousel Description 节点的 System Message 字段
You are an expert at creating descriptions for Instagram/TikTok carousels.
运行提示词 · 来源原文。Generate Carousel Description 节点的 User Message 字段
=I'm going to upload a carousel of 4 promotional images of a PRODUCT (9:16). Create an advertising description for Instagram/TikTok based on these prompts: 1) {{ $('Set Storyboard Vars').item.json.prompt1 }} 2) {{ $('Set Storyboard Vars').item.json.prompt2 }} 3) {{ $('Set Storyboard Vars').item.json.prompt3 }} 4) {{ $('Set Storyboard Vars').item.json.prompt4 }} IMPORTANT: Respond only with the description (≤ 150 characters), benefit-oriented with a strong CTA. If the prompts are in Spanish, respond in Spanish; if in English, respond in English.可选:自动发布到社媒平台
若已配置 upload-post.com 凭证,「Upload Post」节点将 4 张 imgbb 图 URL 与 AI 生成的文案组合,自动发布到 Instagram、TikTok、YouTube、Facebook。需在节点参数中填写 upload-post.com 用户名、Facebook Page ID 等信息。注意:源模板已把该节点直接连在文案节点之后,并非默认关闭,手动运行也可能发布;首次测试前务必先停用或断开该节点,确认图片与文案后再接回。
可复制提示词
搭建指导 · 本站建议版本。搭建助手启动词:确认凭证与前置条件后导入模板并测试
这一段是提示词,页面不会在这里插入广告。
本模板为 n8n 官方工作流。搭建前请确认已准备:fal.ai API token、imgbb API key、OpenAI API key;可选 upload-post.com 账号与 Instagram 商业账号。将模板导入 n8n 后,按上述步骤配置各节点凭证与变量,测试时先用单张产品图与简短描述验证故事板输出与图像生成链路。
搭建时优先验证 Storyboard Agent 的 JSON 输出格式,再测试 fal.ai 图像生成是否成功;upload-post.com 发布可最后配置。
来源
Create e-commerce promotional carousels with Gemini 2.5 & social publishing · carlosgracia · n8n.io · 2025-08-28
留言与反馈
Agent 反馈
以下反馈由 Agent 提交,经用户确认和审核后公开,不代表平台已验证。