{
  "id": "kGBTuEAI5bveYEdl",
  "name": "Instant Failure Alerts for Any n8n Workflow (Email + Telegram)",
  "tags": [],
  "nodes": [
    {
      "id": "049d2427-3d63-4cbc-901a-edf04a72dd22",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -112,
        -80
      ],
      "parameters": {
        "width": 480,
        "height": 720,
        "content": "## Instant Failure Alerts for Any n8n Workflow (Email + Telegram)\n\n### How it works\n\nThis workflow acts as an error handler for n8n workflows. When a workflow error occurs, it reads configured recipient details, formats an alert message, and sends the notification through email and Telegram.\n\n### Setup steps\n\n- Assign this workflow as the error workflow for the n8n workflows you want to monitor.\n- Edit the CONFIG - Edit Me First node with the destination alert email, sender email, and Telegram chat ID.\n- Configure valid email credentials for the Send Email Alert node.\n- Configure Telegram bot credentials for the Send Telegram Alert node and ensure the bot can message the configured chat.\n\n### Customization\n\nAdjust the Build Alert Message node to include different error fields, links, or formatting, and remove either notification node if you only want one alert channel."
      },
      "typeVersion": 1
    },
    {
      "id": "d325f27f-0d6c-4ca9-ba0a-ece6f94fe729",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        448,
        144
      ],
      "parameters": {
        "color": 7,
        "width": 896,
        "height": 304,
        "content": "## Capture and compose alert\n\nThis left-to-center cluster starts when any linked workflow fails, loads editable alert settings, and builds the subject and message used for notifications."
      },
      "typeVersion": 1
    },
    {
      "id": "45b4e6d2-63ae-4fb3-8d73-67a7c2d9422e",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1584,
        -80
      ],
      "parameters": {
        "color": 7,
        "height": 720,
        "content": "## Send failure notifications\n\nThis right-side output cluster sends the prepared failure alert through both email and Telegram in parallel."
      },
      "typeVersion": 1
    },
    {
      "id": "8870f4bf-c59e-4bdc-b91d-1cc2f91b5d7f",
      "name": "When Workflow Fails",
      "type": "n8n-nodes-base.errorTrigger",
      "position": [
        496,
        272
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "a0e98f1a-e06d-4c02-a5f4-e3407bc20d9c",
      "name": "Set Alert Configurations",
      "type": "n8n-nodes-base.set",
      "position": [
        864,
        272
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "cfg-alert-email",
              "name": "alert_email",
              "type": "string",
              "value": "user@example.com"
            },
            {
              "id": "cfg-from-email",
              "name": "from_email",
              "type": "string",
              "value": "user@example.com"
            },
            {
              "id": "cfg-telegram-chat",
              "name": "telegram_chat_id",
              "type": "string",
              "value": "your-telegram-chat-id"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "460efa1a-db17-4b52-9534-8ec9d5bd15c5",
      "name": "Prepare Alert Message",
      "type": "n8n-nodes-base.set",
      "position": [
        1200,
        272
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "alert-subject",
              "name": "subject",
              "type": "string",
              "value": "=\ud83d\udea8 Workflow FAILED: {{ $('When Workflow Fails').item.json.workflow?.name ?? 'Unknown workflow' }}"
            },
            {
              "id": "alert-message",
              "name": "message",
              "type": "string",
              "value": "=A monitored n8n workflow just failed.\n\nWorkflow: {{ $('When Workflow Fails').item.json.workflow?.name ?? 'Unknown' }}\nFailed node: {{ $('When Workflow Fails').item.json.execution?.error?.node?.name ?? $('When Workflow Fails').item.json.execution?.lastNodeExecuted ?? 'Unknown node' }}\nError message: {{ $('When Workflow Fails').item.json.execution?.error?.message ?? 'No error message available' }}\nTime: {{ $now.toISO() }}\n\nOpen the execution:\n{{ $('When Workflow Fails').item.json.execution?.url ?? 'Check the Executions tab in n8n' }}\n\n\u2014 Meridian Watchdog"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "9bee14fc-980b-40f6-b788-147372c7b557",
      "name": "Email Alert Notification",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1632,
        160
      ],
      "parameters": {
        "text": "={{ $json.message }}",
        "options": {},
        "subject": "={{ $json.subject }}",
        "toEmail": "={{ $('Set Alert Configurations').item.json.alert_email }}",
        "fromEmail": "={{ $('Set Alert Configurations').item.json.from_email }}",
        "emailFormat": "text"
      },
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "0d0b7fb6-d1b9-4737-861c-1c660013716e",
      "name": "Telegram Alert Notification",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1632,
        480
      ],
      "parameters": {
        "text": "={{ $json.subject }}\n\n{{ $json.message }}",
        "chatId": "={{ $('Set Alert Configurations').item.json.telegram_chat_id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "5eaf8c72-c060-4940-a918-787a9cbe7f95",
  "nodeGroups": [],
  "connections": {
    "When Workflow Fails": {
      "main": [
        [
          {
            "node": "Set Alert Configurations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Alert Message": {
      "main": [
        [
          {
            "node": "Email Alert Notification",
            "type": "main",
            "index": 0
          },
          {
            "node": "Telegram Alert Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Alert Configurations": {
      "main": [
        [
          {
            "node": "Prepare Alert Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}