事件管理工作流
高级
这是一个DevOps领域的自动化工作流,包含 23 个节点。主要使用 If, Set, Code, Jira, Merge 等节点。 通过Jira、Slack、Google Sheets和Drive自动化事件响应
前置要求
- •Slack Bot Token 或 Webhook URL
- •Google Drive API 凭证
- •Google Sheets API 凭证
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "J93LxYXb9IHdMR7s",
"meta": {
"instanceId": "8443f10082278c46aa5cf3acf8ff0f70061a2c58bce76efac814b16290845177",
"templateCredsSetupCompleted": true
},
"name": "事件管理工作流",
"tags": [],
"nodes": [
{
"id": "70b38182-4e4c-4f33-9955-18712a2734ef",
"name": "当点击\"执行工作流\"时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-1008,
-48
],
"parameters": {},
"typeVersion": 1
},
{
"id": "c5e9b101-a3bb-4095-9931-10cb47abf60c",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
1760,
176
],
"parameters": {
"height": 560,
"content": "## ☁️ 将事件时间线归档到Drive"
},
"typeVersion": 1
},
{
"id": "1701890b-1a58-4f8e-8d96-94bb3d717d1d",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
1440,
160
],
"parameters": {
"height": 496,
"content": "## 📄 将时间线转换为文本文件"
},
"typeVersion": 1
},
{
"id": "eb3eeb1a-0b12-46d3-8272-47ae01ab3185",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1120,
144
],
"parameters": {
"height": 608,
"content": "## 📋 生成事件时间线报告"
},
"typeVersion": 1
},
{
"id": "1d0f80e7-e631-4054-9159-3c4db04f7d37",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
864,
-544
],
"parameters": {
"width": 256,
"height": 464,
"content": "## 📢 在Slack中提醒值班团队"
},
"typeVersion": 1
},
{
"id": "0e077e72-3423-4e55-b44d-592152210bdc",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
672,
144
],
"parameters": {
"height": 544,
"content": "## 💬 为Slack格式化事件警报"
},
"typeVersion": 1
},
{
"id": "1d072007-08da-468c-8588-673d4b714502",
"name": "便利贴5",
"type": "n8n-nodes-base.stickyNote",
"position": [
400,
-640
],
"parameters": {
"height": 528,
"content": "## 🔗 合并事件和Jira数据"
},
"typeVersion": 1
},
{
"id": "13809897-974f-4371-b18c-fcbc03a4fe4c",
"name": "便签 6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-528,
240
],
"parameters": {
"height": 480,
"content": "## 🎫 创建Jira事件工单"
},
"typeVersion": 1
},
{
"id": "1585af90-5926-46c1-8682-3c3f61682271",
"name": "便签 7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-848,
128
],
"parameters": {
"height": 480,
"content": "## 🏷️ 定义事件元数据"
},
"typeVersion": 1
},
{
"id": "ad55acbf-bd89-435c-b2f1-568749a416be",
"name": "便签8",
"type": "n8n-nodes-base.stickyNote",
"position": [
1408,
-1024
],
"parameters": {
"height": 608,
"content": "## 📊 将事件记录到状态跟踪表"
},
"typeVersion": 1
},
{
"id": "9b152b91-f8f5-472d-bb7f-115b89417238",
"name": "定义事件元数据",
"type": "n8n-nodes-base.set",
"position": [
-768,
-48
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "f0e9d84e-9714-4e29-bb86-7e1593284491",
"name": "service",
"type": "string",
"value": "API"
},
{
"id": "52c39d93-bff5-4c9f-a00d-84be94201112",
"name": "severity",
"type": "string",
"value": "High"
},
{
"id": "81d91f46-5028-4b28-a96c-3a595b3847e0",
"name": "description",
"type": "string",
"value": "Response time above 3s"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "492cf3b1-9ad6-4521-b7f5-b5a220174c01",
"name": "创建Jira事件工单",
"type": "n8n-nodes-base.jira",
"position": [
-448,
80
],
"parameters": {
"project": {
"__rl": true,
"mode": "list",
"value": "10000",
"cachedResultName": "Resource Capacity Demo"
},
"summary": "=[{{ $json[\"severity\"] }}] {{ $json[\"service\"] }} - {{ $json[\"description\"] }}",
"issueType": {
"__rl": true,
"mode": "list",
"value": "10004",
"cachedResultName": "Task"
},
"additionalFields": {
"description": "=Service: {{ $json[\"service\"] }} Severity: {{ $json[\"severity\"] }} Description: {{ $json[\"description\"] }} Created by: n8n Automation Time: {{ $now }}"
}
},
"credentials": {
"jiraSoftwareCloudApi": {
"id": "199LdjjU3PhhL8xb",
"name": "saurabh jira"
}
},
"typeVersion": 1
},
{
"id": "b6953fcb-1d76-4736-96c4-ff69fc4a815b",
"name": "合并事件和Jira数据",
"type": "n8n-nodes-base.merge",
"position": [
496,
-32
],
"parameters": {},
"typeVersion": 3.2
},
{
"id": "203c7131-85a6-4fee-8475-8ef86e7414d4",
"name": "为Slack格式化事件警报",
"type": "n8n-nodes-base.code",
"position": [
720,
-32
],
"parameters": {
"jsCode": "// n8n passes input as an array of items\nconst items = $input.all();\n\n// Expecting two objects: [alertData, jiraData]\nconst alertData = items[0].json;\nconst jiraData = items[1].json;\n\n// Merge them safely\nconst jiraKey = jiraData.key || \"N/A\";\nconst jiraLink = jiraData.self || \"N/A\";\nconst service = alertData.service || \"Unknown Service\";\nconst severity = alertData.severity || \"Unknown Severity\";\nconst description = alertData.description || \"No description provided.\";\n\n// Build the Slack message\nconst message = `🚨 *New Incident Created!*\n\n*Jira Key:* ${jiraKey}\n*Service:* ${service}\n*Severity:* ${severity}\n*Description:* ${description}\n\n🔗 [View in Jira](${jiraLink})\n_Automated via n8n Incident Workflow_`;\n\nreturn [\n {\n json: {\n jiraKey,\n jiraLink,\n service,\n severity,\n description,\n message,\n },\n },\n];\n"
},
"typeVersion": 2
},
{
"id": "9ddd6d0a-4d12-4782-bae8-a7a86c75b339",
"name": "在Slack中提醒值班团队",
"type": "n8n-nodes-base.slack",
"position": [
944,
-32
],
"webhookId": "97b0b4bb-4b13-4b4a-b0e2-f1c1aa70dad8",
"parameters": {
"text": "={{$json[\"message\"]}}\n",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "list",
"value": "C09LGDSC6GM",
"cachedResultName": "oncall"
},
"otherOptions": {}
},
"credentials": {
"slackApi": {
"id": "rNqvWj9TfChPVRYY",
"name": "Slack account vivek"
}
},
"typeVersion": 2.3
},
{
"id": "1ddfdaca-339e-4c1c-b556-0642547e605d",
"name": "生成事件时间线报告",
"type": "n8n-nodes-base.code",
"position": [
1184,
-32
],
"parameters": {
"jsCode": "const input = $input.item.json;\n\n// Extract Slack message text\nconst messageText = input.message?.text || \"No message text found.\";\n\n// Default placeholders\nlet jiraKey = \"Unknown\";\nlet service = \"Unknown\";\nlet severity = \"Unknown\";\nlet description = \"No description provided.\";\nlet jiraLink = \"\";\n\n// Parse from blocks\nif (input.message?.blocks && Array.isArray(input.message.blocks)) {\n const elements = input.message.blocks[0]?.elements[0]?.elements || [];\n\n for (let i = 0; i < elements.length; i++) {\n const el = elements[i];\n const text = (el.text || \"\").trim();\n\n if (text.startsWith(\"SCRUM-\")) jiraKey = text;\n if (text === \"API\") service = text;\n if (text === \"High\" || text === \"Medium\" || text === \"Low\") severity = text;\n if (text.includes(\"Response time\")) description = text;\n if (el.type === \"link\" && el.url.includes(\"atlassian.net\")) jiraLink = el.url;\n }\n}\n\n// Create the report text\nconst report = `\n════════════════════════════════════════════════════════════════\n INCIDENT TIMELINE REPORT\n════════════════════════════════════════════════════════════════\n\nIncident Key: ${jiraKey}\nService: ${service}\nSeverity: ${severity}\nDescription: ${description}\nStart Time: ${new Date().toLocaleString()}\n\n------------------------------------------------------------\nTimeline:\n- [${new Date().toLocaleString()}] Incident declared in Slack\n- [ ] Root cause identified\n- [ ] Fix deployed\n- [ ] Postmortem completed\n------------------------------------------------------------\n\nJira Link: ${jiraLink}\nSlack Channel: #oncall\n\n════════════════════════════════════════════════════════════════\n`;\n\nreturn [{\n json: { jiraKey, service, severity, description, jiraLink, report }\n}];\n"
},
"typeVersion": 2
},
{
"id": "a397d4ed-a764-4a5c-947c-a35846d12bf1",
"name": "将时间线转换为文本文件",
"type": "n8n-nodes-base.convertToFile",
"position": [
1504,
-32
],
"parameters": {
"options": {
"fileName": "=Incident-{{$json[\"jiraKey\"]}}.txt"
},
"operation": "toText",
"sourceProperty": "report"
},
"typeVersion": 1.1
},
{
"id": "89bff2d5-0927-41bf-a959-4f65ace76fa3",
"name": "将事件记录到状态跟踪表",
"type": "n8n-nodes-base.googleSheets",
"position": [
1488,
-384
],
"parameters": {
"columns": {
"value": {
"Status": "=\"Investigating\"",
"Service": "={{ $json.service }}",
"Jira Key": "={{ $json.jiraKey }}",
"Severity": "={{ $json.severity }}",
"Timestamp": "={{$now}}"
},
"schema": [
{
"id": "Jira Key",
"type": "string",
"display": true,
"required": false,
"displayName": "Jira Key",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Service",
"type": "string",
"display": true,
"required": false,
"displayName": "Service",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Severity",
"type": "string",
"display": true,
"required": false,
"displayName": "Severity",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Status",
"type": "string",
"display": true,
"required": false,
"displayName": "Status",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Timestamp",
"type": "string",
"display": true,
"required": false,
"displayName": "Timestamp",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1819778305,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Uldk_4BxWbdZTDZxFUeohIfeBmGHHqVEl9Ogb0l6R8Y/edit#gid=1819778305",
"cachedResultName": "status update"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1Uldk_4BxWbdZTDZxFUeohIfeBmGHHqVEl9Ogb0l6R8Y",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Uldk_4BxWbdZTDZxFUeohIfeBmGHHqVEl9Ogb0l6R8Y/edit?usp=drivesdk",
"cachedResultName": "Interviewer Brief Pack "
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "kpPEOLCGn963qpoh",
"name": "automations@techdome.ai"
}
},
"typeVersion": 4.6
},
{
"id": "a73f4bf6-4196-472c-8351-51a19f017f2f",
"name": "将事件时间线归档到Drive",
"type": "n8n-nodes-base.googleDrive",
"position": [
1792,
-32
],
"parameters": {
"name": "=Incident-Report-{{ $now.toISOString().replace(/[:]/g, \"-\") }}.txt\n",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "list",
"value": "16lOVXsq0xkvJ8sCM7hCFAghQvDOXann7",
"cachedResultUrl": "https://drive.google.com/drive/folders/16lOVXsq0xkvJ8sCM7hCFAghQvDOXann7",
"cachedResultName": "resume store"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "E7nEqUL27GUx1xHa",
"name": "Techdome Account"
}
},
"typeVersion": 3
},
{
"id": "744d9530-fe3e-4620-bbe1-8f38fd44a879",
"name": "便签 9",
"type": "n8n-nodes-base.stickyNote",
"position": [
96,
496
],
"parameters": {
"width": 304,
"height": 416,
"content": "## 📊 将Jira创建失败记录到错误表"
},
"typeVersion": 1
},
{
"id": "ab12294c-05b5-4143-939a-242f0a432fd5",
"name": "便签10",
"type": "n8n-nodes-base.stickyNote",
"position": [
-240,
240
],
"parameters": {
"height": 528,
"content": "## ✅ 验证Jira工单创建成功"
},
"typeVersion": 1
},
{
"id": "dd851020-a962-46ac-89d6-85d873479b32",
"name": "验证Jira工单创建成功",
"type": "n8n-nodes-base.if",
"position": [
-176,
80
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "b2ef1047-1b2f-4e10-bd6a-dcab015a7f99",
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "=={{ $json[\"key\"] }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "e48b4e31-981b-49fc-a395-fd23827aae5a",
"name": "将Jira创建失败记录到错误表",
"type": "n8n-nodes-base.googleSheets",
"position": [
192,
320
],
"parameters": {
"columns": {
"value": {},
"schema": [
{
"id": "error_id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "error_id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "error",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "error",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"error_id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1338537721,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Uldk_4BxWbdZTDZxFUeohIfeBmGHHqVEl9Ogb0l6R8Y/edit#gid=1338537721",
"cachedResultName": "error log sheet"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1Uldk_4BxWbdZTDZxFUeohIfeBmGHHqVEl9Ogb0l6R8Y",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Uldk_4BxWbdZTDZxFUeohIfeBmGHHqVEl9Ogb0l6R8Y/edit?usp=drivesdk",
"cachedResultName": "Interviewer Brief Pack "
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "kpPEOLCGn963qpoh",
"name": "automations@techdome.ai"
}
},
"typeVersion": 4.6
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "4d3622bd-f789-440f-993f-4573a1734744",
"connections": {
"Define Incident Metadata": {
"main": [
[
{
"node": "Combine Incident & Jira Data",
"type": "main",
"index": 0
},
{
"node": "Create Jira Incident Ticket",
"type": "main",
"index": 0
}
]
]
},
"Alert On-Call Team in Slack": {
"main": [
[
{
"node": "Generate Incident Timeline Report",
"type": "main",
"index": 0
}
]
]
},
"Create Jira Incident Ticket": {
"main": [
[
{
"node": "Validate Jira Ticket Creation Success",
"type": "main",
"index": 0
}
]
]
},
"Combine Incident & Jira Data": {
"main": [
[
{
"node": "Format Incident Alert for Slack",
"type": "main",
"index": 0
}
]
]
},
"Convert Timeline to Text File": {
"main": [
[
{
"node": "Archive Incident Timeline to Drive",
"type": "main",
"index": 0
}
]
]
},
"Format Incident Alert for Slack": {
"main": [
[
{
"node": "Alert On-Call Team in Slack",
"type": "main",
"index": 0
}
]
]
},
"Generate Incident Timeline Report": {
"main": [
[
{
"node": "Convert Timeline to Text File",
"type": "main",
"index": 0
},
{
"node": "Log Incident to Status Tracking Sheet",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Define Incident Metadata",
"type": "main",
"index": 0
}
]
]
},
"Validate Jira Ticket Creation Success": {
"main": [
[
{
"node": "Combine Incident & Jira Data",
"type": "main",
"index": 1
}
],
[
{
"node": "Log Jira Creation Failures to Error Sheet",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 开发运维
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
自动化依赖更新跟踪
使用 GPT-4o、Slack、Jira 和 Google Sheets 进行依赖更新风险分析
If
Set
Code
+8
23 节点Rahul Joshi
开发运维
自动化测试运行和状态更新
自动化工作流测试运行器,集成 Google Drive、Sheets 和 ClickUp 结果记录
If
Set
Code
+7
27 节点Rahul Joshi
API速率限制与认证FAQ测试
使用GPT-4o-mini、Google表格和Slack提醒自动化API常见问题质量测试
If
Set
Code
+7
19 节点Rahul Joshi
文档提取
新开发人员入职自动化
使用 GPT-4o 实现员工入职自动化:Jira、Notion 和 Gmail 集成
If
Set
Code
+9
21 节点Rahul Joshi
人力资源
自动化从ClickUp和GoHighLevel生成每日结束报告到Slack、Email和Google云端硬盘
从ClickUp和GoHighLevel生成AI驱动的每日结束报告到多渠道
If
Code
Merge
+12
29 节点Rahul Joshi
将服装图片上传到Cloudinary并使用Azure OpenAI (GPT-4o) 记录到工作表
使用GPT-4o、Cloudinary和Google Sheets处理和编目服装图片
Set
Code
Merge
+9
26 节点Rahul Joshi
内容创作
工作流信息
难度等级
高级
节点数量23
分类1
节点类型11
作者
Rahul Joshi
@rahul08Rahul Joshi is a seasoned technology leader specializing in the n8n automation tool and AI-driven workflow automation. With deep expertise in building open-source workflow automation and self-hosted automation platforms, he helps organizations eliminate manual processes through intelligent n8n ai agent automation solutions.
外部链接
在 n8n.io 查看 →
分享此工作流