{
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.errorTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "id": "de2a8bbe-e734-4f16-b378-bfaad5dad64f",
      "name": "Error Trigger"
    },
    {
      "parameters": {
        "fromEmail": "your-from-email-address",
        "toEmail": "your-to-email-address",
        "subject": "=n8n Workflow Failed: {{ $json.workflow_name }}",
        "html": "={{ $json.error_message }}",
        "options": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [
        432,
        0
      ],
      "id": "6b97c898-511d-4b63-a985-0b31f8fe1b34",
      "name": "Notify User",
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "content": "",
        "height": 288,
        "width": 784,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -80
      ],
      "typeVersion": 1,
      "id": "bd00e573-5749-4eeb-94df-f1f592394bfb",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a4c22614-c423-4c72-b3ce-4f81a464db98",
              "name": "=workflow_name",
              "value": "={{ $json.workflow.name }}",
              "type": "string"
            },
            {
              "id": "04482179-110a-451e-8aa0-269a9d580a00",
              "name": "error_message",
              "value": "=<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"background:#f6f8fa; padding:20px 0;\">\n  <tr>\n    <td align=\"center\">\n\n      <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"max-width:480px; background:#ffffff; padding:20px; border-radius:8px; border:1px solid #e6e6e6;\">\n\n        <tr>\n          <td style=\"padding-bottom:10px;\">\n            <span style=\"display:inline-block; background:#e8f0ff; color:#0b3c92; padding:4px 10px; border-radius:6px; font-size:12px; font-weight:600;\">\n              verpakkingenxl \u2013 Lead Processing System\n            </span>\n          </td>\n        </tr>\n\n        <tr>\n          <td>\n            <h2 style=\"margin:0 0 10px 0;\">\ud83d\udea8 Workflow Failure</h2>\n            <p style=\"margin:0 0 20px 0;\">Your workflow encountered an error and did not complete successfully.</p>\n          </td>\n        </tr>\n\n        <tr>\n          <td>\n            <table style=\"border-collapse: collapse; width: 100%; margin: 20px 0;\">\n\n              <tr style=\"background-color: #f8f9fa;\">\n                <td style=\"padding: 12px; border: 1px solid #dee2e6; font-weight: bold;\">Workflow Name:</td>\n                <td style=\"padding: 12px; border: 1px solid #dee2e6;\">{{ $json[\"workflow\"][\"name\"] }}</td>\n              </tr>\n\n              <tr>\n                <td style=\"padding: 12px; border: 1px solid #dee2e6; font-weight: bold;\">Last Executed Node:</td>\n                <td style=\"padding: 12px; border: 1px solid #dee2e6;\">{{ $json.execution.lastNodeExecuted }}</td>\n              </tr>\n\n              <tr style=\"background-color: #f8f9fa;\">\n                <td style=\"padding: 12px; border: 1px solid #dee2e6; font-weight: bold;\">Error Message:</td>\n                <td style=\"padding: 12px; border: 1px solid #dee2e6; font-family: monospace; font-size: 12px;\">\n                  {{ $json.execution.error.message }}\n                </td>\n              </tr>\n\n              <tr>\n                <td style=\"padding: 12px; border: 1px solid #dee2e6; font-weight: bold;\">Execution URL:</td>\n                <td style=\"padding: 12px; border: 1px solid #dee2e6;\">\n                  <a href=\"{{ $json.execution.url }}\" style=\"color:#0b69ff; font-weight:bold;\" target=\"_blank\">View Execution</a>\n                </td>\n              </tr>\n\n            </table>\n          </td>\n        </tr>\n\n        <tr>\n          <td>\n            <h3>\ud83d\udccb What should you do?</h3>\n            <ol>\n              <li>Review the failed execution in n8n</li>\n              <li>Identify and fix the failing node</li>\n              <li>Re-run the workflow once the issue is resolved</li>\n            </ol>\n          </td>\n        </tr>\n\n      </table>\n\n    </td>\n  </tr>\n</table>",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        208,
        0
      ],
      "id": "1a21469f-2c6e-4119-81e3-069a704499ca",
      "name": "Edit Error Message"
    },
    {
      "parameters": {
        "content": "## \ud83d\udea8 Error Notification Workflow\n\n**Purpose:** Automatically sends email alerts when any workflow fails\n\n**How it works:**\n1. **Error Trigger** - Catches failures from any workflow\n2. **Edit Error Message** - Formats error details into HTML email\n3. **Notify User** - Sends styled email notification to admin\n\n**Email includes:**\n- Workflow name\n- Error message\n- Failed node name\n- Link to execution details\n\n**Note:** This is a global error handler for the verpakkingenxl lead processing system",
        "height": 448,
        "width": 464,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        -160
      ],
      "typeVersion": 1,
      "id": "780eff11-6712-4e21-8831-fd6469e8ab84",
      "name": "Sticky Note1"
    }
  ],
  "connections": {
    "Error Trigger": {
      "main": [
        [
          {
            "node": "Edit Error Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Error Message": {
      "main": [
        [
          {
            "node": "Notify User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "meta": {
    "templateCredsSetupCompleted": true
  }
}