Slack机器人N8N集成中心
中级
这是一个Engineering, Building Blocks领域的自动化工作流,包含 10 个节点。主要使用 Slack, Webhook, Function 等节点。 基于Webhook的交互式Slack审批与数据提交系统
前置要求
- •Slack Bot Token 或 Webhook URL
- •HTTP Webhook 端点(n8n 会自动生成)
使用的节点 (10)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "5rr11oY3PWtqx8az",
"meta": {
"instanceId": "c62c01f3e843893075a10f252ec7d6d69e5ab593af019f50055d506cb3081b99",
"templateCredsSetupCompleted": true
},
"name": "Slack机器人N8N集成中心",
"tags": [
{
"id": "XuoVybTXeUXuim6G",
"name": "✅ Live",
"createdAt": "2025-06-08T07:59:43.586Z",
"updatedAt": "2025-06-08T07:59:43.586Z"
},
{
"id": "RiQR5FfzNZyblqRY",
"name": "🛠️ Utility",
"createdAt": "2025-06-08T08:02:50.794Z",
"updatedAt": "2025-06-08T08:02:50.794Z"
},
{
"id": "TEMBBqocz4kZADTv",
"name": "📤 Submitted Workflows",
"createdAt": "2025-06-08T07:38:04.084Z",
"updatedAt": "2025-06-08T07:38:04.084Z"
}
],
"nodes": [
{
"id": "b62c6302-387e-4ef3-af4c-92c87fdfef1b",
"name": "n8n数据Webhook",
"type": "n8n-nodes-base.webhook",
"position": [
-140,
-360
],
"webhookId": "874768ff-6631-42a8-8c49-25b63ead3fec",
"parameters": {
"path": "874768ff-6631-42a8-8c49-25b63ead3fec",
"options": {},
"httpMethod": "POST",
"authentication": "basicAuth"
},
"credentials": {
"httpBasicAuth": {
"id": "pmJaCcMGEkPDYowB",
"name": "Basic Auth Webhook credential"
}
},
"typeVersion": 2
},
{
"id": "6e22fc14-5eb0-4dab-944f-e527b10292a2",
"name": "Slack - 数据确认",
"type": "n8n-nodes-base.slack",
"position": [
80,
-360
],
"webhookId": "16b35492-6886-4319-ade7-eca8ef1a141b",
"parameters": {
"text": "=Data Input 📥 : {{$json.body.data || $json.data || 'No data provided'}}\n\n✅ Data received and processed successfully! Your automation request has been submitted.",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "id",
"value": "A12B1C1DEFG"
},
"otherOptions": {}
},
"credentials": {
"slackApi": {
"id": "i1yhHILyYn4V6kjy",
"name": "Slack account"
}
},
"typeVersion": 2.3
},
{
"id": "48d837e7-626e-472b-b528-8b75ad2d86a5",
"name": "n8n按钮Webhook",
"type": "n8n-nodes-base.webhook",
"position": [
-140,
-80
],
"webhookId": "fa872cfc-abe3-481d-ab7c-74f78d83a070",
"parameters": {
"path": "fa872cfc-abe3-481d-ab7c-74f78d83a070",
"options": {},
"httpMethod": "POST",
"authentication": "basicAuth"
},
"credentials": {
"httpBasicAuth": {
"id": "pmJaCcMGEkPDYowB",
"name": "Basic Auth Webhook credential"
}
},
"typeVersion": 2
},
{
"id": "16390c39-acbd-437a-ae90-be702e67bed6",
"name": "处理按钮操作",
"type": "n8n-nodes-base.function",
"position": [
80,
-80
],
"parameters": {
"functionCode": "// Process approval/rejection action\nconst webhookData = items[0].json;\n\n// Extract data from the webhook payload\nconst body = webhookData.body || webhookData;\nconst action = body.action;\nconst user = body.user || {};\nconst timestamp = body.timestamp || Date.now();\n\n// Create response based on action\nlet message = '';\nlet emoji = '';\nlet status = '';\n\nconst userDisplayName = user.name || user.id || 'Unknown User';\n\nif (action === 'approve') {\n emoji = '✅';\n status = 'APPROVED';\n message = `${emoji} *Request ${status}*\\n\\n` +\n `👤 *Approved by:* ${userDisplayName}\\n` +\n `⏰ *Time:* ${new Date(timestamp).toLocaleString()}\\n` +\n `🎯 *Action:* Request has been processed successfully and approved for execution.\\n` +\n `📋 *Next Steps:* The automation workflow will proceed with the approved action.`;\n} else if (action === 'reject') {\n emoji = '❌';\n status = 'REJECTED';\n message = `${emoji} *Request ${status}*\\n\\n` +\n `👤 *Rejected by:* ${userDisplayName}\\n` +\n `⏰ *Time:* ${new Date(timestamp).toLocaleString()}\\n` +\n `🚫 *Action:* Request has been rejected and will not be processed.\\n` +\n `📋 *Next Steps:* No further action will be taken for this request.`;\n} else {\n emoji = '⚠️';\n status = 'UNKNOWN';\n message = `${emoji} *Unknown Action Received*\\n\\n` +\n `👤 *User:* ${userDisplayName}\\n` +\n `⏰ *Time:* ${new Date(timestamp).toLocaleString()}\\n` +\n `❓ *Action:* ${action || 'undefined'}\\n` +\n `📋 *Status:* Unable to process this action type.`;\n}\n\n// Return processed data\nreturn [{\n json: {\n ...webhookData,\n processedMessage: message,\n emoji: emoji,\n status: status,\n processedAt: new Date().toISOString()\n }\n}];\n"
},
"typeVersion": 1
},
{
"id": "bbb48629-5773-42d6-a3f7-10f87fbb439c",
"name": "Slack - 按钮确认",
"type": "n8n-nodes-base.slack",
"position": [
300,
-80
],
"webhookId": "16b35492-6886-4319-ade7-eca8ef1a141b",
"parameters": {
"text": "={{$json.processedMessage}}",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "id",
"value": "A12B1C1DEFG"
},
"otherOptions": {}
},
"credentials": {
"slackApi": {
"id": "i1yhHILyYn4V6kjy",
"name": "Slack account"
}
},
"typeVersion": 2.3
},
{
"id": "63a966d9-4eab-4736-9cac-74f79f1f680e",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-240,
-460
],
"parameters": {
"width": 760,
"height": 280,
"content": "## 数据Webhook"
},
"typeVersion": 1
},
{
"id": "82e8b699-3e70-4ffe-8f18-e32d15b3fc67",
"name": "便签 1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-240,
-160
],
"parameters": {
"color": 4,
"width": 760,
"height": 280,
"content": "## 按钮Webhook"
},
"typeVersion": 1
},
{
"id": "81cd3810-cc40-436c-b3a6-2c651eccf014",
"name": "便签 2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-640,
-460
],
"parameters": {
"width": 380,
"height": 240,
"content": "🚀 SLACK机器人N8N集成中心"
},
"typeVersion": 1
},
{
"id": "1aff3893-1619-43b2-9c89-37e086189716",
"name": "便签 3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-640,
-200
],
"parameters": {
"width": 380,
"height": 200,
"content": "🛠️ 快速设置指南"
},
"typeVersion": 1
},
{
"id": "c82d2e8a-34f2-4699-a1b0-c605797390e4",
"name": "便签 4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-640,
20
],
"parameters": {
"width": 380,
"height": 260,
"content": "📂 完整源代码"
},
"typeVersion": 1
}
],
"active": true,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "fef3bea8-23c9-4266-8a10-0aa072e25a74",
"connections": {
"n8n Data Webhook": {
"main": [
[
{
"node": "Slack - Data Acknowledgment",
"type": "main",
"index": 0
}
]
]
},
"n8n Button Webhook": {
"main": [
[
{
"node": "Process Button Action",
"type": "main",
"index": 0
}
]
]
},
"Process Button Action": {
"main": [
[
{
"node": "Slack - Button Acknowledgment",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 工程, 构建模块
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
🤖 高级 Slackbot(n8n)
🤖 高级 Slackbot(n8n)
If
Set
Code
+9
34 节点Mutasem
工程
基于 Bright Data MCP 的 AI Telegram 数据提取机器人
集成 Bright Data MCP 的 AI Telegram 数据提取机器人
If
N8n
Wait
+11
21 节点Cyril Nicko Gaspar
工程
Flutterflow应用的低代码API
Flutterflow应用的低代码API
Set
Webhook
Aggregate
+3
8 节点Matheus Weckwerth
工程
电子表格中带红色标记修正的代码审查
AI驱动代码审查,含代码检查、Google Sheets红色标记修正和Slack通知
Set
Slack
Function
+6
16 节点higashiyama
工程
高级AI演示(在AI开发者第14次聚会中展示)
高级AI演示(在AI开发者第14次聚会中展示)
If
Code
Gmail
+19
39 节点Max Tkacz
构建模块
自动化AWS IAM密钥泄露响应,使用Slack和Claude AI
自动化AWS IAM密钥泄露响应,使用Slack和Claude AI
Set
Code
Merge
+12
40 节点Niranjan G
人工智能
工作流信息
难度等级
中级
节点数量10
分类2
节点类型4
作者
Niranjan G
@niranjanCybersecurity leader turning complex workflows into seamless, AI-driven automations.
外部链接
在 n8n.io 查看 →
分享此工作流