Skip to content

In n8n, copy this file and paste it onto the canvas, or use Import from File.

{
  "name": "04 - Error Logger",
  "nodes": [
    {
      "parameters": {},
      "id": "m04e-trigger",
      "name": "Error Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "typeVersion": 1,
      "position": [0, 0]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            { "id": "f1", "name": "workflow", "value": "={{ $json.workflow.name }}", "type": "string" },
            { "id": "f2", "name": "failed_node", "value": "={{ $json.execution.lastNodeExecuted }}", "type": "string" },
            { "id": "f3", "name": "message", "value": "={{ $json.execution.error.message }}", "type": "string" },
            { "id": "f4", "name": "execution_url", "value": "={{ $json.execution.url }}", "type": "string" },
            { "id": "f5", "name": "alert", "value": "=🚨 {{ $json.workflow.name }} failed at \"{{ $json.execution.lastNodeExecuted }}\": {{ $json.execution.error.message }}\n{{ $json.execution.url }}", "type": "string" }
          ]
        },
        "options": {}
      },
      "id": "m04e-format",
      "name": "Format Alert",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [220, 0]
    },
    {
      "parameters": {},
      "id": "m04e-send",
      "name": "Send Alert (Exercise 2)",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [440, 0]
    }
  ],
  "connections": {
    "Error Trigger": { "main": [[{ "node": "Format Alert", "type": "main", "index": 0 }]] },
    "Format Alert": { "main": [[{ "node": "Send Alert (Exercise 2)", "type": "main", "index": 0 }]] }
  },
  "pinData": {},
  "settings": { "executionOrder": "v1" }
}