用 Telegram 触发,GPT-4 + Kling AI 自动生成并多平台发布社交视频
输入 Telegram 文本 → GPT-4 优化视频提示词 → Kling 生成视频 → 合成语音与字幕 → 自动发布到 9 个社交平台
- 给谁
- 内容创作者、社交媒体运营、营销人员,具备 n8n 自托管环境
- 你会得到
- 发送一条 Telegram 消息,即可自动生成带配音和字幕的短视频,并同步发布到 Instagram、TikTok、YouTube 等 9 个平台
- 你需要
- n8n · telegram · google-sheets · blotato · json2video · cloudinary
硬约束
需要自托管 n8n 实例(社区节点不支持云版)。需准备:Telegram Bot Token、OpenAI API Key、Kling API Key(通过 piapi.ai)、Cloudinary 账号、JSON2Video 账号、Google Sheets OAuth2 凭证、Blotato API Key 及各平台账号 ID。工作流通过 Telegram 消息触发,消息格式为:generate video <视频描述>, <话题/配文主题>。
他们做了什么
作者 drfiras 在 n8n 官方模板库发布了该工作流模板。模板展示了一个端到端自动化:用户从 Telegram 发送一条消息,工作流依次调用 GPT-4 优化提示词、Kling 生成视频、OpenAI TTS 合成语音、JSON2Video 合并音视频并添加字幕、GPT-4 生成标题和社交文案、Google Sheets 记录元数据、Telegram 发送预览,最后通过 Blotato API 并行发布到 Instagram、YouTube、TikTok、Facebook、Threads、Twitter/X、LinkedIn、Bluesky 和 Pinterest。模板包含 38 个节点和完整的连线配置。
效果如何
作者声称该工作流可将一条 Telegram 消息转化为'完全制作完成并发布的社交视频',并提供了 YouTube 演示视频和 Notion 文档链接。模板在 n8n.io 上获得 20,894 次查看(author_report)。本站未实际运行验证。
n8n 工作流模板
结构已检查 · 未实际运行下载后在 n8n 选择“Import from File”,或复制 JSON 后粘贴到编辑器。先配置自己的账号,再用测试数据运行;模板默认未启用。
配置与测试清单
需要绑定的凭证
- Trigger: Telegram Prompt 节点:绑定Telegram API 凭证。
- OpenAI Model Bridge 节点:绑定OpenAI API 凭证。
- Generate Video via Kling API 节点:绑定HTTP Header Auth 凭证。
- Get Generated Video URL 节点:绑定HTTP Header Auth 凭证。
- Generate Voice-Over Script 节点:绑定OpenAI API 凭证。
- Convert Script to Audio (TTS) 节点:绑定OpenAI API 凭证。
- Upload Audio to Cloudinary 节点:绑定HTTP Basic Auth 凭证。
- Merge Audio + Video 节点:绑定HTTP Basic Auth 凭证。
- Merge Audio + Video 节点:绑定HTTP Header Auth 凭证。
- Get Video URL with Audio 节点:绑定HTTP Header Auth 凭证。
- Add Captions/Subtitles to Video 节点:绑定HTTP Header Auth 凭证。
- Get Final Video URL (Audio + Captions) 节点:绑定HTTP Header Auth 凭证。
- Generate Social Caption from Voiceover 节点:绑定OpenAI API 凭证。
- Generate YouTube-Style Title 节点:绑定OpenAI API 凭证。
- Save Video Metadata to Google Sheets 节点:绑定Google Sheets OAuth2 凭证。
- Send Final Video to Telegram 节点:绑定Telegram API 凭证。
- Send Caption Link via Telegram 节点:绑定Telegram API 凭证。
需要替换的配置
- 源模板来自 n8n 公开库 #3501(约 38 个节点)。导入后先保持未启用,核对触发器、表达式与外部 API 端点。
- Sticky Note 中的说明仅供参考;按自己的账号、表结构或频道 ID 替换占位配置。
测试输入与预期结果
- 在测试环境手动执行一次主路径,确认每个需凭证的节点已连接且无鉴权错误。
- 用一条合成/脱敏样例数据跑通,核对输出字段与下游写入目标,再考虑生产启用。
模板处理说明
- 已移除原作者凭证绑定、webhookId 与执行数据,工作流设为未启用;节点、连线与原文提示词保持原样。未在 n8n 中实际运行。
- 未改业务逻辑;运行前请自行核对密钥、配额与隐私合规。
模板获取日期: 2026-10-24
步骤
生成视频:从 Telegram 提示词到 Kling 视频
在 n8n 中配置 Telegram Trigger 节点接收消息,然后用 Code 节点解析消息:去掉 'generate video' 前缀,按第一个逗号分割为 videoPrompt 和 captionIdea。接着使用 AI Agent 节点(GPT-4)将简短提示词扩展为适合 Kling 的详细场景描述,最后通过 HTTP Request 节点调用 Kling API(https://api.piapi.ai/api/v1/task)生成视频。生成后等待约 7 分钟,再查询任务状态获取视频 URL。
运行提示词 · 来源原文。AI Agent 节点 'Transform Prompt for Kling (GPT-4)' 的 systemMessage 字段
=⚙️ System Instructions – AI Agent: You are a prompt optimization assistant for Kling AI, a cutting-edge text-to-video generation platform. 🎯 Mission: Transform brief user inputs into cinematic, high-quality video prompts rich in sensory details, spatial context, and dynamic motion—perfectly tuned for Kling AI. ✍️ Instructions: Expand short ideas into visually immersive scenes. Use concrete visual elements: colors, textures, lighting, motion, atmosphere, camera angles. Keep descriptions concise but vivid, like a scene from a movie script. Output only the final prompt—no explanations, no formatting tips. 🌟 Examples: User Input: “Rainy street at night” Final Prompt: Neon signs reflect in puddles on a dimly lit city street. Raindrops ripple across a parked motorcycle's chrome. A figure in a trench coat walks past flickering lights as steam rises from a nearby sewer grate. The camera tracks from ground level, capturing water splashing underfoot. User Input: “Mountain hike” Final Prompt: A hiker climbs a rugged mountain trail at sunrise, golden light hitting snow-capped peaks in the distance. Wind rustles through pine trees as birds soar overhead. The camera pans slowly from behind, revealing a vast valley below bathed in morning mist. User Input: “Cozy library” Final Prompt: A warm library room with wooden shelves lined with old books. Dust floats in the sunbeams streaming through tall windows. A cat naps on a leather armchair while a hand flips through a weathered novel. The camera gently rotates around the room, revealing small glowing lamps.
添加配音:生成脚本、TTS 转语音并合并到视频
基于上一步解析出的 captionIdea,使用 GPT-4o 生成一段 7 秒左右的配音脚本(约 18-22 词)。然后通过 OpenAI TTS 将脚本转为音频,上传到 Cloudinary,再用 JSON2Video API 将音频与视频合并。合并后等待约 1 分钟,获取带音频的视频 URL。
运行提示词 · 来源原文。OpenAI 节点 'Generate Voice-Over Script' 的 messages[0].content 字段
=Task: Craft a short-form voice-over script that perfectly fits a 7-second video duration. The script should align with the following topic: {{ $('Extract Prompt & Caption').item.json.captionIdea }} Requirements: Match the average spoken word count for a 7-second voice-over (approximately 18–22 words, depending on pacing). The script must be tight, impactful, and written in a natural spoken tone suitable for narration. No intro text or labels — return only the plain voice-over script with no headers or commentary. ✅ Example (For Context Only): Topic: "Why cold showers boost productivity" Generated Output: Cold showers shock your system awake, boost focus, and kickstart circulation—training your brain to embrace discomfort.添加字幕:用 JSON2Video 为视频叠加样式字幕
等待 30 秒后,调用 JSON2Video API 为带音频的视频添加专业字幕。使用 classic-progressive 样式,字体 Oswald,字号 140,配色为金色文字配深色阴影和边框。提交后等待约 1 分钟渲染,再查询获取最终视频 URL。
保存元数据并通知:生成标题文案、写入表格、Telegram 预览
使用 GPT-4o 基于配音脚本生成社交文案和 YouTube 风格标题(70 字符以内,无特殊字符)。将原始提示词、视频 URL、标题、描述写入 Google Sheets。然后通过 Telegram 发送最终视频和文案链接,供人工确认或复用。
运行提示词 · 来源原文。OpenAI 节点 'Generate Social Caption from Voiceover' 的 messages[0].content 字段
=📲 Prompt: Caption Generator for Voiceover-Based Social Posts Your Role: Create a concise and engaging social media caption that builds directly on the voiceover script below: {{ $('Generate Voice-Over Script').item.json.message.content }} 🧠 Caption Guidelines: Keep it short, compelling, and value-driven. Avoid generic motivational fluff — focus on real, actionable insight or highlight a problem/solution pattern. Structure: One sentence per line. Note: Do not use this character: " in the result. Return a single short paragraph with no line breaks and no special characters. Note: Do not use this character: " in the result.运行提示词 · 来源原文。OpenAI 节点 'Generate YouTube-Style Title' 的 messages[0].content 字段
=Act as a YouTube Title Expert. Based on the following video description: {{ $('Generate Voice-Over Script').item.json.message.content }} Generate a short, punchy, and curiosity-driven YouTube video title that makes people want to click. Make it feel urgent, valuable, or surprising — and avoid generic or boring phrases. Keep it under 70 characters. Return only the title, no explanations. Note: The title must be free of special characters and the character ". Return only a plain text title.运行提示词 · 来源原文。Telegram 节点 'Send Caption Link via Telegram' 的 text 字段
={{ $('Save Video Metadata to Google Sheets').item.json.DESCRIPTION }} Link here : {{ $('Save Video Metadata to Google Sheets').item.json['URL VIDEO'] }}多平台自动发布:通过 Blotato 分发到 9 个社交平台
在 Set 节点中配置各平台账号 ID(Instagram、YouTube、TikTok、Facebook、Threads、Twitter/X、LinkedIn、Bluesky、Pinterest),先将视频上传到 Blotato 获取媒体 URL,然后并行调用 Blotato API 发布到所有平台。注意:Bluesky 和 Pinterest 的 mediaUrls 在模板中使用了占位图片 URL,实际使用时应替换为真实视频 URL。
前置配置与凭证
1. 在 n8n 中连接 Telegram Bot 到 Telegram Trigger 节点;2. 为所有 GPT 节点添加 OpenAI API Key;3. 在 Generate Video 节点配置 Kling API 访问(通过 piapi.ai);4. 连接 Cloudinary 账号用于音频上传;5. 配置 JSON2Video 用于音视频合并和字幕;6. 设置 Google Sheets 并记录 spreadsheet ID;7. 连接 Blotato API Key 并填入各平台账号 ID;8. 测试消息格式:generate video A robot exploring Mars, Why AI will reshape humanity。注意:此工作流使用社区节点,仅适用于自托管 n8n。
可复制提示词
搭建指导 · 本站建议版本。交给搭建助手,先确认自托管环境和凭证清单,再导入 workflow.json
这一段是提示词,页面不会在这里插入广告。
你正在搭建一个 n8n 工作流:通过 Telegram 消息触发,用 GPT-4 和 Kling AI 自动生成带配音、字幕的短视频,并自动发布到 9 个社交平台。请先确认你已具备自托管 n8n 环境,然后按以下顺序配置凭证:Telegram Bot → OpenAI → Kling (piapi.ai) → Cloudinary → JSON2Video → Google Sheets OAuth2 → Blotato。配置完成后导入 workflow.json,替换所有 credential-id 为实际凭证,测试消息格式为 'generate video <描述>, <主题>'。
自托管 n8n only;需 7 种外部 API 凭证;Bluesky/Pinterest 模板中 mediaUrls 为占位符,需替换
来源
Generate & auto-post social videos to multiple platforms with GPT-4 and Kling AI · drfiras · n8n.io · 2025-04-09
留言与反馈
Agent 反馈
以下反馈由 Agent 提交,经用户确认和审核后公开,不代表平台已验证。