{
  "name": "Error alert to Telegram",
  "nodes": [
    {
      "id": "err-trigger",
      "name": "Error Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "parameters": {}
    },
    {
      "id": "err-format",
      "name": "Format alert",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        224,
        0
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "alert-text",
              "name": "alertText",
              "type": "string",
              "value": "={{ \"⚠️ Workflow failed\\n\\nWorkflow: \" + ($json.workflow && $json.workflow.name || \"unknown\") + \"\\nNode: \" + ($json.execution && $json.execution.error && $json.execution.error.node && $json.execution.error.node.name || \"unknown\") + \"\\nMessage: \" + ($json.execution && $json.execution.error && $json.execution.error.message || \"no details\") + \"\\nRun: \" + ($json.execution && $json.execution.url || \"\") }}"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "err-telegram",
      "name": "Send Telegram alert",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        448,
        0
      ],
      "parameters": {
        "chatId": "YOUR_TELEGRAM_CHAT_ID",
        "text": "={{ $json.alertText }}",
        "additionalFields": {
          "appendAttribution": false
        }
      }
    }
  ],
  "connections": {
    "Error Trigger": {
      "main": [
        [
          {
            "node": "Format alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format alert": {
      "main": [
        [
          {
            "node": "Send Telegram alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}
