8
n8n 中文网amn8n.com

使用 AI 内容生成器自动发布 LinkedIn 职位帖子

中级

这是一个HR, Multimodal AI领域的自动化工作流,包含 10 个节点。主要使用 Code, Webhook, LinkedIn, GoogleSheets, OpenAi 等节点。 从 Recrutei ATS 使用 GPT-4o 内容生成自动化 LinkedIn 职位发布

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)
  • LinkedIn API 凭证
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "name": "使用 AI 内容生成器自动发布 LinkedIn 职位帖子",
  "tags": [],
  "nodes": [
    {
      "id": "ff66c07a-7c70-4b1f-9b08-439051889d16",
      "name": "Recrutei Webhook 触发器",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -64,
        0
      ],
      "webhookId": "YOUR_WEBHOOK_ID_HERE",
      "parameters": {
        "path": "new-job-created",
        "options": {},
        "httpMethod": "POST"
      },
      "credentials": {},
      "typeVersion": 2.1
    },
    {
      "id": "70282417-5778-4e57-871d-5efef5bc21e0",
      "name": "清理和标准化职位数据",
      "type": "n8n-nodes-base.code",
      "position": [
        144,
        0
      ],
      "parameters": {
        "jsCode": "// Maps over each item in the input\nreturn items.map(item => {\n  // item.json is the main object of the item in n8n\n  const body = item.json.body;\n\n  // Helper function to convert 0/1 to \"no\"/\"yes\"\n  const convertBoolean = (value) => value === 1 ? 'yes' : 'no';\n\n  // Apply conversion to the desired fields\n  body.fixed_remuneration = convertBoolean(body.fixed_remuneration);\n  body.remote = convertBoolean(body.remote);\n  body.pcd = convertBoolean(body.pcd);\n  body.is_inclusive = convertBoolean(body.is_inclusive);\n\n  // Return the modified 'body' object\n  return body;\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "52cfd7ce-57f0-4e30-af4c-ab03c93ecc8f",
      "name": "发布 LinkedIn 帖子",
      "type": "n8n-nodes-base.linkedIn",
      "position": [
        1312,
        0
      ],
      "parameters": {
        "text": "={{ $json.message.content }}",
        "person": "YOUR_LINKEDIN_PROFILE_ID",
        "additionalFields": {}
      },
      "credentials": {},
      "typeVersion": 1
    },
    {
      "id": "db5dfcdf-471c-45e0-b13b-47046e5a57cf",
      "name": "Google Sheets 记录",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1520,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "Job Title": "={{ $('Clean and Standardize Job Data').item.json.title }}",
            "Published": "Yes"
          },
          "schema": [
            {
              "id": "Job Title",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Job Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Published",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Published",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Job Title"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_SHEET_ID_HERE",
          "cachedResultName": "Job Posting Log"
        }
      },
      "credentials": {},
      "typeVersion": 4.7
    },
    {
      "id": "434cd22e-0acd-412e-bcd4-d99094f93022",
      "name": "将数据转换为 AI 提示",
      "type": "n8n-nodes-base.code",
      "position": [
        464,
        0
      ],
      "parameters": {
        "jsCode": "// Gets the first item from the input array, which contains the job data.\nconst vagaData = $input.item.json;\n\n// Mapping of original field names to translation and output text.\n// 'skip': true for fields we don't want to include in the final text.\nconst fieldMap = {\n    \"title\": { \"label\": \"Job Title\" },\n    \"manager\": { \"label\": \"Hiring Manager\" },\n    \"quantity\": { \"label\": \"Vacancy Quantity\" },\n    \"client\": { \"label\": \"Client Name\" },\n    \"department\": { \"label\": \"Department\" },\n    \"pipe\": { \"label\": \"Pipeline/Stage\" },\n    \"internal_code\": { \"label\": \"Internal Code\" },\n    \"status\": { \"label\": \"Status\" },\n    \"type\": { \"label\": \"Job Type\" },\n    \"sla\": { \"label\": \"SLA (Max Deadline)\" },\n    \"expired\": { \"label\": \"Expiration Date\" },\n    \"regime\": { \"label\": \"Contract Regime\" },\n    \"public_link\": { \"label\": \"Public Link\" },\n    \"remuneration_type\": { \"label\": \"Remuneration Type\" },\n    \"remuneration\": { \"label\": \"Remuneration Value\" },\n    \"fixed_remuneration\": { \"label\": \"Fixed Remuneration\" },\n    \"description\": { \"label\": \"Detailed Description\", \"is_long_text\": true },\n    \"skills\": { \"label\": \"Key Skills\" },\n    \"benefits\": { \"label\": \"Benefits\" },\n    \"remote\": { \"label\": \"Remote Work\" },\n    \"location\": { \"label\": \"Location\" },\n    \"country\": { \"label\": \"Country\" },\n    \"state\": { \"label\": \"State\" },\n    \"city\": { \"label\": \"City\" },\n    \"pcd\": { \"label\": \"PWD Vacancy\" },\n    \"is_inclusive\": { \"label\": \"Inclusive Vacancy\" },\n    \n    // Fields to be ignored\n    \"id\": { \"skip\": true },\n    \"client_id\": { \"skip\": true },\n    \"company_department_id\": { \"skip\": true },\n    \"pipe_id\": { \"skip\": true },\n    \"remuneration_from\": { \"skip\": true },\n    \"remuneration_to\": { \"skip\": true }\n};\n\nlet outputText = \"\";\noutputText += `## Job Details: ${vagaData.title}\\n\\n`;\noutputText += `---\\n\\n`;\n\n// Iterate over the mapping to build the text\nfor (const key in fieldMap) {\n    if (fieldMap.hasOwnProperty(key) && !fieldMap[key].skip) {\n        const fieldInfo = fieldMap[key];\n        const label = fieldInfo.label;\n        let value = vagaData[key];\n\n        // Handle null or empty values\n        if (value === null || value === \"\" || value === undefined) {\n            value = \"Not Informed\";\n        }\n        \n        // Special formatting for description (long text, likely HTML)\n        if (fieldInfo.is_long_text) {\n             // Try to remove basic HTML tags to clean the description, but maintain list formatting\n            const cleanDescription = String(value)\n                .replace(/<p>|<\\/p>|<br\\s*\\/?>/gi, ' ') // Replaces paragraphs and breaks with space\n                .replace(/<h[1-6]>(.*?)<\\/h[1-6]>/gi, '\\n**$1**\\n') // Formats headers as bold\n                .replace(/<\\/?ul>|<\\/?ol>/gi, '') // Removes ul/ol tags\n                .replace(/<li>/gi, '  - ') // Formats list items\n                .replace(/<\\/?strong>|<\\/?b>/gi, '**') // Bold\n                .replace(/<\\/?em>|<\\/?i>/gi, '*') // Italic\n                .replace(/\\s\\s+/g, ' ') // Removes multiple spaces\n                .trim();\n                \n            outputText += `### ${label}:\\n`;\n            outputText += `${cleanDescription}\\n\\n`;\n        } \n        // Special formatting for remuneration (currency)\n        else if (key === \"remuneration\" && typeof value === 'number') {\n            const formattedValue = new Intl.NumberFormat('en-US', { // Changed to en-US for international template\n                style: 'currency',\n                currency: 'USD',\n                minimumFractionDigits: 2\n            }).format(value);\n            outputText += `**${label}:** ${formattedValue}\\n`;\n        } \n        // Normal formatting for other fields\n        else {\n            outputText += `**${label}:** ${value}\\n`;\n        }\n    }\n}\n\n// The n8n Code node expects an array of objects as output.\nreturn [{\n    json: {\n        detailedJobPrompt: outputText // Renamed key to be more descriptive\n    }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "9c8b68f8-1b0d-44ba-945a-35cc1e3c6798",
      "name": "便利贴 - 触发器",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        -96
      ],
      "parameters": {
        "width": 448,
        "height": 320,
        "content": "这是工作流的**入口点**。当 Recrutei ATS 中创建/发布新职位时,它会监听来自 Recrutei 的 POST 请求。您必须复制 Webhook URL 并在 Recrutei 中配置它。"
      },
      "typeVersion": 1
    },
    {
      "id": "574549fd-e687-4380-8be3-25d54999baf1",
      "name": "便利贴 - 数据预处理",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        336,
        -96
      ],
      "parameters": {
        "color": 4,
        "width": 400,
        "height": 320,
        "content": "使用两个代码节点清理原始数据(代码 1:布尔值转换)并为其构建结构(代码 2:Markdown 提示生成),以实现最佳 AI 解析效果。"
      },
      "typeVersion": 1
    },
    {
      "id": "ee3012c2-007d-4a0f-a4de-7d2a34939838",
      "name": "便利贴 - AI 生成",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        -96
      ],
      "parameters": {
        "color": 5,
        "width": 448,
        "height": 320,
        "content": "**OpenAI 模型**充当专业文案撰稿人。它接收结构化提示并生成适合 LinkedIn 的引人入胜、以营销为重点的文本。"
      },
      "typeVersion": 1
    },
    {
      "id": "2130e4ef-7f40-4906-b432-ef5867203a22",
      "name": "AI 内容生成器",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        864,
        0
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "={{ $json.detailedJobPrompt }}"
            },
            {
              "role": "system",
              "content": "You are a professional HR Marketing Copywriter. Your task is to receive detailed job information and transform it into an engaging, attractive LinkedIn post for candidate attraction. Focus on benefits, culture, and key responsibilities. Include relevant hashtags."
            }
          ]
        }
      },
      "credentials": {},
      "typeVersion": 1.8
    },
    {
      "id": "bb6ce9b4-e5c1-4de1-8b66-c76347a26dbf",
      "name": "便利贴 - 发布与记录",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1216,
        -96
      ],
      "parameters": {
        "color": 6,
        "width": 512,
        "height": 320,
        "content": "最终内容发布在 LinkedIn 上。最后,职位标题和发布状态记录在 **Google Sheets 记录**节点中,供内部审计使用。"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "AI Content Generator": {
      "main": [
        [
          {
            "node": "Publish LinkedIn Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Publish LinkedIn Post": {
      "main": [
        [
          {
            "node": "Google Sheets Logging",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recrutei Webhook Trigger": {
      "main": [
        [
          {
            "node": "Clean and Standardize Job Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transform Data to AI Prompt": {
      "main": [
        [
          {
            "node": "AI Content Generator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean and Standardize Job Data": {
      "main": [
        [
          {
            "node": "Transform Data to AI Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 人力资源, 多模态 AI

需要付费吗?

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

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

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

作者
外部链接
在 n8n.io 查看

分享此工作流