{
  "name": "Ntfyx error notifications",
  "nodes": [
    {
      "parameters": {},
      "id": "010f3ff8-b200-46c3-9bac-a617f43e8c51",
      "name": "Error Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "jsCode": "const source = $input.first().json;\nconst execution = source.execution || {};\nconst workflow = source.workflow || {};\nconst triggerError = source.trigger?.error || {};\nconst event = execution.id ? `execution-${execution.id}` : (triggerError.timestamp ? `trigger-${triggerError.timestamp}` : null);\nif (!/^[A-Za-z0-9_-]{1,64}$/.test(String(workflow.id || '')) || !event) throw new Error('No stable source event ID. Inspect and retain the original error before sending.');\nconst name = String(workflow.name || workflow.id).replace(/[\\u0000-\\u001f\\u007f]/g, ' ').trim().slice(0, 80) || String(workflow.id);\nconst lines = [`Workflow: ${name}`, `Event: ${event}`];\nif (execution.lastNodeExecuted) lines.push(`Node: ${String(execution.lastNodeExecuted).slice(0, 120)}`);\nif (execution.retryOf) lines.push(`Retry of execution: ${execution.retryOf}`);\nif (typeof execution.url === 'string' && /^https?:\\/\\//.test(execution.url)) lines.push(execution.url.slice(0, 1000));\nelse lines.push('No execution URL; inspect the workflow in n8n.');\nreturn [{json: {idempotency_key: `n8n-${workflow.id}-${event}`, payload: {title: 'n8n workflow failed', text: lines.join('\\n'), session_id: `ntfyx-n8n-${workflow.id}`.padEnd(22, '_'), session_name: name}}}];"
      },
      "id": "bb55223f-21c0-43d0-a641-2081b4fac836",
      "name": "Prepare bounded report",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        240,
        0
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://replace-with-your-private-ntfyx-url.invalid/",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Idempotency-Key",
              "value": "={{ $json.idempotency_key }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify($json.payload) }}",
        "options": {
          "redirect": {
            "redirect": {
              "followRedirects": false
            }
          },
          "response": {
            "response": {
              "fullResponse": true,
              "neverError": false,
              "responseFormat": "json"
            }
          },
          "timeout": 15000
        }
      },
      "id": "f6af45c3-e92b-4775-9053-7226964ce3d8",
      "name": "Send to Ntfyx",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        480,
        0
      ],
      "retryOnFail": false,
      "onError": "stopWorkflow",
      "notes": "Replace the URL privately with the complete HTTPS Push URL copied from Ntfyx. The full URL is a send-only secret; scrub it before sharing any workflow export. Automatic retries are disabled: after an uncertain send, retain this node's exact input and Idempotency-Key; inspect Retry-After before retrying."
    }
  ],
  "connections": {
    "Error Trigger": {
      "main": [
        [
          {
            "node": "Prepare bounded report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare bounded report": {
      "main": [
        [
          {
            "node": "Send to Ntfyx",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "tags": []
}
