{
  "name": "Foundations 06 — error handler",
  "nodes": [
    {
      "name": "Error Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "typeVersion": 1,
      "position": [-200, 0],
      "parameters": {}
    },
    {
      "name": "Alert",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [40, 0],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a0046-hol-mtq6xdz1",
              "name": "subject",
              "value": "=n8n failed: {{ $json.workflow.name }}",
              "type": "string"
            },
            {
              "id": "a0047-hol-mtq6xdz1",
              "name": "body",
              "value": "={{ $json.execution.lastNodeExecuted }} failed with: {{ $json.execution.error.message }}\n{{ $json.execution.url }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "name": "Notify",
      "notesInFlow": true,
      "notes": "Point this at your own Slack incoming webhook. The JSON body uses Slack's \"text\" key; a Discord webhook rejects that with a 400 — change the key to \"content\" before pointing this at Discord. Or swap the whole node for a Send Email node.",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [280, 0],
      "parameters": {
        "url": "https://hooks.slack.com/services/REPLACE/WITH/YOUR-WEBHOOK",
        "options": {},
        "method": "POST",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ { \"text\": $json.subject + \"\\n\" + $json.body } }}"
      }
    }
  ],
  "connections": {
    "Error Trigger": {
      "main": [
        [
          {
            "node": "Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Alert": {
      "main": [
        [
          {
            "node": "Notify",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}
