8
n8n 中文网amn8n.com

错误通知器-v1-无数据库

中级

这是一个DevOps领域的自动化工作流,包含 13 个节点。主要使用 Code, Gmail, Slack, Discord, Telegram 等节点。 通过Telegram、Slack和其他通讯工具进行集中错误监控和提醒

前置要求
  • Google 账号和 Gmail API 凭证
  • Slack Bot Token 或 Webhook URL
  • Discord Bot Token 或 Webhook
  • Telegram Bot Token
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "61Flju0VYVpEMHzD",
  "name": "错误通知器-v1-无数据库",
  "nodes": [
    {
      "id": "06623d7e-80a2-4f7d-86d8-99eb139760a9",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        180
      ],
      "parameters": {
        "color": 6,
        "width": 660,
        "height": 80,
        "content": "# 错误通知器"
      },
      "typeVersion": 1
    },
    {
      "id": "eb9762e3-1c49-4c18-aab0-ce04bb54d3c5",
      "name": "错误触发器",
      "type": "n8n-nodes-base.errorTrigger",
      "disabled": true,
      "position": [
        -440,
        -120
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "9925c654-17de-47c7-83b1-0b062c86be90",
      "name": "当由另一个工作流执行时",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -440,
        300
      ],
      "parameters": {
        "inputSource": "passthrough"
      },
      "typeVersion": 1.1
    },
    {
      "id": "d8ad4b78-3387-44ce-894b-4c4c21863f1c",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1000,
        -220
      ],
      "parameters": {
        "width": 440,
        "height": 300,
        "content": "# 工作原理"
      },
      "typeVersion": 1
    },
    {
      "id": "e57e084d-b215-4666-964c-01c2b17984c7",
      "name": "执行行李警报工作流程",
      "type": "n8n-nodes-base.executeWorkflow",
      "disabled": true,
      "position": [
        -220,
        -120
      ],
      "parameters": {
        "options": {},
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "61Flju0VYVpEMHzD",
          "cachedResultName": "Error_Notifier-v1-no_db"
        },
        "workflowInputs": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "51276cbe-9156-4b88-938f-95919c20fd2f",
      "name": "准备通知消息",
      "type": "n8n-nodes-base.code",
      "position": [
        -220,
        300
      ],
      "parameters": {
        "jsCode": "// Get data\nconst errorData = $input.first().json;\n\n\n// Get fallback\nconst execution = errorData.execution || {};\nconst workflow = errorData.workflow || {};\nconst error = execution.error || {};\n\n\nconst workflowName = workflow.name || 'Unknown';\n\nconst nodeName = execution?.lastNodeExecuted|| 'Unknown';\nconst errorMessage = error.message || '-';\nconst errorDescription = error?.context?.messageTemplate || 'No description';\nconst timestamp = error.timestamp ? new Date(error.timestamp).toLocaleString('ru-RU') : 'Unknown';\n\nconst executionUrl = execution.url || '#';\nconst executionId = execution.id || 'Unknown';\nconst errorLevel = error.level ? error.level.toUpperCase() : 'UNKNOWN';\n\n\nconst message = \n`🚨 <b>WORKFLOW ERROR (<a href=\"${executionUrl}\">${executionId}</a>)</b>\n\nWorkflow: <code>${workflowName}</code>\nNode: <code>${nodeName}</code>\n\n<b>${errorLevel}:</b>\n${errorMessage}\n${errorDescription}\n\n${timestamp}`;\n\n\nreturn {\n  json: {\n    message,\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "a8b62ee0-f379-47e1-b9e0-d76700edd361",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        -220
      ],
      "parameters": {
        "color": 6,
        "width": 440,
        "height": 80,
        "content": "# 错误警报器"
      },
      "typeVersion": 1
    },
    {
      "id": "32389017-571e-4efc-bb5d-155426626f01",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1000,
        180
      ],
      "parameters": {
        "width": 440,
        "height": 240,
        "content": "# 设置"
      },
      "typeVersion": 1
    },
    {
      "id": "d066e29c-9c77-4089-8560-9736db38754a",
      "name": "发送通知到 Gmail",
      "type": "n8n-nodes-base.gmail",
      "disabled": true,
      "position": [
        0,
        700
      ],
      "webhookId": "52f0cc71-1ad8-4f9a-b07c-bae9be1e217c",
      "parameters": {
        "sendTo": "@gmail.com",
        "message": "={{ $json.message }}",
        "options": {},
        "subject": "Error Workflow"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "Ixik7dvloMznqRjx",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "b38ff563-c8c9-408d-a99e-d8c93ba5f309",
      "name": "发送通知到 Whatsapp",
      "type": "n8n-nodes-base.whatsApp",
      "disabled": true,
      "position": [
        0,
        500
      ],
      "webhookId": "fde1b1fc-48dc-4d7b-b48a-c42b36225a43",
      "parameters": {
        "textBody": "={{ $json.message }}",
        "operation": "send",
        "additionalFields": {},
        "recipientPhoneNumber": "+12345678901"
      },
      "credentials": {
        "whatsAppApi": {
          "id": "p1y94W7Y28627PI2",
          "name": "WhatsApp account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "97a95663-5650-423a-a28b-ea18182c0e69",
      "name": "发送通知到 Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        0,
        300
      ],
      "webhookId": "13c616bf-a3ad-4035-998a-1dfe6021b89f",
      "parameters": {
        "text": "={{ $json.message }}",
        "chatId": "=YOUR_CHAT_ID",
        "additionalFields": {
          "parse_mode": "HTML"
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "0iSopCWwssqRXLS1",
          "name": "Error acc"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "cfa7d60b-3e58-4ad2-b445-5f918aac8823",
      "name": "发送通知到 Discord",
      "type": "n8n-nodes-base.discord",
      "disabled": true,
      "position": [
        0,
        900
      ],
      "webhookId": "ea0cb122-61d1-4457-9447-34daa40dccdc",
      "parameters": {
        "content": "={{ $json.message }}",
        "options": {},
        "authentication": "webhook"
      },
      "credentials": {
        "discordWebhookApi": {
          "id": "gD4HHWsmeRgEyl65",
          "name": "Discord Webhook account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "b1505ead-f1f1-4816-816b-e2e70cfabcb3",
      "name": "发送通知到 Slack",
      "type": "n8n-nodes-base.slack",
      "disabled": true,
      "position": [
        0,
        1100
      ],
      "webhookId": "d2b8ce70-e478-4f05-9add-37d859f73dd8",
      "parameters": {
        "text": "={{ $json.message }}",
        "user": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "select": "user",
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "kyf7L2n90PzYIt0V",
          "name": "Slack account"
        }
      },
      "typeVersion": 2.3
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "c390d2c8-192b-43eb-9cc7-02d6db4ff67a",
  "connections": {
    "Error Trigger": {
      "main": [
        [
          {
            "node": "Execute Bag Alert Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Messages For Notify": {
      "main": [
        [
          {
            "node": "Send Notify to Gmail",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Notify to Whatsapp",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Notify to Slack",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Notify to Telegram",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Notify to Discord",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Prepare Messages For Notify",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 开发运维

需要付费吗?

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

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

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

作者
Andrew

Andrew

@boanse

Analyst-Developer

外部链接
在 n8n.io 查看

分享此工作流