8
n8n 中文网amn8n.com

AI驱动的LinkedIn帖子自动化

高级

这是一个AI, Marketing领域的自动化工作流,包含 16 个节点。主要使用 Set, Code, LinkedIn, FormTrigger, HttpRequest 等节点,结合人工智能技术实现智能自动化。 使用Google Gemini和Gen-Imager生成带文本和图像的LinkedIn帖子

前置要求
  • LinkedIn API 凭证
  • 可能需要目标 API 的认证凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "vqN5q4DY1j8QQdck",
  "meta": {
    "instanceId": "60c025075753afcab9f803964b4caaca9402f435deb4efafbb8e3b93b54d8752",
    "templateCredsSetupCompleted": true
  },
  "name": "AI驱动的LinkedIn帖子自动化",
  "tags": [
    {
      "id": "TZGpFRr1DpwFbL3j",
      "name": "LinkedIn",
      "createdAt": "2025-05-29T11:14:22.147Z",
      "updatedAt": "2025-05-29T11:14:22.147Z"
    },
    {
      "id": "QXtLNWbsCSABOTNm",
      "name": "Digital Marketing",
      "createdAt": "2025-05-29T11:14:57.099Z",
      "updatedAt": "2025-05-29T11:14:57.099Z"
    }
  ],
  "nodes": [
    {
      "id": "ab4282b8-43e9-466a-9986-70e5e449eb5e",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        0,
        0
      ],
      "webhookId": "e06e171b-45cc-4c4f-bbc5-ffedd4d60f47",
      "parameters": {
        "options": {},
        "formTitle": "LinkedIn Post Generator ",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Topic",
              "placeholder": "Enter prompt here....",
              "requiredField": true
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e593eb90-b859-499b-8b18-3f8fbe8017da",
      "name": "映射器",
      "type": "n8n-nodes-base.set",
      "position": [
        260,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "694a158d-53fd-425c-9a42-be4288c17ac9",
              "name": "chatInput",
              "type": "string",
              "value": "={{ $json.Topic }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c48b5989-66ed-4fe2-96a2-6b540ac87d54",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        500,
        0
      ],
      "parameters": {
        "options": {
          "systemMessage": "=I need help creating a professional LinkedIn post for the topic: \"{{ $json.chatInput }}\". The output should include:\n\n1. **LinkedIn Post Content**:\n   - Write an engaging and informative LinkedIn post on the topic \" {{ $json.chatInput }}\".\n   - Start with an attention-grabbing hook that entices readers to read further.\n   - Provide valuable insights or actionable tips related to the topic.\n   - The tone should be professional, clear, and concise, using language that's easy to understand.\n   - End with a call to action (CTA) encouraging the audience to engage, reflect, or share their thoughts.\n   - Include relevant hashtags to increase engagement and visibility on LinkedIn. Make sure these hashtags are specific to the topic and aligned with trending keywords for LinkedIn posts.\n\n2. Image Generation Prompt:\n\nVisual Aesthetic:\nThe image should align with LinkedIn's professional and corporate atmosphere. Make sure it conveys sophistication, modernity, and relevance to the topic. Avoid overly busy designs.\n\nColor Palette:\nStick to corporate tones such as blues, whites, and grays to maintain a professional and clean look. Consider using gradients for depth or subtle contrasts to highlight key elements.\n\nImagery:\n\nFocus on visualizing the topic of the post. For AI in Business, this could involve:\n\nA futuristic office or workspace setting, highlighting cutting-edge technologies.\n\nIcons or symbols that represent data analysis, AI, or automation.\n\nVisuals of humans interacting with AI systems (e.g., robots working alongside humans or using AI tools).\n\nAbstract representations of neural networks or digital data flows.\n\nNo Text Overlay:\n\nDo not include any text in the image, ensuring it remains clean and focuses solely on the visuals.\n\nText overlays or titles are not necessary in this case to keep the professional look intact.\n\nStyle and Tone:\n\nThe design should be minimalist, modern, and sleek. Use a balanced layout with a focus on professional imagery that resonates with business-minded audiences.\n\nAvoid overly complex or distracting backgrounds—keep it clean and visually appealing.\n\nFont Style (if applicable):\n\nIf any text were used in future visuals or branding (though none should appear in this image), use clean, modern fonts like Helvetica, Arial, or Roboto—sans-serif fonts that are readable and professional.\n\nimage prompt can be like this short and simple\nA modern co-working space where AI assistants and human employees brainstorm around a digital whiteboard. The scene shows innovation and teamwork, with a multicultural group, smart gadgets, and subtle futuristic elements. Warm natural lighting and a balanced, professional layout ideal for a LinkedIn audience.\n the JSON output would look like this:\n{\n  \"post_content\": {\n    \"text\": \"The Future of AI in Business: How It is Transforming Industries 🚀\\n\\nAI in Business is no longer just a buzzword; it's revolutionizing the way businesses operate today. From improving efficiency to driving innovation, AI is an essential tool for modern companies.\\n\\nHere are some key insights on how AI in Business is shaping the future of industries:\\n1. Enhanced Data Analytics: AI helps businesses make data-driven decisions with greater accuracy.\\n2. Automation of Tasks: AI is automating repetitive tasks, improving operational efficiency.\\n3. Personalized Experiences: AI is enabling personalized customer experiences in real-time.\\n\\nIs your business ready to embrace AI in Business? Let's discuss how it can help drive growth and innovation.\\n\\n#AIinBusiness #Innovation #FutureOfWork #BusinessGrowth #TechnologyTrends #DigitalTransformation\"\n  },\n  \"image_prompt\": {\n    \"description\": \"Create an image for a LinkedIn post on the topic of AI in Business. The image should:\\n- Feature modern, sleek visuals that align with the corporate tone of LinkedIn.\\n- Visualize AI in Business through elements like a futuristic office, AI-powered systems, or human-robot collaboration.\\n- Use a professional color palette like blues, whites, and grays.\\n- The optional text overlay (if relevant) could be something like 'The Future of AI in Business' or 'Driving Innovation with AI'.\\n- The design should use clean, modern fonts that are easily readable and match the professional style of LinkedIn posts.\"\n  }\n}\n"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "e56b669f-caa5-435d-be77-8abf8d79d4fc",
      "name": "Google Gemini聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        460,
        240
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "Xpxt71RcelLLFyE3",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9af3d1f9-3085-4479-83eb-eab69050b65f",
      "name": "解码器",
      "type": "n8n-nodes-base.code",
      "position": [
        1460,
        0
      ],
      "parameters": {
        "jsCode": "// Extract the data field (which is a string) and parse it into a JSON object\nconst dataString = $input.first().json.data;\n\n// Parse the data string into a valid JSON object\nconst dataObject = JSON.parse(dataString);\n\n// Now you can safely extract the base64 image data\nconst base64Image = dataObject.base64_img;\n\n// Decode the base64 string and create a buffer from it\nconst buffer = Buffer.from(base64Image, 'base64');\n\n// You can optionally store this buffer in a temporary file or return the buffer as-is\nreturn {\n  json: {\n    decoded_image_buffer: buffer.toString('base64'), // Returning as base64 for further processing\n    image_length: buffer.length, // Optional: To verify the size of the decoded image\n  }\n};\n"
      },
      "typeVersion": 2
    },
    {
      "id": "8ebd423c-16da-4a44-8c96-07683fe4659f",
      "name": "标准化器",
      "type": "n8n-nodes-base.code",
      "position": [
        880,
        0
      ],
      "parameters": {
        "jsCode": "const input = $input.first().json.output\n\nconst cleanedInput = input.replace(/```json|```/g, '').trim();\n\n// Parse the cleaned JSON\nconst parsedOutput = JSON.parse(cleanedInput);\n\n// Extract the `post_content.text` and `image_prompt.description` details\nconst postContent = parsedOutput.post_content.text;\nconst imagePrompt = parsedOutput.image_prompt.description;\n\n// Prepare the final output in the desired JSON structure\nreturn {\n  post_content: postContent,\n  image_prompt: imagePrompt\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "bb7ac25e-e584-4737-9aa2-4f7e7ffb9971",
      "name": "文本转图像",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1180,
        0
      ],
      "parameters": {
        "url": "https://gen-imager.p.rapidapi.com/genimager/index.php",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "Prompt",
              "value": "={{ $json.image_prompt }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "gen-imager.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "your gen-imager rapid api key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "5feeaf28-1efd-4624-ba09-947133b247ec",
      "name": "LinkedIn",
      "type": "n8n-nodes-base.linkedIn",
      "position": [
        1760,
        0
      ],
      "parameters": {
        "text": "={{ $('Normalizer').item.json.post_content }}",
        "additionalFields": {},
        "binaryPropertyName": "={{ $json.decoded_image_buffer }}",
        "shareMediaCategory": "IMAGE"
      },
      "typeVersion": 1
    },
    {
      "id": "a984e557-1239-4905-bca3-ed6040cef517",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -500,
        -300
      ],
      "parameters": {
        "height": 700,
        "content": "> **AI驱动的LinkedIn帖子自动化**"
      },
      "typeVersion": 1
    },
    {
      "id": "a402ed2c-1970-4e4d-b78d-618d335d6034",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -160
      ],
      "parameters": {
        "height": 320,
        "content": "**表单提交时**"
      },
      "typeVersion": 1
    },
    {
      "id": "8a027b14-4b84-4efb-b3df-94c29f59ead2",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        -160
      ],
      "parameters": {
        "height": 320,
        "content": "> **映射器**"
      },
      "typeVersion": 1
    },
    {
      "id": "dcb0b306-9b48-4db9-8bdf-8b39f163d102",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -160
      ],
      "parameters": {
        "width": 300,
        "height": 320,
        "content": "**AI代理**"
      },
      "typeVersion": 1
    },
    {
      "id": "edc1b46c-2ba7-4de9-bcfd-11bb3f750d17",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        820,
        -160
      ],
      "parameters": {
        "height": 320,
        "content": "**标准化器**"
      },
      "typeVersion": 1
    },
    {
      "id": "17a43c84-0dbf-4217-bb11-486a58d62c7a",
      "name": "便利贴5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1100,
        -160
      ],
      "parameters": {
        "height": 320,
        "content": "> **文本转图像**"
      },
      "typeVersion": 1
    },
    {
      "id": "8c1fa58f-c4c1-4751-8126-814ff0c9dfd1",
      "name": "便签 6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1380,
        -160
      ],
      "parameters": {
        "height": 320,
        "content": "**解码器**"
      },
      "typeVersion": 1
    },
    {
      "id": "e1e20396-2fa5-4574-bab6-eb6dbad793fe",
      "name": "便签 7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        -160
      ],
      "parameters": {
        "height": 320,
        "content": "> **LinkedIn**"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "398b0e27-ca1f-45e2-a18e-f86b387d8bb2",
  "connections": {
    "Mapper": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Decoder": {
      "main": [
        [
          {
            "node": "LinkedIn",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Normalizer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalizer": {
      "main": [
        [
          {
            "node": "Text to image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Text to image": {
      "main": [
        [
          {
            "node": "Decoder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Mapper",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 人工智能, 营销

需要付费吗?

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

工作流信息
难度等级
高级
节点数量16
分类2
节点类型8
难度说明

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

外部链接
在 n8n.io 查看

分享此工作流