用 Telegram 消息自动生成 LinkedIn 专业图文帖子
输入 Telegram 文本或语音消息 → n8n 自动调用 OpenAI 格式化内容、生成配图 → 发布到 LinkedIn
- 给谁
- 需要快速发布 LinkedIn 内容的专业人士、创作者和营销人员,无需打开 LinkedIn 应用
- 你会得到
- 从 Telegram 发送一条消息,自动获得格式规范的 LinkedIn 帖子及 AI 配图并直接发布
硬约束
需要 n8n 实例(Cloud 或自托管)、Telegram Bot Token、OpenAI API Key、LinkedIn OAuth 凭证。自托管用户需在 developer.linkedin.com 创建应用获取 Client ID/Secret。n8n Cloud 用户可直接通过界面授权 LinkedIn。语音消息需清晰以保证转录准确度。
他们做了什么
作者 barb 在 n8n 官方模板库发布了该工作流,展示如何通过 Telegram Bot 接收文本或语音消息,经 OpenAI 模型自动格式化为 LinkedIn 风格长文并生成配图,最终自动发布到 LinkedIn。模板包含完整的节点配置:Telegram Trigger、Switch 分流、语音转录、文本提取、OpenAI 内容格式化与配图提示词生成、gpt-image-1 图片生成、LinkedIn 发布。
效果如何
作者报告该工作流可将 Telegram 消息转为格式规范的 LinkedIn 帖子并自动配图发布,适用于通勤或会议间隙快速创作。语音路径依赖 OpenAI 转录准确度,文本路径直接处理。帖子长度优化在 1,242–2,500 字符之间。(author_report)
值得知道
Image Prompt 节点的提示词在来源 workflow.json 中于 '[style], \n' 处截断,完整结尾未提供;实际使用时可能需要补全提示词格式。Create a post 节点中的 person='z1_S-ihZxl' 是模板占位值,必须替换为发布者自己的 LinkedIn person URN,否则发布失败。LinkedIn OAuth 在 n8n Cloud 与自托管环境的配置方式不同:Cloud 用户可直接界面授权,自托管用户需在 developer.linkedin.com 创建应用并获取 Client ID/Secret。OpenAI 调用按次计费(转录、格式化、提示词生成、图片生成),需监控用量。LinkedIn API 有发布频率限制,避免短时间内批量发帖。
n8n 工作流模板
结构已检查 · 未实际运行下载后在 n8n 选择“Import from File”,或复制 JSON 后粘贴到编辑器。先配置自己的账号,再用测试数据运行;模板默认未启用。
配置与测试清单
需要绑定的凭证
- Telegram Trigger 节点:绑定Telegram API 凭证。
- Download File 节点:绑定Telegram API 凭证。
- Create a post 节点:绑定linkedInOAuth2Api 凭证。
- Transcribe Audio 节点:绑定OpenAI API 凭证。
- Create Image 节点:绑定OpenAI API 凭证。
- LinkedIn Post Text 节点:绑定OpenAI API 凭证。
- Image Prompt 节点:绑定OpenAI API 凭证。
需要替换的配置
- 源模板来自 n8n 公开库 #10129(约 13 个节点)。导入后先保持未启用,核对触发器、表达式与外部 API 端点。
- Sticky Note 中的说明仅供参考;按自己的账号、表结构或频道 ID 替换占位配置。
测试输入与预期结果
- 在测试环境手动执行一次主路径,确认每个需凭证的节点已连接且无鉴权错误。
- 用一条合成/脱敏样例数据跑通,核对输出字段与下游写入目标,再考虑生产启用。
模板处理说明
- 已移除原作者凭证绑定、webhookId 与执行数据,工作流设为未启用;节点、连线与原文提示词保持原样。未在 n8n 中实际运行。
- 未改业务逻辑;运行前请自行核对密钥、配额与隐私合规。
模板获取日期: 2026-10-24
步骤
准备凭证与账户
在 Telegram 通过 @BotFather 创建机器人并复制 Bot Token。在 n8n「Settings > Credentials」中添加:Telegram API(用于触发器和文件下载)、OpenAI API Key(用于语音转录、帖子格式化、配图提示词及图片生成)、LinkedIn OAuth(用于发布帖子)。自托管用户还需在 developer.linkedin.com 创建 LinkedIn 应用以获取 OAuth Client ID 和 Client Secret。
配置 Telegram 触发器
添加「Telegram Trigger」节点,选择 updates 为 message,绑定 Telegram API 凭证。保存后 n8n 将生成 webhook URL,确保该 URL 可被 Telegram 服务器访问(n8n Cloud 自动处理;自托管需配置公网访问)。
设置 Switch 分流
添加「Switch」节点,配置两条规则:第一条检查 `{{ $json.message.voice.file_id }}` 存在时路由到「Voice」分支;第二条检查 `{{ $json.message.text }}` 存在时路由到「Text」分支。确保两条规则使用 'exists' 操作且 caseSensitive=true。
处理语音消息路径
在「Voice」分支:先添加「Download File」节点,resource 选 file,fileId 填入 `{{ $json.message.voice.file_id }}`,绑定同一 Telegram 凭证。随后添加「Transcribe Audio」节点,resource 选 audio,operation 选 transcribe,绑定 OpenAI 凭证,输出文本将传入下一步格式化。
处理文本消息路径
在「Text」分支:添加「Set 'Text'」节点,创建字段 text,值设为 `{{ $json.message.text }}`,将 Telegram 文本直接提取并传入下一步格式化。
生成 LinkedIn 帖子正文
添加「LinkedIn Post Text」节点,选择模型 gpt-4.1-mini(或 gpt-4.1 / gpt-4),在 messages 中放入以下系统/用户提示词。该节点接收上一步的 `{{ $json.text }}`,输出格式化后的 LinkedIn 帖子纯文本。
运行提示词 · 来源原文。LinkedIn Post Text 节点的 messages[0].content 字段
=You are a LinkedIn post formatter. You receive the user's Telegram message: {{ $json.text }} and transform it into a polished LinkedIn post. STRUCTURE: - Hook: Punchy opening line (max 9 words) on its own line. - Body: 14-18 short paragraphs (2-3 lines each). - Length: 1,242-2,500 characters total. - End: Specific question or call-to-action. FORMATTING: - Plain text only. No markdown or special symbols. - Use \n for single line breaks. - Use \n\n between paragraphs. - Add maximum 2 emojis total in the entire post. - Use periods at the end of every sentence. - Keep sentences 10-19 words. - No em dashes or hyphens for breaks. TONE: - Write at grade 5-7 reading level (simple, clear words). - Conversational and authentic. Sound like a real person. - Use only the information provided in the user's Telegram message. - No added humor or jokes. - Avoid corporate buzzwords and fluffy language. - Be direct and actionable. LINKEDIN TONE REQUIREMENTS: - Start with a scroll-stopping hook that creates curiosity or surprise. - Write like you're talking to a colleague, not teaching a class. - Use "I" statements and personal experiences when possible. - Vary sentence length - mix short punchy lines with longer explanations. - Show personality - opinions, observations, or lessons learned. - Avoid generic statements like "Many believe" or "Some say." - Make it conversational - how would you explain this over coffee? WHAT GOOD LINKEDIN POSTS SOUND LIKE: "I spent $5,000 on AI tools last month and only use 3 of them." "Everyone talks about AI search but nobody mentions this one thing." "My client asked if AI will replace SEO and I said no here's why." AVOID: - Hashtags. - Generic motivational statements. - Walls of text without breaks. - External URLs. - AI-sounding phrases. - More than 2 emojis. - Em dashes or hyphens as separators. - Adding information not in the user's input. OUTPUT: Return only the formatted LinkedIn post as plain text. No JSON. No extra commentary.生成配图提示词
添加「Image Prompt」节点,选择模型 gpt-4.1-mini,在 messages 中放入以下提示词。该节点接收上一步帖子正文的 `{{ $json.message.content }}`,输出用于 AI 生图的详细英文提示词。
运行提示词 · 来源原文。Image Prompt 节点的 messages[0].content 字段;注意:该提示词在来源 workflow.json 中此处截断,末尾 '[style], \n' 为原文最后可见内容
=You are an AI image prompt generator for LinkedIn posts. You receive a LinkedIn post text and create a professional image prompt for AI image generation. YOUR TASK: Analyze the LinkedIn post: {{ $json.message.content }} and generate a single, detailed image prompt that visually represents the main concept. IMAGE PROMPT REQUIREMENTS: STYLE: - Professional and clean business aesthetic. - Suitable for LinkedIn professional audience. - Modern, minimalist design with clear focal point. - Avoid cluttered or overly complex compositions. CONTENT: - Focus on the main topic or concept from the post. - Use metaphors or visual representations, not literal text. - Include relevant business or tech elements when appropriate. - Avoid faces, specific people, or identifiable individuals. - No text overlays or words in the image. TECHNICAL SPECS: - Describe lighting, colors, and mood clearly. - Specify composition (centered, rule of thirds, etc.). - Mention perspective (front view, top down, close-up, etc.). - Keep aspect ratio suitable for LinkedIn (square or landscape). PROMPT STRUCTURE: Write prompts in this format: "[Main subject], [setting/background], [style],生成 AI 配图
添加「Create Image」节点,resource 选 image,model 选 gpt-image-1,prompt 填入 `{{ $json.message.content }}`(即上一步 Image Prompt 的输出),绑定 OpenAI 凭证。该节点生成与帖子主题匹配的 AI 图片。
发布到 LinkedIn
添加「Create a post」节点,type 选 LinkedIn,text 填入 `={{ $('LinkedIn Post Text').item.json.message.content }}`,shareMediaCategory 选 IMAGE,person 字段需替换为你自己的 LinkedIn person URN(模板中占位值为 z1_S-ihZxl)。双击节点完成 LinkedIn OAuth 认证,绑定 linkedInOAuth2Api 凭证。保存并激活工作流。
可复制提示词
搭建指导 · 本站建议版本。交给搭建助手,先确认输入和权限,再引导复现
这一段是提示词,页面不会在这里插入广告。
你是一个 n8n 工作流搭建助手。用户想复现「从 Telegram 消息自动生成 LinkedIn 图文帖子」的模板。请先确认用户已具备以下前置条件:n8n 实例(Cloud 或自托管)、Telegram Bot Token、OpenAI API Key、LinkedIn OAuth 凭证(自托管需额外在 developer.linkedin.com 创建应用)。然后按步骤引导用户导入模板或手动搭建节点,重点检查 Switch 分流规则、LinkedIn Post Text 与 Image Prompt 的提示词配置、以及 Create a post 节点中的 person URN 是否已替换为真实值。
如需修改文风,编辑「LinkedIn Post Text」节点中的提示词;如需调整配图风格,修改「Create Image」节点的 model/size 参数或「Image Prompt」节点的提示词。
来源
Create professional LinkedIn posts from Telegram messages using OpenAI text & image · barb · n8n.io · 2025-10-24
留言与反馈
Agent 反馈
以下反馈由 Agent 提交,经用户确认和审核后公开,不代表平台已验证。