AI驱动的产品视频生成器 (Foreplay + Gemini + Sora 2)
高级
这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 18 个节点。主要使用 Set, Wait, Switch, SplitOut, GoogleDrive 等节点。 基于Foreplay、Gemini和Sora 2的AI驱动产品视频生成器
前置要求
- •Google Drive API 凭证
- •可能需要目标 API 的认证凭证
- •Google Gemini API Key
使用的节点 (18)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "689fa22e68cd4198e4ae37f3cc44f498087edd235a867e22515be823bab694c7",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "7c232e36-1c24-48a9-8d0b-d000011321d0",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1968,
-672
],
"parameters": {
"width": 816,
"height": 880,
"content": ""
},
"typeVersion": 1
},
{
"id": "e8dbcb86-f2ec-4487-822c-becdf9e081e1",
"name": "手动触发器",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-1952,
320
],
"parameters": {},
"typeVersion": 1
},
{
"id": "9ee5ce87-4e43-4978-9def-5c7a58ea919a",
"name": "设置工作流凭据",
"type": "n8n-nodes-base.set",
"position": [
-1728,
320
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "4b458b37-0440-4110-b62d-7076f4490610",
"name": "folderProductId",
"type": "string",
"value": "={{GOOGLE_DRIVE_FOLDER_ID}}"
},
{
"id": "4b559d50-0017-4f58-afeb-fad3333f3867",
"name": "folderGeneratedId",
"type": "string",
"value": "={{GOOGLE_DRIVE_FOLDER_ID}}"
},
{
"id": "c7a44a49-b828-464c-a9c8-574b801a0a54",
"name": "baseUrl",
"type": "string",
"value": "=https://public.api.foreplay.co/api"
},
{
"id": "8521d447-e36a-453f-944a-8bffa2dc9227",
"name": "foreplayApiKey",
"type": "string",
"value": "={{FOREPLAY_API_KEY}}"
},
{
"id": "12adf778-3c00-4a89-b909-2595238fc3c5",
"name": "brandId",
"type": "string",
"value": "={{FOREPLAY_BRAND_ID}}"
}
]
}
},
"executeOnce": false,
"typeVersion": 3.4
},
{
"id": "3865d87a-5a77-4bb9-9808-06de15c34d26",
"name": "设置产品信息",
"type": "n8n-nodes-base.set",
"position": [
-1504,
320
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "b65ccd77-d030-47df-b704-78a8174c8876",
"name": "productName",
"type": "string",
"value": "Homyped"
},
{
"id": "ece2edb0-e27e-47fe-8b81-b6160e71e8e9",
"name": "niche",
"type": "string",
"value": "fashion"
},
{
"id": "d94bea58-6546-4a31-876b-650c6e7f1178",
"name": "category",
"type": "string",
"value": "shoes"
},
{
"id": "d7f2b956-0c08-421d-b41a-aedd04a1160e",
"name": "targetMarket",
"type": "string",
"value": "b2c"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "b3273b01-a710-45af-acbf-944c69ccc31c",
"name": "从 Google Drive 获取产品图片",
"type": "n8n-nodes-base.googleDrive",
"position": [
-1280,
320
],
"parameters": {
"limit": 1,
"filter": {
"folderId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Set Workflow Credentials').item.json.folderProductId }}"
}
},
"options": {},
"resource": "fileFolder"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "5sDgEDVot7EszmIg",
"name": "Johan Drive"
}
},
"typeVersion": 3
},
{
"id": "993b4d2f-09f6-470a-bd3e-3e958337bd2c",
"name": "获取竞品视频数据(Foreplay API)",
"type": "n8n-nodes-base.httpRequest",
"position": [
-1056,
320
],
"parameters": {
"url": "={{ $('Set Workflow Credentials').item.json.baseUrl }}/spyder/brand/ads",
"options": {},
"sendQuery": true,
"sendHeaders": true,
"queryParameters": {
"parameters": [
{
"name": "brand_id",
"value": "={{ $('Set Workflow Credentials').item.json.brandId }}"
},
{
"name": "start_date",
"value": "={{ $now.minus(1, 'month').format('yyyy-MM-dd') }}"
},
{
"name": "end_date",
"value": "={{ $now.minus(1, 'day').format('yyyy-MM-dd') }}"
},
{
"name": "live",
"value": "true"
},
{
"name": "display_format",
"value": "video"
},
{
"name": "publisher_platform",
"value": "instagram"
},
{
"name": "niches",
"value": "={{ $('Set Product Information').item.json.niche }}"
},
{
"name": "market_target",
"value": "={{ $('Set Product Information').item.json.targetMarket }}"
},
{
"name": "languages",
"value": "en"
},
{
"name": "video_duration_min",
"value": "5"
},
{
"name": "video_duration_max",
"value": "30"
},
{
"name": "running_duration_min_days",
"value": "1"
},
{
"name": "limit",
"value": "5"
},
{
"name": "order",
"value": "longest_running"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "=Bearer {{ $('Set Workflow Credentials').item.json.foreplayApiKey }}"
}
]
}
},
"executeOnce": true,
"typeVersion": 4.2
},
{
"id": "a7781992-82f1-4afe-999e-164758293785",
"name": "拆分 Foreplay 响应",
"type": "n8n-nodes-base.splitOut",
"position": [
-832,
320
],
"parameters": {
"options": {},
"fieldToSplitOut": "data"
},
"typeVersion": 1
},
{
"id": "f4d1dea6-7081-4453-9cac-d34c8a70476c",
"name": "组装视频输入数据",
"type": "n8n-nodes-base.set",
"position": [
-608,
320
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "77b8c6dc-3bdb-4edf-8d65-78d87bca7dd5",
"name": "desc",
"type": "string",
"value": "={{ $json.description }}"
},
{
"id": "659ad795-0aae-4bb1-8bbb-f949475e704e",
"name": "transcript",
"type": "string",
"value": "={{ $json.full_transcription }}"
},
{
"id": "5797be9b-27a2-4f7f-91f4-d8c5663b3d9d",
"name": "mood",
"type": "object",
"value": "={{ $json.emotional_drivers }}"
},
{
"id": "7024af66-9cc5-4064-86e8-ebcd550356a9",
"name": "duration",
"type": "number",
"value": "={{ $json.video_duration }}"
},
{
"id": "68a1fca5-9147-4db0-96b0-b9f7e015088d",
"name": "pictureUrl",
"type": "string",
"value": "=https://drive.google.com/thumbnail?id={{ $('Fetch Product Image from Google Drive').item.json.id }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "b5e13d3c-9fef-47cb-8904-fabe0d335699",
"name": "遍历广告示例",
"type": "n8n-nodes-base.splitInBatches",
"position": [
-1936,
528
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "bf735a40-59df-4583-9307-3b65b1e68b49",
"name": "生成视频提示词",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-1712,
592
],
"parameters": {
"text": "=Generate a personalized product video prompt using the following data:\n\nProduct Information:\nProduct Name: {{ $('Set Product Information').item.json.productName }}\nNiche: {{ $('Set Product Information').item.json.niche }}\nCategory: {{ $('Set Product Information').item.json.category }}\nTarget Market: {{ $('Set Product Information').item.json.targetMarket }}\n\nDescription:\n{{ $json.desc }}\n\nTranscription (can be null):\n{{ $json.transcript }}\n\nMood (JSON format of emotion scores, each range from 1-10):\n{{ $json.mood.toJsonString() }}\n\nVideo Duration (in seconds):\n{{ $json.duration }}",
"options": {
"systemMessage": "=## ROLE\n\nYou are VidPrompt, an AI assistant that generates personalized, cinematic-quality prompts for text-to-video generation models.\n\nYour task is to take the user’s inputs — `productName`, `niche`, `category`, `targetMarket`, `desc`, `transcript`, `mood`, and `duration` — and produce a vivid, emotionally aligned paragraph describing the ideal video scene.\n\n## INPUT FIELDS\n\n- productName → The brand or product name to be featured in the video.\n- niche → The specific market focus (e.g. fitness, fashion, tech, education).\n- category → The product or service type (e.g. sportswear, skincare, SaaS tool).\n- targetMarket → The intended audience or user group.\n- desc → A short text describing the concept, product, or message of the video.\n- transcript → (Optional) May contain narration or spoken lines. If null, focus purely on visuals.\n- mood → JSON object with emotion scores (e.g. achievement, fear, curiosity, etc.).\n- duration → Target video duration in seconds.\n\n## TASK OBJECTIVES\n\n1. Incorporate white label info naturally — subtly weave the product name, niche, category, and target market into the video prompt.\n - Example: “A cinematic 30-second video ad for `productName`, a cutting-edge `category` in the `niche` niche, designed for `targetMarket`.”\n\n2. Infer the emotional tone from the top 1–2 mood values (use human-readable emotion names).\n\n3. Determine video length:\n - ≤10s → short video\n - >10s and ≤20s → medium-length video\n - >20s → long video\n\n4. Describe style (cinematic, product ad, explainer, vlog, animation, etc.) based on the description and tone.\n\n5. Incorporate the transcript if provided (e.g. describe it as voiceover, narrator dialogue, or lip-synced scene).\n\n6. Write one cohesive, richly detailed paragraph that mentions:\n - The title or theme (implied or stated naturally)\n - The scene visuals and camera feel\n - The mood and style\n - The video duration category\n\n## RULES\n\n- Don't include any double quotes for in the generated prompt (\"\"), you could use single quote instead ('').\n- Don't include or mention other brands in the generated prompt, just focus on the white label product.\n\n## EXAMPLE\n\nInput:\n{\n \"product_name\": \"Nike Air Superfly\",\n \"niche\": \"Athletic Footwear\",\n \"category\": \"Sportswear\",\n \"target_market\": \"Runners and fitness enthusiasts\",\n \"desc\": \"Set the pace in the Nike Air Superfly, now with upgraded cushioning and a low-profile design.\",\n \"transcript\": null,\n \"mood\": {\n \"achievement\": 7,\n \"anger\": 1,\n \"authority\": 2,\n \"belonging\": 1,\n \"competence\": 8,\n \"curiosity\": 3,\n \"empowerment\": 6,\n \"engagement\": 4,\n \"esteem\": 5,\n \"fear\": 1,\n \"guilt\": 1,\n \"nostalgia\": 1,\n \"nurturance\": 1,\n \"security\": 3,\n \"urgency\": 2\n },\n \"duration\": 21.61\n}\n\nOutput:\nA long, cinematic sports commercial in an achievement-driven and empowering mood, promoting the Nike Air Superfly, a premium sportswear innovation in the athletic footwear niche for runners and fitness enthusiasts. The 30-second film opens at sunrise with a runner sprinting across the cityscape, sweat glinting in golden light. Smooth tracking shots capture the low-profile design and upgraded cushioning, symbolizing precision and drive. The mood feels strong and aspirational, underscored by rhythmic breathing and pulsing ambient beats that echo determination."
},
"promptType": "define"
},
"executeOnce": false,
"typeVersion": 2.2
},
{
"id": "ff39c0e1-0de0-4017-95ce-9ba6695a7b23",
"name": "Google Gemini LLM",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
-1648,
816
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"id": "C4mfRdRQfQ524QK8",
"name": "Johan Gemini"
}
},
"typeVersion": 1
},
{
"id": "b8d23d47-000f-44aa-98af-62bf7d846752",
"name": "创建视频任务(Kie.ai)",
"type": "n8n-nodes-base.httpRequest",
"position": [
-1360,
592
],
"parameters": {
"url": "https://api.kie.ai/api/v1/jobs/createTask",
"method": "POST",
"options": {},
"jsonBody": "={\n \"model\": \"sora-2-image-to-video\",\n \"input\": {\n \"callBackUrl\": \"{{ $('Set Workflow Credentials').item.json.callBackUrl }}\",\n \"prompt\": \"{{ $json.output }}\",\n \"image_urls\": [\"{{ $('Assemble Video Input Data').item.json.pictureUrl }}\"],\n \"aspect_ratio\": \"portrait\",\n \"remove_watermark\": true\n }\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth"
},
"credentials": {
"httpBearerAuth": {
"id": "u4b7FCQ7TVJYKQKH",
"name": "Kie.ai"
},
"httpHeaderAuth": {
"id": "XwIEQR6MF0OmLcXg",
"name": "yusuf test"
}
},
"typeVersion": 4.2
},
{
"id": "34a46580-ae03-4e7d-b2c2-91e953c7ce50",
"name": "检查视频生成状态",
"type": "n8n-nodes-base.httpRequest",
"position": [
-1136,
592
],
"parameters": {
"url": "=https://api.kie.ai/api/v1/jobs/recordInfo?taskId={{ $json.data.taskId }}",
"options": {},
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth"
},
"credentials": {
"httpBearerAuth": {
"id": "u4b7FCQ7TVJYKQKH",
"name": "Kie.ai"
},
"httpHeaderAuth": {
"id": "XwIEQR6MF0OmLcXg",
"name": "yusuf test"
}
},
"typeVersion": 4.2
},
{
"id": "ddee4c6a-558f-416d-be27-9dd5b32f5f99",
"name": "下载成品视频",
"type": "n8n-nodes-base.httpRequest",
"position": [
-688,
528
],
"parameters": {
"url": "={{ $json.data.resultJson.parseJson().resultUrls.first() }}",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "4e5615a7-3e23-4d65-a439-a199131156f0",
"name": "再次检查前等待",
"type": "n8n-nodes-base.wait",
"position": [
-688,
752
],
"webhookId": "7ab58c3b-a1df-4114-a6df-74b5835a9b61",
"parameters": {
"unit": "minutes",
"amount": 1
},
"typeVersion": 1.1
},
{
"id": "0a5f3515-36f9-4538-90e5-c862b6abd5e8",
"name": "将生成的视频上传到 Google Drive",
"type": "n8n-nodes-base.googleDrive",
"position": [
-464,
832
],
"parameters": {
"name": "={{ $now.format('yyyy-MM-dd HH:mm') }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Set Workflow Credentials').item.json.folderGeneratedId }}"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "5sDgEDVot7EszmIg",
"name": "Johan Drive"
}
},
"typeVersion": 3
},
{
"id": "026c62d0-c326-4a48-b463-02b643434bbc",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1120,
-448
],
"parameters": {
"color": 5,
"width": 768,
"height": 656,
"content": "## 分步说明"
},
"typeVersion": 1
},
{
"id": "1b6b3e1a-1e3e-4006-8fdc-64dafe85725a",
"name": "视频生成状态",
"type": "n8n-nodes-base.switch",
"position": [
-912,
560
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Success",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "3f37a57f-f3d0-4d14-80da-8574c383a0b9",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.state }}",
"rightValue": "success"
}
]
},
"renameOutput": true
},
{
"outputKey": "Failed",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "5872a82e-f279-4cf0-89fe-3e774e34bc61",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.state }}",
"rightValue": "failed"
}
]
},
"renameOutput": true
}
]
},
"options": {
"fallbackOutput": "extra"
}
},
"typeVersion": 3.3
}
],
"pinData": {},
"connections": {
"Manual Trigger": {
"main": [
[
{
"node": "Set Workflow Credentials",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini LLM": {
"ai_languageModel": [
[
{
"node": "Generate Video Prompt",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Generate Video Prompt": {
"main": [
[
{
"node": "Create Video Task (Kie.ai)",
"type": "main",
"index": 0
}
]
]
},
"Download Finished Video": {
"main": [
[
{
"node": "Upload Generated Video to Google Drive",
"type": "main",
"index": 0
}
]
]
},
"Set Product Information": {
"main": [
[
{
"node": "Fetch Product Image from Google Drive",
"type": "main",
"index": 0
}
]
]
},
"Split Foreplay Response": {
"main": [
[
{
"node": "Assemble Video Input Data",
"type": "main",
"index": 0
}
]
]
},
"Video Generation Status": {
"main": [
[
{
"node": "Download Finished Video",
"type": "main",
"index": 0
}
],
[
{
"node": "Iterate Over Ad Examples",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait Before Checking Again",
"type": "main",
"index": 0
}
]
]
},
"Iterate Over Ad Examples": {
"main": [
[],
[
{
"node": "Generate Video Prompt",
"type": "main",
"index": 0
}
]
]
},
"Set Workflow Credentials": {
"main": [
[
{
"node": "Set Product Information",
"type": "main",
"index": 0
}
]
]
},
"Assemble Video Input Data": {
"main": [
[
{
"node": "Iterate Over Ad Examples",
"type": "main",
"index": 0
}
]
]
},
"Create Video Task (Kie.ai)": {
"main": [
[
{
"node": "Check Video Generation Status",
"type": "main",
"index": 0
}
]
]
},
"Wait Before Checking Again": {
"main": [
[
{
"node": "Check Video Generation Status",
"type": "main",
"index": 0
}
]
]
},
"Check Video Generation Status": {
"main": [
[
{
"node": "Video Generation Status",
"type": "main",
"index": 0
}
]
]
},
"Fetch Product Image from Google Drive": {
"main": [
[
{
"node": "Fetch Competitor Video Data (Foreplay API)",
"type": "main",
"index": 0
}
]
]
},
"Upload Generated Video to Google Drive": {
"main": [
[
{
"node": "Iterate Over Ad Examples",
"type": "main",
"index": 0
}
]
]
},
"Fetch Competitor Video Data (Foreplay API)": {
"main": [
[
{
"node": "Split Foreplay Response",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 内容创作, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
实时 - 使用Gemini和Creatomate自动化病毒式AI视频制作与发布
使用Gemini和Creatomate自动化AI视频创作与多平台发布
Set
Code
Wait
+15
47 节点Intuz
内容创作
LinkedIn和X病毒内容自动引擎
使用AI生成和发布自动创建LinkedIn和X的病毒内容
If
Set
Wait
+26
156 节点Diptamoy Barman
内容创作
WordPress博客自动化专业版(深度研究)v2.1市场
使用GPT-4o、Perplexity AI和多语言支持自动化SEO优化的博客创建
If
Set
Xml
+27
125 节点Daniel Ng
内容创作
使用GPT-4o、RunwayML和ElevenLabs的AI旅游视频生成器(用于社交媒体)
GPT-4o、RunwayML、ElevenLabs社交媒体应用
Set
Code
Wait
+12
36 节点Mohan Gopal
内容创作
使用 Gemini AI 和 Airtable 从图片生成 Shopify 产品列表
使用 Gemini AI 和 Airtable 从图片生成 Shopify 产品列表
If
Set
Code
+16
33 节点MANISH KUMAR
内容创作
Gemini_NanoBanana_模板
使用 Fal.ai 模型(nano-banana、WAN2.2、Veo3)从 Google Sheets 生成 UGC 广告
If
Set
Code
+13
36 节点Jaruphat J.
内容创作