8
n8n 中文网amn8n.com

LinkedIn自动发布(含GPT-4o内容与图像生成+Telegram提醒)

中级

这是一个Social Media, Multimodal AI领域的自动化工作流,包含 7 个节点。主要使用 Set, Code, LinkedIn, Telegram, ManualTrigger 等节点。 LinkedIn自动发布,使用GPT-4o生成内容与图像,并发送Telegram提醒

前置要求
  • LinkedIn API 凭证
  • Telegram Bot Token
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "559fe524ea9daad79a07a81fd3f64f8e3eeddd635511642951eaee3bf4d5ad7a",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "4a83a2f6-f6ab-4657-ab2a-c5594cc13aa7",
      "name": "制作 LinkedIn 帖子",
      "type": "n8n-nodes-base.linkedIn",
      "position": [
        432,
        -48
      ],
      "parameters": {
        "text": "={{ $('Generate Post Content').item.json.message.content.content }}",
        "person": "SKNqCfgpq4",
        "additionalFields": {
          "visibility": "PUBLIC"
        },
        "shareMediaCategory": "IMAGE"
      },
      "credentials": {
        "linkedInOAuth2Api": {
          "id": "VHltapEwLBeLEZ0g",
          "name": "LinkedIn account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "276f682f-15cb-4ecb-93f2-fb07f92603e7",
      "name": "发送状态",
      "type": "n8n-nodes-base.telegram",
      "position": [
        688,
        -48
      ],
      "webhookId": "9373d46a-d5ad-40f4-93c0-7a44ff5fea37",
      "parameters": {
        "text": "=LinkedIn Post Sent Successfully  \n\nTag - {{ $('Get a random Tag').item.json.value }}\n\nURL - https://www.linkedin.com/feed/update/{{ $json.urn }}\n\nPosted At - {{ DateTime.now() }}",
        "chatId": "7281360444",
        "replyMarkup": "inlineKeyboard",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "snxgmnTv52eI8TSD",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "65b044fc-8595-4d00-9bbc-6f67a39a8d05",
      "name": "当点击\"执行工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -784,
        -48
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1f6d49f5-4d49-4769-bd4a-2cdb5e28e125",
      "name": "生成图片",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        192,
        -48
      ],
      "parameters": {
        "model": "gpt-image-1",
        "prompt": "={{ $json.message.content.prompt }}",
        "options": {},
        "resource": "image"
      },
      "credentials": {
        "openAiApi": {
          "id": "eXO8FZmhMVDhTRz9",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "1fbd87ae-52ac-48e0-95d1-833ffc885a8b",
      "name": "获取随机标签",
      "type": "n8n-nodes-base.code",
      "position": [
        -560,
        -48
      ],
      "parameters": {
        "jsCode": "const devToTags = [\n  \"llm\",\n  \"ai\",\n  \"devops\",\n  \"cloudnative\",\n  \"observability\",\n  \"automation\",\n  \"opensource\",\n  \"cybersecurity\",\n  \"scalability\"\n];\n\nfunction getRandomValuesAsObjects(list, count) {\n  const randomValues = [];\n  for (let i = 0; i < count; i++) {\n    const randomIndex = Math.floor(Math.random() * list.length);\n    randomValues.push({ json: { value: list[randomIndex] } });\n  }\n  return randomValues;\n}\n\nreturn getRandomValuesAsObjects(devToTags, 1);\n"
      },
      "typeVersion": 2
    },
    {
      "id": "35d5303a-48a9-4b2b-945b-ca929e400553",
      "name": "添加示例以设置写作风格",
      "type": "n8n-nodes-base.set",
      "position": [
        -352,
        -48
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "{\n  \"posts\": [\n  \"Redis is open source YET AGAIN! But does it matter anymore? Here's the story: • 2009: Redis launched as open-source (BSD license). • 2018: Redis Labs introduced RSAL for modules like Redis Search, Graph etc. • 2024: Redis switched to a commercial license, as cloud providers copied Redis code without contributing back. • 2025: Redis is open source again with AGPL v3. But why? Big players like AWS, Google, and Oracle backed the Valkey fork—a fully open-source Redis alternative now under the Linux Foundation. Check out Valkey—\",\n  \"10x Faster Typescript COMPILER!!! Still there is an ongoing debate on why Microsoft didn't choose Rust or their own C# for this rewrite. Although, according to the team, Go was a better choice as it provided a similar structure and seamless transition. Had it been a ground-up rewrite and not a migration, Rust or C# would have been a better choice.\",\n  \"I recently started working on a Teams to Signal messenger bot after realizing that so many people outright hate using MS Teams, but since it's an industry standard, they cannot directly ditch it. My current goal is to support forwarding incoming text messages on Teams to a messenger like Signal. The second will be to give support for the reply mechanism from Signal and sync it to Teams. Coming to the technical stuff, I am thinking of using automation tools like Cypress or Playwright to do this. But it all boils down to the availability of public APIs of both messengers. I will try to document my progress here, as I might fail trying, like a lot of other times 😅 Let's see how it pans out. How would you approach this kind of problem?\",\n    \"Do you know about the require cache in Node.js? Lets say you have a js module that you have imported in a js file using require statement. It is highly possible that after a few iterations to your module code, the changes wont reflect even after you have reloaded the api server/modules. This happens because there is a module cache that happens. You need to invalidate it in order for the new changes to reflect. More on this here -\",\n    \"How important is Out-of-Box experience for an open source contributor? Nowadays I have been working on creating a seamless out-of-box experience for the new contributors of Sparrow API Tool. A poor app setup experience or hard-to-understand README file can be a serious dealbreaker for the community. I am emphasizing on the following things to make the setup as smooth as possible: 1) Created and hosted Docker images for various microservices like api-service and auth-service on DockerHub. 2) Created an all-in-one docker-compose file to set up everything from database to queue service in one command. 3) Created a migration script that generates a test user on app start—bypassing auth flow for instant contribution. 4) Documented multiple setup methods (Docker and non-Docker). 5) Pre-filled example .env files with required variables for copy-paste convenience. Let me know if you have suggestions to improve this further—I’m open to feedback!\"\n]\n}\n",
        "includeOtherFields": true
      },
      "typeVersion": 3.4,
      "alwaysOutputData": false
    },
    {
      "id": "7eaf45b6-e58f-41f5-83e6-ed168f039301",
      "name": "生成帖子内容",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -160,
        -48
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "id",
          "value": "gpt-4o"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "=Role: You are my LinkedIn content assistant. Your job is to write perfectly formatted LinkedIn posts that align with my brand voice, tone, and style (based on provided examples). Each post must revolve around a single keyword/tag and avoid unsupported formatting.\n\nCritical Formatting Rules:\n\nDont use bold, italics or bullets.\n\nWhenever you want to add points, use emojis or simple \"- \" before the start of each pointer \n\nDont use big hyphens that AI usually uses while generating content. Instead use comma(,)\n\nStructure:\n\nAn Engaging Hook\n\nPersonal POV (first-person: \"I’ve seen…\")\n\nInsights (trends/tools/case studies)\n\nClear spacing + new line wherever needed\n\nCTA/question (\"What’s your take?\")\n\nRelavant 4-5 treding hashtags\n\nTrends: \nTie to recent news, tools, or debates (no generic advice).\n\nImage Prompt Rules:\nSuggest an AI image prompt related to the post. Based on the post context, it can be:\n- App interface or UX concept\n- Visual metaphor (e.g. “scaling servers as rocket engines”)\n- Stack or architecture illustration\n- Abstract concept visuals (e.g. speed, chaos, control, balance)\n- Tech-product mockups or feature highlights\n- Flowcharts, only suggest if explaining a process, framework, or system\n\nResponse Format (Strictly JSON):\n```json\n{\n  \"content\": \"<LinkedIn-ready post with proper formatting and no markdown symbols>\",\n  \"prompt\": \"<AI image generation prompt – relevant, visual, descriptive>\"\n}"
            },
            {
              "role": "system",
              "content": "=Examples of my past writings. Use them to align the new post with my brand voice, tone, and style,\n\n{{ $json.posts.join(\"\\n\\n\") }}"
            },
            {
              "content": "=Use this tag to write a new article for Linkedin that follows my brand voice, style of writing, and tone. \nTag: {{ $json.value }}"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "id": "eXO8FZmhMVDhTRz9",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    }
  ],
  "pinData": {},
  "connections": {
    "Get a random Tag": {
      "main": [
        [
          {
            "node": "Add Examples to set Writing Style",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate an image": {
      "main": [
        [
          {
            "node": "make Linkedin post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "make Linkedin post": {
      "main": [
        [
          {
            "node": "sent the status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Post Content": {
      "main": [
        [
          {
            "node": "Generate an image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Examples to set Writing Style": {
      "main": [
        [
          {
            "node": "Generate Post Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Get a random Tag",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 社交媒体, 多模态 AI

需要付费吗?

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

工作流信息
难度等级
中级
节点数量7
分类2
节点类型6
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者

Hi, I’m Punit a DevOps & Cloud Engineer with a strong focus on automation and workflow orchestration using n8n. I specialize in building robust, scalable workflows that connect APIs, services, and internal tools to automate business processes end-to-end. Whether you need help setting up complex logic, integrating third-party tools, or deploying n8n in production, I’m here to help. Let’s work together to bring your automation ideas to life.

外部链接
在 n8n.io 查看

分享此工作流