8
n8n 中文网amn8n.com

使用 Nano Banana 和 Veo-3 从 Telegram 消息生成 AI 视频

高级

这是一个Content Creation, Miscellaneous, Multimodal AI领域的自动化工作流,包含 26 个节点。主要使用 If, Set, Wait, Switch, Telegram 等节点。 使用 Nano Banana 和 Veo-3 从 Telegram 消息生成 AI 视频

前置要求
  • Telegram Bot Token
  • 可能需要目标 API 的认证凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "40f29e455b10b3ef07629363459d0fa6954887d44ddad18e74a5539a487f2eee",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "b45ea84d-14ac-4b59-bb49-c15b148fa2c7",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        -2528,
        1312
      ],
      "webhookId": "b28958ca-679e-45b7-9d3f-700ad1d7efca",
      "parameters": {
        "amount": 120
      },
      "typeVersion": 1.1
    },
    {
      "id": "778a1aca-ab5b-40b6-8f2a-26a3c5688f21",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -3248,
        728
      ],
      "webhookId": "aaaeffac-416c-4e75-acf6-c6b47ef7e900",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {
          "download": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "8pD7plzlR8HqP5y3",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "af683b31-52f5-4b6a-9d8b-073b33136ee8",
      "name": "Image Gen (Nano Banana)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1776,
        736
      ],
      "parameters": {
        "url": "https://api.kie.ai/api/v1/playground/createTask",
        "method": "POST",
        "options": {
          "timeout": 30000
        },
        "jsonBody": "={\n  \"model\": \"google/nano-banana\",\n  \n  \"input\": {\n    \"prompt\":\"{{ $json.output.promptImage }}\",\n    \"output_format\":\"png\"\n  \n  }\n} ",
        "sendBody": true,
        "sendQuery": true,
        "specifyBody": "json",
        "queryParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer ---"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "5348286b-8213-41d0-962d-998f0737f491",
      "name": "Telegram: Send Photo",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -672,
        720
      ],
      "webhookId": "0fd6a8ef-5c73-4d29-b13b-c359d36717d2",
      "parameters": {
        "chatId": "=8388894079",
        "operation": "sendPhoto",
        "binaryData": true,
        "additionalFields": {
          "caption": "✅ Thumbnail generated. Video is rendering..."
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "8pD7plzlR8HqP5y3",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f54bb79f-6f71-43df-8229-56ef95558f35",
      "name": "Telegram: Send Video",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1632,
        1312
      ],
      "webhookId": "a572d30a-40e0-4c48-bc65-a191ec912dbe",
      "parameters": {
        "chatId": "=8388894079",
        "operation": "sendVideo",
        "binaryData": true,
        "additionalFields": {
          "caption": "=🎬 Here is your Veo-3 video ({{ $json.duration }}s)"
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "8pD7plzlR8HqP5y3",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c1dfa4a0-99e5-45f6-9ba7-065bf87da981",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        -3024,
        728
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "audio",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "08e57aab-c6bc-4a79-be51-3ed4824b097c",
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message.voice.mime_type }}",
                    "rightValue": "audio"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "text",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "0b1fc9e6-dd17-4489-a54f-d0eaf57fbd09",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.message.text }}",
                    "rightValue": "text"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "adb2cf39-adfd-465d-8aa2-ab02acce0c57",
      "name": "Transcribe a recording",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -2576,
        632
      ],
      "parameters": {
        "options": {},
        "resource": "audio",
        "operation": "transcribe"
      },
      "credentials": {
        "openAiApi": {
          "id": "PSTSahlOuVJnUXOA",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "2d0a4beb-61be-41b4-9013-e4a8b97430bc",
      "name": "Transcribed Audio",
      "type": "n8n-nodes-base.set",
      "position": [
        -2352,
        632
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "1d47bc09-7b06-4248-b897-b91292c9938e",
              "name": "text",
              "type": "string",
              "value": "={{ $json.text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c64b8143-194a-44aa-94f9-1ce915cecc94",
      "name": "Text Message",
      "type": "n8n-nodes-base.set",
      "position": [
        -2352,
        824
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "1d47bc09-7b06-4248-b897-b91292c9938e",
              "name": "text",
              "type": "string",
              "value": ""
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "43dd7fe4-fc18-414b-b6a2-09055dcc868e",
      "name": "Download Audio1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -2800,
        632
      ],
      "webhookId": "843d5959-731c-4f46-91e5-48b2004db9c1",
      "parameters": {
        "fileId": "={{ $json.message.voice.file_id }}",
        "resource": "file",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "8pD7plzlR8HqP5y3",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "76cfbf6d-d8a1-4021-a628-dfa70a776382",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -2128,
        624
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "options": {
          "systemMessage": "You are a helpful assistant\nand promopt creator for an Image and a 8 second video based on the input in the user prompt:\n\nexampleoutput\n{\n  \"promptImage\": \"Minimal surreal hourglass on black mirror floor, golden reflections, 9:16\",\n  \"promptVideo\": \"Cinematic pan around a surreal glass hourglass, reflections, sand flows both ways, 12s, 9:16\"\n}"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "d62f235a-a587-4bd3-8af4-ad6a3f8ee935",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -2128,
        832
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "PSTSahlOuVJnUXOA",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7fae697c-bc24-4513-9bbd-9d0cab8414fb",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -1984,
        800
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"promptImage\": \"Minimal surreal hourglass on black mirror floor, golden reflections, 9:16\",\n  \"promptVideo\": \"Cinematic pan around a surreal glass hourglass, reflections, sand flows both ways, 12s, 9:16\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "e0117af9-9d78-4bd3-b946-0bac95b88cac",
      "name": "Wait1",
      "type": "n8n-nodes-base.wait",
      "position": [
        -1552,
        728
      ],
      "webhookId": "b28958ca-679e-45b7-9d3f-700ad1d7efca",
      "parameters": {
        "amount": 12
      },
      "typeVersion": 1.1
    },
    {
      "id": "34ddc5e0-0108-4e4a-b2b7-e8be3629d9e2",
      "name": "Get Image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1328,
        656
      ],
      "parameters": {
        "url": "=https://api.kie.ai/api/v1/playground/recordInfo",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "taskId",
              "value": "={{ $json.data.taskId }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer---"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "548d27da-2049-4438-9ec3-0ae840d8be4b",
      "name": "Image created",
      "type": "n8n-nodes-base.if",
      "position": [
        -1104,
        728
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "7fe03071-d271-49ec-a1f2-99ede89dccbb",
              "operator": {
                "type": "number",
                "operation": "equals"
              },
              "leftValue": "={{ $json.code }}",
              "rightValue": 200
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "ab874839-5b4a-4d9b-98de-392aaa4b9f5f",
      "name": "Download Image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -896,
        832
      ],
      "parameters": {
        "url": "={{ $json.data.result_url }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "d2545c6e-18ac-45d1-8eb7-903e7b70a6b5",
      "name": "Download Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1856,
        1312
      ],
      "parameters": {
        "url": "={{ $json.data.result_url }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "b39785b1-4599-4286-9adb-16653684393b",
      "name": "Get Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2304,
        1248
      ],
      "parameters": {
        "url": "https://api.kie.ai/api/v1/veo/get-1080p-video",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "taskId",
              "value": "={{ $('Generate Video').item.json.data.taskId }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer ----"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "ee07e63f-03a6-403c-b755-74d92237f303",
      "name": "Generate Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2752,
        1312
      ],
      "parameters": {
        "url": "https://api.kie.ai/api/v1/veo/generate",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"prompt\": \"{{ $('AI Agent').item.json.output.promptVideo }}\",\n \n  \"model\": \"veo3_fast\",\n  \n  \"callBackUrl\": \"http://localhost:5678/webhook/4ff60479-681c-437b-8891-4edf2f8b9559\",\n  \"aspectRatio\": \"16:9\",\n  \"seeds\": 12345,\n  \"enableFallback\": false\n} ",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer ---"
            },
            {
              "name": "Conent-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "844d7072-9b9e-40e3-b66f-15b47097aef8",
      "name": "Video created",
      "type": "n8n-nodes-base.if",
      "position": [
        -2080,
        1312
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "7fe03071-d271-49ec-a1f2-99ede89dccbb",
              "operator": {
                "type": "number",
                "operation": "equals"
              },
              "leftValue": "={{ $json.code }}",
              "rightValue": 200
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "596756e2-0cc5-49b9-a0f4-dbc8304ed20a",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3424,
        448
      ],
      "parameters": {
        "width": 368,
        "height": 576,
        "content": "## Trigger when the Bot gets a Text message or audio message"
      },
      "typeVersion": 1
    },
    {
      "id": "fa91822f-5393-43a1-9d20-c82ee7c269fa",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3040,
        448
      ],
      "parameters": {
        "width": 832,
        "height": 576,
        "content": "## Get the Text Message or transcribe the audio"
      },
      "typeVersion": 1
    },
    {
      "id": "918d8b10-9184-4a68-bcd1-21aed6c5768c",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2192,
        448
      ],
      "parameters": {
        "width": 336,
        "height": 576,
        "content": "## Prompt Generation for Video and Image"
      },
      "typeVersion": 1
    },
    {
      "id": "e64f9367-4f14-4da6-8864-57525ae04bee",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1840,
        448
      ],
      "parameters": {
        "width": 1072,
        "height": 576,
        "content": "## Image Generation"
      },
      "typeVersion": 1
    },
    {
      "id": "ba314a4e-f424-4800-8e1c-8077947d3e11",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2896,
        1152
      ],
      "parameters": {
        "width": 1488,
        "height": 384,
        "content": "## Generate Video"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {
    "AI Agent": [
      {
        "output": {
          "promptImage": "Abstract test pattern with numbers 1, 2, 3, vibrant colors, 16:9",
          "promptVideo": "Smooth animation counting 1, 2, 3 with vibrant colors, dynamic background, 8s, 16:9"
        }
      }
    ],
    "Transcribe a recording": [
      {
        "text": "Test 1, 2, 3",
        "usage": {
          "type": "duration",
          "seconds": 2
        }
      }
    ]
  },
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Get Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "Get Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Download Audio1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Text Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Image Gen (Nano Banana)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Image": {
      "main": [
        [
          {
            "node": "Image created",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Video": {
      "main": [
        [
          {
            "node": "Video created",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Text Message": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Image created": {
      "main": [
        [
          {
            "node": "Download Image",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Video created": {
      "main": [
        [
          {
            "node": "Download Video",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Image": {
      "main": [
        [
          {
            "node": "Telegram: Send Photo",
            "type": "main",
            "index": 0
          },
          {
            "node": "Generate Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Video": {
      "main": [
        [
          {
            "node": "Telegram: Send Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Video": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Audio1": {
      "main": [
        [
          {
            "node": "Transcribe a recording",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Transcribed Audio": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe a recording": {
      "main": [
        [
          {
            "node": "Transcribed Audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Image Gen (Nano Banana)": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 内容创作, 杂项, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量26
分类3
节点类型12
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Sulieman Said

Sulieman Said

@sulieman-said

👋 Hi, I’m Sulieman – Founder of aufCopilot.de . I build custom n8n workflows, automations & AI integrations to help businesses save time and scale smarter. I share templates, answer questions and love exploring creative use cases – from lead generation to data workflows and AI-powered automations. 🚀 Always happy to connect, learn and contribute to the community. Although my profile is in English, I am a native German speaker and happy to work in both German and English projects.

外部链接
在 n8n.io 查看

分享此工作流