AI 视频虚拟人生成器:将 URL 转换为短视频(使用免费层 API)
高级
这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 33 个节点。主要使用 If, Set, Wait, HttpRequest, ManualTrigger 等节点。 使用 HeyGen、Gemini 从 URL 生成 AI 视频虚拟人并上传到社交媒体
前置要求
- •可能需要目标 API 的认证凭证
- •Google Gemini API Key
使用的节点 (33)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "hMKwFuA2SpHciZPi",
"meta": {
"instanceId": "3378b0d68c3b7ebfc71b79896d94e1a044dec38e99a1160aed4e9c323910fbe2"
},
"name": "AI 视频虚拟人生成器:将 URL 转换为短视频(使用免费层 API)",
"tags": [],
"nodes": [
{
"id": "cb527bab-157f-4d35-99b4-fbd7c5f417c2",
"name": "便签 2",
"type": "n8n-nodes-base.stickyNote",
"position": [
16,
0
],
"parameters": {
"width": 1456,
"height": 1312,
"content": "# 此工作流的功能是什么?"
},
"typeVersion": 1
},
{
"id": "f78abf61-600b-4193-9032-9d45d7d3b341",
"name": "便签 10",
"type": "n8n-nodes-base.stickyNote",
"position": [
2592,
1312
],
"parameters": {
"width": 320,
"height": 976,
"content": "# 发布到所有社交网络"
},
"typeVersion": 1
},
{
"id": "215fadb8-11a8-4b4f-b03a-e83aa95ba242",
"name": "便签 12",
"type": "n8n-nodes-base.stickyNote",
"position": [
752,
1312
],
"parameters": {
"color": 4,
"width": 1424,
"height": 980,
"content": "# 创建视频"
},
"typeVersion": 1
},
{
"id": "80162c87-a425-4c1e-afa5-8d70d6444741",
"name": "便签 13",
"type": "n8n-nodes-base.stickyNote",
"position": [
-352,
1616
],
"parameters": {
"color": 3,
"width": 182,
"height": 116,
"content": "背景移除需要 HeyGen API 付费计划并在变量 background_removal 中设置为 true"
},
"typeVersion": 1
},
{
"id": "bc5e241b-12e0-42c6-87e0-a0cdccc5da26",
"name": "条件判断",
"type": "n8n-nodes-base.if",
"position": [
960,
1728
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "73001c6b-fae2-48cd-b0a6-aa453b837902",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $('Set Input Vars').item.json.background_removal }}",
"rightValue": ""
}
]
},
"looseTypeValidation": true
},
"typeVersion": 2.2
},
{
"id": "3c04645d-07cd-44af-99b9-2966012f6c30",
"name": "等待",
"type": "n8n-nodes-base.wait",
"position": [
1568,
1728
],
"webhookId": "d9404622-0a06-4a65-959e-badd4fd87465",
"parameters": {
"unit": "minutes",
"amount": 1
},
"typeVersion": 1.1,
"alwaysOutputData": false
},
{
"id": "46355a71-eb04-4d75-9481-e15326c822bb",
"name": "获取虚拟人视频",
"type": "n8n-nodes-base.httpRequest",
"position": [
1728,
1728
],
"parameters": {
"url": "https://api.heygen.com/v1/video_status.get",
"options": {},
"sendQuery": true,
"sendHeaders": true,
"queryParameters": {
"parameters": [
{
"name": "video_id",
"value": "={{ $('Edit Fields').item.json.video_id }}"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "X-Api-Key",
"value": "={{ $('Set Input Vars').item.json.heygen_api_key }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "88a88640-f116-4380-b1bd-075ec2ff0980",
"name": "如果视频完成",
"type": "n8n-nodes-base.if",
"position": [
1888,
1728
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "e511deb8-8e4c-45db-aa35-18f43a0552b6",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Get Avatar Video').item.json.data.status }}",
"rightValue": "completed"
}
]
},
"looseTypeValidation": true
},
"typeVersion": 2.2
},
{
"id": "fce8f9bc-e6fd-413a-9381-29b1b5ad646d",
"name": "Social Media Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-96,
1744
],
"parameters": {
"text": "=# Role & Persona\nEres Creador experto de contenido short-form y Evangelista de n8n. Tono cercano, builder, práctico, con un punto nerd simpático. Tu objetivo: contar una historia útil en ~30s basada en **cualquier página web** (noticia, post de blog, documentación o workflow de n8n) y animar a quienes te ven a probarlo o quedarse con la idea clave.\n\n# Contexto de Producción del Vídeo\n- De fondo se mostrará **la propia web** (la URL analizada) haciendo **scroll vertical** por secciones relevantes.\n- En primer plano, **mi avatar (HeyGen)** habla el guion en una ventana inferior.\n- El guion debe ser **solo texto** (sin acotaciones, efectos ni notas, ni saltos de linea ni emotes), óptimo para TTS de HeyGen.\n\n# Fuente de Verdad (HTTP Request + Análisis Único)\n1) **URL a analizar (cualquier contenido):** `{{ $json.workflow_url }}`\n2) **Descarga el HTML** (HTTP GET) y analiza:\n - **Idea/Problema/Hecho principal** que comunica la página.\n - **Resultado/beneficio/impacto** para el usuario.\n - **Detalles y datos** relevantes (fechas, cifras, comparativas, quotes).\n - **Tecnologías/nodos/servicios** si se trata de un workflow de n8n (por ejemplo OpenAI, Google Sheets, APIs, etc.).\n3) **imageUrl (imagen representativa de la página):**\n - Primero busca `<meta property=\"og:image\" content=\"...\">`.\n - Si el contenido es un workflow, intenta que la imagen sea el **diagrama** (nodos y conexiones). Si el og:image no sirve:\n - Recorre `<img>` y elige la imagen principal del contenido (pistas: `workflow`, `diagram`, `template`, `graph`, o la imagen más central/grande del artículo).\n - Si no hay una imagen adecuada, usa `imageUrl: \"\"`.\n\n# Requisitos del Guion (30s, un único guion para todas las plataformas)\n- **Idioma:** Español (España), natural y directo.\n- **Nivel de lectura:** ~6º de primaria (frases cortas, vocabulario claro).\n- **Hook inicial (2–3s):** crea una **curiosity gap** irresistible (≤ 12 palabras si puedes).\n- **Estructura:** Problema/Hecho → Contexto/Solución → Ejemplo/Impacto → **CTA**.\n- **Datos**: incluye **detalles y estadísticas** concretas si están en la página; si es workflow, menciona **nodos/servicios** clave sin aburrir.\n- **CTA final del estilo (HeyGen/TTS) Solo si es un workflow de n8n :** “Sigueme y Comenta la palabra workflow y te lo mando por mensaje privado”\n- **sin Emojis, texto plano.\n- **Sin enlaces crudos** en el guion (usa “link en bio/comentarios” si aplica).\n- **Sin acotaciones** de escena o efectos (texto plano para TTS).\n- Texto plano porque se lo pasamos luego a elevenlabs para que hable\n\n# Regla de Autor\n- Si el autor es Carlos Gracia o Juan Carlos Cavero Gracia , redacta en primera persona; si no, en tercera persona.\n\n# Caption SEO (acompaña el vídeo)\n- Redacta una **caption optimizada SEO** en español que:\n - Resuma el tema con claridad.\n - Añada **2–3 bullets** tipo FAQs/puntos clave.\n - Use **hasta 5 hashtags** relevantes y específicos.\n\n# Título Viral (muy corto)\n- Escribe **1 frase viral** (máx. **8 palabras**), nivel 6º de primaria, **neutral**, **sin emojis** y sin puntuación salvo `?` o `!`.\n\n# Descripciones por Plataforma (Short-form orgánico)\nGenera **descripciones específicas por plataforma** para el **mismo guion**:\n- **TikTok:** 1–2 frases + 3–5 hashtags. (≈ 200–300 caracteres)\n- **Instagram Reels:** 2–3 frases + 5–7 hashtags (#n8n #Automatización #NoCode #API #Productividad + específicas). (≈ 400–600 caracteres)\n- **YouTube Shorts:** muy corta, 1 frase + 2–3 hashtags. (≈ 120–160 caracteres)\n\n# Formatos de Salida (JSON ESTRICTO)\nDevuelve **4 bloques JSON** separados, sin arrays, uno por línea, sin comas finales:\n\n1) **TikTok** (guion común + descripción adaptada, usa imageUrl si procede):\n{\"platform\":\"tiktok\",\"guion\":\"GUION_COMUN_EN_ESPANOL_30S\",\"descripcion\":\"DESCRIPCION_TIKTOK\",\"imageUrl\":\"IMAGE_URL_AQUI\"}\n\n2) **Instagram**:\n{\"platform\":\"instagram\",\"guion\":\"GUION_COMUN_EN_ESPANOL_30S\",\"descripcion\":\"DESCRIPCION_INSTAGRAM\",\"imageUrl\":\"IMAGE_URL_AQUI\"}\n\n3) **YouTube Shorts**:\n{\"platform\":\"youtube_shorts\",\"guion\":\"GUION_COMUN_EN_ESPANOL_30S\",\"descripcion\":\"TITULO_YOUTUBE_SHORTS_MUY_CORTO_MAX_100_CARACTERES\",\"imageUrl\":\"IMAGE_URL_AQUI\"}\n\n4) **Bundle para Avatar (HeyGen/TTS)**:\n{\n \"script\": \"Monologue script (solo texto, ~30s, nivel 6º primaria, curiosity gap al inicio, datos si existen, y que me sigan\",\n \"caption\": \"Caption SEO en español (máx. 5 hashtags)\",\n \"title\": \"Frase viral corta (≤ 8 palabras, sin emojis, sin puntuación salvo ? o !)\"\n}\n\n# Reglas de Estilo y Contenido (recordatorio)\n- Nada de relleno (“en este video te voy a…”): ve **al grano**.\n- Hashtags **relevantes** y **limitados**.\n- Mantén **coherencia** con el contenido real de la página analizada.\n- Si la URL no carga o es ambigua, genera un guion verosímil según título y primeros textos; en descripciones sugiere “revisar enlace en bio/comentarios” (sin romper el JSON).\n\n# Checklist antes de devolver\n- [ ] Hook potente en 2–3s con curiosity gap.\n- [ ] Problema/Hecho → Contexto/Solución → Ejemplo/Impacto → CTA en ≤ 30s.\n- [ ] Nivel 6º primaria; datos concretos si existen.\n- [ ] Máx. 2 emojis en guion común; texto plano para TTS.\n- [ ] 3 objetos para plataformas + 1 bundle para avatar.\n- [ ] imageUrl válida (og:image o imagen principal); si no, \"\".\n",
"options": {},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.6
},
{
"id": "e4091cc4-1a5f-45bd-b375-07e2ef8aef84",
"name": "Google Gemini聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
-96,
1952
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"id": "JQq5JRn9RAWcdBI6",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "69564190-cffe-46d1-ab1f-5cf26a5a4358",
"name": "HTTP请求1",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
32,
2064
],
"parameters": {
"url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', ``, 'string') }}",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "c0f17447-0722-42b8-90ad-c55d31317d35",
"name": "结构化输出解析器",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
144,
1952
],
"parameters": {
"autoFix": true,
"jsonSchemaExample": "[\n {\n \"platform\": \"tiktok\",\n \"guion\": \"GUION_COMUN_EN_ESPANOL_30S\",\n \"descripcion\": \"DESCRIPCION_TIKTOK_CORTA_CON_3_A_5_HASHTAGS\",\n \"imageUrl\": \"optional_image_url\"\n },\n {\n \"platform\": \"instagram\",\n \"guion\": \"GUION_COMUN_EN_ESPANOL_30S\",\n \"descripcion\": \"DESCRIPCION_INSTAGRAM_MEDIA_CON_5_A_7_HASHTAGS\",\n \"imageUrl\": \"optional_image_url\"\n },\n {\n \"platform\": \"youtube_shorts\",\n \"guion\": \"GUION_COMUN_EN_ESPANOL_30S\",\n \"descripcion\": \"TITULO_YOUTUBE_SHORTS_MUY_CORTO_MAX_100_CARACTERES\",\n \"imageUrl\": \"optional_image_url\"\n }\n]\n"
},
"typeVersion": 1.2
},
{
"id": "b0a5bd0b-29cf-4164-ba28-3b09bc3ea0fa",
"name": "Google Gemini 聊天模型1",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
144,
2080
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"id": "Pz5rkKL1ZRGrSYoQ",
"name": "key studio google"
}
},
"typeVersion": 1
},
{
"id": "1494f8b9-c3c2-4bdc-b3bf-47052c5c44d6",
"name": "当点击\"执行工作流\"时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-512,
1744
],
"parameters": {},
"typeVersion": 1
},
{
"id": "0818d1ad-6f81-4610-903f-072d12c4b6ec",
"name": "创建带背景移除的虚拟人视频",
"type": "n8n-nodes-base.httpRequest",
"position": [
1152,
1600
],
"parameters": {
"url": "https://api.heygen.com/v2/video/generate",
"method": "POST",
"options": {},
"jsonBody": "={\n \"video_inputs\": [\n {\n \"character\": {\n \"type\": \"avatar\",\n \"avatar_id\": \"{{ $('Set Input Vars').item.json.avatar_id }}\",\n \"avatar_style\": \"normal\",\n \"scale\": 1,\n \"offset\": { \n \"x\": 0.15,\n \"y\": 0.15 \n },\n \"matting\": true\n },\n \"voice\": {\n \"type\": \"text\",\n \"input_text\": \"{{ $('Social Media Agent').item.json.output[0].guion }}\",\n \"voice_id\": \"{{ $('Set Input Vars').item.json.voice_id }}\",\n \"speed\": 1.1,\n \"pitch\": 50,\n \"emotion\": \"Excited\"\n },\n \"background\": {\n \"type\": \"video\",\n \"url\": \"{{ $('upload to heygen').item.json.data.url }}\",\n \"play_style\": \"loop\",\n \"fit\": \"cover\"\n }\n }\n ],\n \"dimension\": { \"width\": 720, \"height\": 1280 },\n \"aspect_ratio\": \"9:16\",\n \"caption\": false,\n \"title\": \"n8n-avatar\"\n}\n",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "X-Api-Key",
"value": "={{ $('Set Input Vars').item.json.heygen_api_key }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "09adca22-c5b5-4961-903e-bf188c070299",
"name": "创建分屏虚拟人视频(HeyGen 免费试用 API)",
"type": "n8n-nodes-base.httpRequest",
"position": [
1152,
1760
],
"parameters": {
"url": "https://api.heygen.com/v2/video/generate",
"method": "POST",
"options": {},
"jsonBody": "={\n \"video_inputs\": [\n {\n \"character\": {\n \"type\": \"avatar\",\n \"avatar_id\": \"{{ $('Set Input Vars').item.json.avatar_id }}\",\n \"avatar_style\": \"normal\",\n \"scale\": 1.8,\n \"offset\": { \n \"x\": 0.0,\n \"y\": 0.32 \n }\n },\n \"voice\": {\n \"type\": \"text\",\n \"input_text\": \"{{ $('Social Media Agent').item.json.output[0].guion }}\",\n \"voice_id\": \"{{ $('Set Input Vars').item.json.voice_id }}\",\n \"speed\": 1.1,\n \"pitch\": 50,\n \"emotion\": \"Excited\"\n },\n \"background\": {\n \"type\": \"video\",\n \"url\": \"{{ $('upload to heygen').item.json.data.url }}\",\n \"play_style\": \"loop\",\n \"fit\": \"cover\"\n }\n }\n ],\n \"dimension\": { \"width\": 720, \"height\": 1280 },\n \"aspect_ratio\": \"9:16\",\n \"caption\": false,\n \"title\": \"n8n-avatar\"\n}\n",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "X-Api-Key",
"value": "={{ $('Set Input Vars').item.json.heygen_api_key }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "25f41827-5c1d-404f-a991-81bad08b1f59",
"name": "获取视频 URL",
"type": "n8n-nodes-base.httpRequest",
"position": [
2048,
1712
],
"parameters": {
"url": "https://api.heygen.com/v1/video_status.get",
"options": {},
"sendQuery": true,
"sendHeaders": true,
"queryParameters": {
"parameters": [
{
"name": "video_id",
"value": "={{ $json.data.id }}"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "X-Api-Key",
"value": "={{ $('Set Input Vars').item.json.heygen_api_key }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "75c3909b-b2c9-43fb-982d-4d690e9ca175",
"name": "获取背景视频",
"type": "n8n-nodes-base.httpRequest",
"position": [
528,
1728
],
"parameters": {
"url": "=https://api.screenshotone.com/animate?access_key={{ $('Set Input Vars').item.json.screenshotone.comAPI_KEY }}&url={{ $('Set Input Vars').item.json.workflow_url }}&format=mp4&viewport_width=1080&viewport_height=1920&viewport_mobile=true&block_ads=true&storage_return_location=true&block_cookie_banners=true&block_banners_by_heuristics=false&block_trackers=true&delay=10&timeout=60&scenario=scroll&duration=30&scroll_delay=5000&scroll_duration=200&scroll_by=400&scroll_start_immediately=true&scroll_start_delay=5000&scroll_back=true&scroll_complete=true&scroll_easing=ease_in_out_quint&scroll_try_navigate=false",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "1fa8ee73-6491-4dad-b866-1e38ba3f2d64",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-560,
1312
],
"parameters": {
"color": 6,
"width": 1312,
"height": 980,
"content": "# 生成脚本和背景视频"
},
"typeVersion": 1
},
{
"id": "b4836afa-e601-4433-b170-6815ea329d1b",
"name": "等待 user1 批准",
"type": "n8n-nodes-base.wait",
"position": [
2240,
1712
],
"webhookId": "f8e6054e-44e4-4987-9698-d5befb8b31b6",
"parameters": {
"resume": "form",
"options": {},
"formTitle": "Review the posts ",
"formFields": {
"values": [
{
"fieldType": "dropdown",
"fieldLabel": "decision",
"fieldOptions": {
"values": [
{
"option": "approve"
},
{
"option": "reject"
}
]
},
"requiredField": true
}
]
},
"formDescription": "={{ $json.data.video_url }}"
},
"typeVersion": 1.1
},
{
"id": "73969b0e-8733-43a2-898c-f99435c17153",
"name": "如果已批准则发布1",
"type": "n8n-nodes-base.if",
"position": [
2384,
1712
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "394500db-496d-4c6e-9adb-59f3caead492",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Wait to approve by user1').item.json.decision }}",
"rightValue": "=approve"
}
]
},
"looseTypeValidation": "=true"
},
"typeVersion": 2.2
},
{
"id": "b5cffd1b-8599-44ba-ba48-a41f9d7b8779",
"name": "便签11",
"type": "n8n-nodes-base.stickyNote",
"position": [
2176,
1312
],
"parameters": {
"color": 7,
"width": 416,
"height": 976,
"content": "# 人工批准以上传到社交网络"
},
"typeVersion": 1
},
{
"id": "d12ee22c-486d-44c0-9d3f-d94c3ece5643",
"name": "上传视频到所有社交网络",
"type": "n8n-nodes-upload-post.uploadPost",
"position": [
2688,
1696
],
"parameters": {
"user": "influencersde",
"title": "test",
"video": "={{ $('Get video url').item.json.data.video_url }}",
"platform": [
"instagram",
"tiktok",
"youtube"
],
"operation": "uploadVideo",
"tiktokTitle": "={{ $('Social Media Agent').item.json.output[0].descripcion }}",
"youtubeTitle": "={{ $('Social Media Agent').item.json.output[2].descripcion }}",
"instagramTitle": "={{ $('Social Media Agent').item.json.output[1].descripcion }}",
"instagramMediaType": "REELS"
},
"credentials": {
"uploadPostApi": {
"id": "mREXP5Q3Gj5dS52e",
"name": "Smoker"
}
},
"typeVersion": 1
},
{
"id": "9acf058b-0173-4c57-b505-764e39ae38d9",
"name": "便签 3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1472,
288
],
"parameters": {
"width": 912,
"height": 1024,
"content": "## 设置"
},
"typeVersion": 1
},
{
"id": "66f4022f-bdb7-4e7c-85b5-a549887f875a",
"name": "获取背景图片",
"type": "n8n-nodes-base.httpRequest",
"position": [
528,
2112
],
"parameters": {
"url": "=https://api.screenshotone.com/take?access_key={{ $('Set Input Vars').item.json.screenshotone.comAPI_KEY }}&url={{ $('Set Input Vars').item.json.workflow_url }}&viewport_width=1080&viewport_height=1920&viewport_mobile=false&format=jpg&block_ads=true&block_cookie_banners=true&block_banners_by_heuristics=false&block_trackers=true&delay=10&timeout=60&response_type=json&image_quality=80",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "30727b8b-42b2-4d9c-8ae4-d7469071d861",
"name": "条件判断1",
"type": "n8n-nodes-base.if",
"position": [
832,
2112
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "73001c6b-fae2-48cd-b0a6-aa453b837902",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.background_removal }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "2e1f0985-7148-4f92-836c-5c3584d0595f",
"name": "创建带背景移除的虚拟人视频1",
"type": "n8n-nodes-base.httpRequest",
"position": [
1152,
1952
],
"parameters": {
"url": "https://api.heygen.com/v2/video/generate",
"method": "POST",
"options": {},
"jsonBody": "={\n \"video_inputs\": [\n {\n \"character\": {\n \"type\": \"avatar\",\n \"avatar_id\": \"{{ $('Set Input Vars').item.json.avatar_id }}\",\n \"avatar_style\": \"normal\",\n \"scale\": 1,\n \"offset\": { \n \"x\": 0.15,\n \"y\": 0.15 \n },\n \"matting\": true\n },\n \"voice\": {\n \"type\": \"text\",\n \"input_text\": \"{{ $('Social Media Agent').item.json.output[0].guion }}\",\n \"voice_id\": \"{{ $('Set Input Vars').item.json.voice_id }}\",\n \"speed\": 1.1,\n \"pitch\": 50,\n \"emotion\": \"Excited\"\n },\n \"background\": {\n \"type\": \"image\",\n \"url\": \"{{ $('Get background photo').item.json.screenshot_url }}\",\n \"fit\": \"cover\"\n }\n }\n ],\n \"dimension\": { \"width\": 720, \"height\": 1280 },\n \"aspect_ratio\": \"9:16\",\n \"caption\": false,\n \"title\": \"n8n-avatar\"\n}\n",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "X-Api-Key",
"value": "={{ $('Set Input Vars').item.json.heygen_api_key }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "e5966331-cc81-49dc-a783-6ecb46544cb7",
"name": "创建分屏虚拟人视频(HeyGen 免费试用 API)1",
"type": "n8n-nodes-base.httpRequest",
"position": [
1152,
2128
],
"parameters": {
"url": "https://api.heygen.com/v2/video/generate",
"method": "POST",
"options": {},
"jsonBody": "={\n \"video_inputs\": [\n {\n \"character\": {\n \"type\": \"avatar\",\n \"avatar_id\": \"{{ $('Set Input Vars').item.json.avatar_id }}\",\n \"avatar_style\": \"normal\",\n \"scale\": 1.8,\n \"offset\": { \n \"x\": 0.0,\n \"y\": 0.32 \n }\n },\n \"voice\": {\n \"type\": \"text\",\n \"input_text\": \"{{ $('Social Media Agent').item.json.output[0].guion }}\",\n \"voice_id\": \"{{ $('Set Input Vars').item.json.voice_id }}\",\n \"speed\": 1.1,\n \"pitch\": 50,\n \"emotion\": \"Excited\"\n },\n \"background\": {\n \"type\": \"photo\",\n \"url\": \"{{ $('Get background photo').item.json.screenshot }}\",\n \"play_style\": \"loop\",\n \"fit\": \"cover\"\n }\n }\n ],\n \"dimension\": { \"width\": 720, \"height\": 1280 },\n \"aspect_ratio\": \"9:16\",\n \"caption\": false,\n \"title\": \"n8n-avatar\"\n}\n",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "X-Api-Key",
"value": "={{ $('Set Input Vars').item.json.heygen_api_key }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "4708c3d1-2135-46f8-9b97-ee09d32acdac",
"name": "设置输入变量",
"type": "n8n-nodes-base.set",
"position": [
-320,
1744
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "ab234870-d90d-4b54-8916-5084080e1ad8",
"name": "workflow_url",
"type": "string",
"value": "https://www.xataka.com/empresas-y-economia/openai-acaba-mover-ficha-su-separacion-bienes-microsoft-ha-firmado-acuerdo-amazon-38-000-millones-dolares"
},
{
"id": "6268ce66-0e20-4461-a2fa-cb6e53a8cd0c",
"name": "screenshotone.comAPI_KEY",
"type": "string",
"value": ""
},
{
"id": "d8870ebc-338f-4f0c-8c87-830eed637e8d",
"name": "heygen_api_key",
"type": "string",
"value": ""
},
{
"id": "ebf525fe-abd2-47cd-8d80-2e0897674dc8",
"name": "avatar_id",
"type": "string",
"value": ""
},
{
"id": "5ca261cc-aa2c-4f30-8ff7-0605133ca201",
"name": "voice_id",
"type": "string",
"value": ""
},
{
"id": "95a9fd9f-a88c-408a-a8e6-5daee5c6eb5f",
"name": "background_removal",
"type": "string",
"value": "true"
},
{
"id": "a6542328-c98b-4048-8f49-f4c638df472f",
"name": "background_type",
"type": "string",
"value": "video"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "7c88a824-7f60-4449-a813-73cfe61aa38b",
"name": "视频或图片",
"type": "n8n-nodes-base.if",
"position": [
272,
1744
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "394500db-496d-4c6e-9adb-59f3caead492",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Set Input Vars').item.json.background_type }}",
"rightValue": "=video"
}
]
},
"looseTypeValidation": "=true"
},
"typeVersion": 2.2
},
{
"id": "e6f67531-4c53-4c07-a22a-ad273b6c60b9",
"name": "上传到 HeyGen",
"type": "n8n-nodes-base.httpRequest",
"position": [
784,
1728
],
"parameters": {
"url": "https://upload.heygen.com/v1/asset",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "binaryData",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "X-Api-Key",
"value": "={{ $('Set Input Vars').item.json.heygen_api_key }}"
},
{
"name": "Content-Type",
"value": "video/mp4"
}
]
},
"inputDataFieldName": "data"
},
"typeVersion": 4.3
},
{
"id": "22905c42-80f2-4083-9b69-27997cdb39ae",
"name": "编辑字段",
"type": "n8n-nodes-base.set",
"position": [
1392,
1728
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "ac5899dd-52f6-48bb-981e-9cb60696e461",
"name": "video_id",
"type": "string",
"value": "={{ $json.data.video_id }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "47fe8c3d-d35c-4345-ac71-9bd77db0077e",
"name": "便签 1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-576,
576
],
"parameters": {
"width": 512,
"height": 416,
"content": "## 视频演示"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {
"When clicking ‘Execute workflow’": [
{
"json": {}
}
]
},
"settings": {
"executionOrder": "v1"
},
"versionId": "8702639d-ba3a-49dd-8879-20ac330199e3",
"connections": {
"If": {
"main": [
[
{
"node": "Create video avatar with background removal",
"type": "main",
"index": 0
}
],
[
{
"node": "Create video avatar with split screen (heygen free trial api)",
"type": "main",
"index": 0
}
]
]
},
"If1": {
"main": [
[
{
"node": "Create video avatar with background removal1",
"type": "main",
"index": 0
}
],
[
{
"node": "Create video avatar with split screen (heygen free trial api)1",
"type": "main",
"index": 0
}
]
]
},
"Wait": {
"main": [
[
{
"node": "Get Avatar Video",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields": {
"main": [
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"Get video url": {
"main": [
[
{
"node": "Wait to approve by user1",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request1": {
"ai_tool": [
[
{
"node": "Social Media Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"If Video Done": {
"main": [
[
{
"node": "Get video url",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"Set Input Vars": {
"main": [
[
{
"node": "Social Media Agent",
"type": "main",
"index": 0
}
]
]
},
"video or photo": {
"main": [
[
{
"node": "Get background video",
"type": "main",
"index": 0
}
],
[
{
"node": "Get background photo",
"type": "main",
"index": 0
}
]
]
},
"Get Avatar Video": {
"main": [
[
{
"node": "If Video Done",
"type": "main",
"index": 0
}
]
]
},
"upload to heygen": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Social Media Agent": {
"main": [
[
{
"node": "video or photo",
"type": "main",
"index": 0
}
]
]
},
"Get background photo": {
"main": [
[
{
"node": "If1",
"type": "main",
"index": 0
}
]
]
},
"Get background video": {
"main": [
[
{
"node": "upload to heygen",
"type": "main",
"index": 0
}
]
]
},
"If approved publish1": {
"main": [
[
{
"node": "Upload video to all social networks",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "Social Media Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "Social Media Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Wait to approve by user1": {
"main": [
[
{
"node": "If approved publish1",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model1": {
"ai_languageModel": [
[
{
"node": "Structured Output Parser",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Set Input Vars",
"type": "main",
"index": 0
}
]
]
},
"Create video avatar with background removal": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"Create video avatar with background removal1": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"Create video avatar with split screen (heygen free trial api)": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"Create video avatar with split screen (heygen free trial api)1": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 内容创作, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
从图像生成广告
使用 Gemini 2.5 Flash 图片和 FAL WAN 动画生成视频广告
If
Set
Code
+11
61 节点Juan Carlos Cavero Gracia
内容创作
使用 Gemini AI 将任意网页文章转为自动发布的社交媒体帖子
使用 Gemini AI 将网页文章自动发布为 X、LinkedIn、Reddit 和 Threads 的社交帖子
If
Set
Wait
+7
12 节点Juan Carlos Cavero Gracia
社交媒体
长视频转换为病毒式短视频(AI 处理并定时发布到社交媒体)
使用 Whisper 和 Gemini 将长视频转换为病毒式短视频并定时发布到社交媒体
If
Code
Wait
+6
26 节点Juan Carlos Cavero Gracia
内容创作
使用OpenAI Whisper和Gemini将Telegram内容转换为多平台帖子
使用OpenAI Whisper和Gemini将Telegram内容转换为多平台帖子
If
Set
Switch
+10
63 节点Juan Carlos Cavero Gracia
内容创作
LinkedIn和X病毒内容自动引擎
使用AI生成和发布自动创建LinkedIn和X的病毒内容
If
Set
Wait
+26
156 节点Diptamoy Barman
内容创作
基于Gemini AI、Supabase和Nano-Banana的端到端博客创建自动化
使用Gemini AI、Supabase和Nano-Banana实现端到端博客创建自动化
If
Set
Code
+16
51 节点Muhammad Asadullah
内容创作
工作流信息
难度等级
高级
节点数量33
分类2
节点类型11
作者
Juan Carlos Cavero Gracia
@carlosgraciaFollow me in linkedin: https://www.linkedin.com/in/juan-carlos-cavero-gracia/
外部链接
在 n8n.io 查看 →
分享此工作流