{
  "name": "Instant Slack alerts for any failed workflow (universal error handler)",
  "nodes": [
    {
      "parameters": {
        "content": "## ⚡ Universal error alerts → Slack\n\nOne workflow that catches **every** thrown error on this n8n instance and posts a formatted alert to Slack — workflow name, failed node, error message and a link to the execution.\n\n### Setup (~2 minutes)\n1. Open **Send Slack alert** → attach your Slack credential and pick the alert channel.\n2. Save & activate this workflow.\n3. In **each workflow you want covered**: workflow menu → Settings → **Error Workflow** → select this one.\n\n### Good to know\n- Catches thrown errors only. A workflow whose trigger **silently stops firing** produces no error at all — use the companion *Silent-failure watchdog* template for that.\n- Any channel works: swap the Slack node for Telegram / Discord / email — the alert text is in `{{ $json.message }}`.\n\n---\n🩺 Prefer not to babysit your own monitoring? **WentQuiet** → https://wentquiet.com?ref=n8n-template — hosted silent-failure detection & anomaly alerts for n8n and Make. Founding pricing is open.",
        "width": 440,
        "height": 620
      },
      "id": "sticky-setup-1",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [-300, -40]
    },
    {
      "parameters": {},
      "id": "error-trigger-1",
      "name": "Error Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "typeVersion": 1,
      "position": [220, 160]
    },
    {
      "parameters": {
        "jsCode": "const e = $json;\nconst wfName = e.workflow?.name || 'Unknown workflow';\nconst errMsg = e.execution?.error?.message || 'No error message captured';\nconst lastNode = e.execution?.lastNodeExecuted || 'unknown';\nconst execUrl = e.execution?.url || 'Execution URL not available (enable saving failed executions in workflow settings)';\nconst message = [\n  ':rotating_light: *n8n workflow failed*',\n  `*Workflow:* ${wfName}`,\n  `*Failed node:* ${lastNode}`,\n  `*Error:* ${errMsg}`,\n  `*Execution:* ${execUrl}`,\n  `*Time:* ${new Date().toISOString()}`\n].join('\\n');\nreturn [{ json: { message, workflowName: wfName, errorMessage: errMsg } }];"
      },
      "id": "format-error-1",
      "name": "Format error",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [440, 160]
    },
    {
      "parameters": {
        "resource": "message",
        "operation": "post",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "#alerts",
          "mode": "name"
        },
        "text": "={{ $json.message }}",
        "otherOptions": {}
      },
      "id": "slack-alert-1",
      "name": "Send Slack alert",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [660, 160]
    }
  ],
  "connections": {
    "Error Trigger": {
      "main": [
        [
          {
            "node": "Format error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format error": {
      "main": [
        [
          {
            "node": "Send Slack alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {}
}
