{
  "name": "Lead Workflows - Global Gotify Error Handler",
  "nodes": [
    {
      "id": "125330cd-983f-4f04-8ecf-89d5ed03a7f3",
      "name": "Global Lead Workflow Error Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "typeVersion": 1,
      "position": [
        -500,
        0
      ],
      "parameters": {}
    },
    {
      "id": "fc214771-9bd4-4d66-b7ce-f33817adb54a",
      "name": "Post Lead Workflow Failure to Gotify",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -240,
        0
      ],
      "parameters": {
        "method": "POST",
        "url": "={{ (($env.GOTIFY_URL || \"http://gotify:80\").replace(/\\/$/, \"\")) + \"/message\" }}",
        "authentication": "none",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "X-Gotify-Key",
              "value": "={{ $env.GOTIFY_TOKEN }}"
            }
          ]
        },
        "sendBody": true,
        "contentType": "json",
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ title: \"n8n lead workflow failed\", message: [\"Workflow: \" + ($json.workflow?.name || $json.workflow?.id || \"unknown\"), \"Execution: \" + ($json.execution?.id || \"unknown\"), \"Node: \" + ($json.error?.node?.name || $json.error?.nodeName || \"unknown\"), \"Error: \" + ($json.error?.message || \"unknown error\")].join(\"\\n\"), priority: 8 }) }}",
        "options": {}
      }
    }
  ],
  "connections": {
    "Global Lead Workflow Error Trigger": {
      "main": [
        [
          {
            "node": "Post Lead Workflow Failure to Gotify",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "timezone": "Europe/Tirane"
  }
}
