8
n8n 中文网amn8n.com

自动化候选人状态通知器

初级

这是一个HR领域的自动化工作流,包含 5 个节点。主要使用 Slack, Webhook, Function 等节点。 通过 Slack 通知的自动化招聘状态更新

前置要求
  • Slack Bot Token 或 Webhook URL
  • HTTP Webhook 端点(n8n 会自动生成)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "q6IkLPK3fhmaaUBg",
  "meta": {
    "instanceId": "a287613f1596da776459594685fbf4e2b4a12124f80ab8c8772f5e37bff103ae"
  },
  "name": "自动化候选人状态通知器",
  "tags": [],
  "nodes": [
    {
      "id": "ef1fe3c8-04ab-404e-b703-667f21caac0a",
      "name": "1. Webhook 触发器(状态更新)",
      "type": "n8n-nodes-base.webhook",
      "position": [
        0,
        0
      ],
      "webhookId": "5f3424e2-ffb3-4248-9d3d-971e15737c1b",
      "parameters": {
        "path": "candidate-status-update",
        "options": {},
        "httpMethod": "POST"
      },
      "description": "Receives candidate status updates (e.g., from a form, ATS webhook, or custom script). Copy this Webhook URL into your sending system.",
      "typeVersion": 1
    },
    {
      "id": "60448125-d750-46ee-9e42-e92267d0407c",
      "name": "2. 提取和准备数据",
      "type": "n8n-nodes-base.function",
      "position": [
        260,
        0
      ],
      "parameters": {
        "functionCode": "const inputData = items[0].json.body;\n\n// --- IMPORTANT: ADJUST THESE FIELD NAMES TO MATCH YOUR INCOMING DATA ---\n// Common assumption: Incoming data contains 'candidateName', 'position', 'newStatus', and optionally 'oldStatus' and 'notes'.\n// Example:\n// If your system sends: { \"applicant_name\": \"John Doe\", \"job_role\": \"Software Engineer\", \"current_stage\": \"Interview Scheduled\" }\n// Adjust the variables below:\n// const candidateName = inputData.applicant_name;\n// const position = inputData.job_role;\n// const newStatus = inputData.current_stage;\n\nconst candidateName = inputData.candidateName || inputData.applicant_name || 'Unknown Candidate';\nconst position = inputData.position || inputData.job_role || 'Unknown Position';\nconst newStatus = inputData.newStatus || inputData.current_status || 'No New Status';\nconst oldStatus = inputData.oldStatus || inputData.previous_status || null;\nconst notes = inputData.notes || inputData.comment || ''; // Optional: for additional notes\n\nif (!candidateName || !newStatus) {\n  throw new Error('Candidate data (name or new status) is incomplete. Please check your data sender configuration.');\n}\n\n// Prepare message for Slack/Email\nlet statusMessage;\nif (oldStatus && newStatus !== oldStatus) {\n    statusMessage = `Candidate Status Updated: *${candidateName}* for position *${position}* changed from *${oldStatus}* to *${newStatus}*.`;\n} else {\n    statusMessage = `New Candidate Status: *${candidateName}* for position *${position}* is now *${newStatus}*.`;\n}\n\nif (notes) {\n    statusMessage += `\\nNotes: ${notes}`; // Add notes if available\n}\n\nreturn [{\n    json: {\n        candidateName: candidateName,\n        position: position,\n        newStatus: newStatus,\n        oldStatus: oldStatus,\n        slackMessage: statusMessage, // Message formatted for Slack (supports simple Markdown)\n        emailSubject: `Candidate Status Update: ${candidateName} (${position})`,\n        emailBody: statusMessage.replace(/\\*/g, '**') // Convert Slack Markdown to bold for email\n    }\n}];"
      },
      "description": "Extracts candidate details and prepares the notification message.",
      "typeVersion": 1
    },
    {
      "id": "abe896cc-945f-4d49-be11-a53932b69d3d",
      "name": "3. 发送 Slack 通知",
      "type": "n8n-nodes-base.slack",
      "position": [
        500,
        0
      ],
      "parameters": {
        "text": "={{ $json.slackMessage }}",
        "channel": "YOUR_SLACK_CHANNEL_ID_OR_NAME",
        "attachments": [],
        "otherOptions": {}
      },
      "description": "Sends a real-time notification to your Slack channel about the candidate status update.",
      "typeVersion": 1
    },
    {
      "id": "63686a52-aec3-4fb2-8bbe-24cdb61e446f",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -60
      ],
      "parameters": {
        "color": 3,
        "width": 800,
        "height": 240,
        "content": "## 流程"
      },
      "typeVersion": 1
    },
    {
      "id": "51a80419-1aaf-41b8-9d4b-bba9f866d10b",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        220
      ],
      "parameters": {
        "color": 4,
        "width": 800,
        "height": 1820,
        "content": "# 工作流文档:自动化候选人状态通知器"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1ff87f1e-2e7f-4bbb-a796-135989964d30",
  "connections": {
    "2. Extract & Prepare Data": {
      "main": [
        [
          {
            "node": "3. Send Slack Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1. Webhook Trigger (Status Update)": {
      "main": [
        [
          {
            "node": "2. Extract & Prepare Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

初级 - 人力资源

需要付费吗?

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

工作流信息
难度等级
初级
节点数量5
分类1
节点类型4
难度说明

适合 n8n 新手,包含 1-5 个节点的简单工作流

作者
Marth

Marth

@marth

Simplifying Business with Smart Automation. I create and share user-friendly, highly efficient n8n workflow templates for SMEs, focusing on digital marketing, sales, and operational excellence. Get ready to automate, innovate, and elevate your business. Connect me on Linkedin for custom solutions.

外部链接
在 n8n.io 查看

分享此工作流