AutomationFlowsSlack & Telegram › Intel Brief — Workflow C — Error Handler

Intel Brief — Workflow C — Error Handler

Intel Brief — Workflow C — Error Handler. Uses errorTrigger, telegram. Event-driven trigger; 4 nodes.

Event trigger★★★★☆ complexity4 nodesError TriggerTelegram
Slack & Telegram Trigger: Event Nodes: 4 Complexity: ★★★★☆ Added:

This workflow follows the Error Trigger → Telegram recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Intel Brief \u2014 Workflow C \u2014 Error Handler",
  "nodes": [
    {
      "parameters": {},
      "id": "node-error-trigger",
      "name": "Error Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "typeVersion": 1,
      "position": [
        240,
        300
      ],
      "notes": "Fires whenever any workflow that has 'Intel Brief \u2014 Workflow C \u2014 Error Handler' set as its Error Workflow encounters an unhandled error."
    },
    {
      "parameters": {
        "jsCode": "// Format error details for Telegram MarkdownV2\nconst MDV2 = /[_*[\\]()~`>#+\\-=|{}.!\\\\]/g;\nconst esc = s => String(s || '').replace(MDV2, '\\\\$&');\n\nconst data = $input.first().json;\nconst exec = data.execution || {};\nconst wf = data.workflow || {};\nconst err = exec.error || {};\n\nconst whenISO = new Date().toISOString();\nconst when = whenISO.slice(0, 19).replace('T', ' ') + ' UTC';\n\nconst workflowName = wf.name || 'unknown';\nconst lastNode = exec.lastNodeExecuted || 'unknown';\nconst execId = exec.id || 'unknown';\nconst execUrl = exec.url || '';\nconst errMsg = err.message || JSON.stringify(err).slice(0, 400);\nconst errType = err.name || '';\n\nlet msg = '*INTEL BRIEF BOT \u2014 ALERT*\\n\\n';\nmsg += `*Workflow:* ${esc(workflowName)}\\n`;\nmsg += `*Failed node:* ${esc(lastNode)}\\n`;\nmsg += `*Time:* ${esc(when)}\\n`;\nmsg += `*Execution:* ${esc(execId)}\\n\\n`;\nmsg += `*Error:* ${esc(errType)}\\n`;\nmsg += '```\\n' + esc(errMsg).slice(0, 600) + '\\n```';\nif (execUrl) {\n  msg += `\\n\\n[Open execution in n8n](${execUrl})`;\n}\n\nreturn [{ json: { alertMessage: msg } }];"
      },
      "id": "node-format-alert",
      "name": "Format Alert Message",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "chatId": "={{ $env.ALLOWED_USER_ID }}",
        "text": "={{ $json.alertMessage }}",
        "additionalFields": {
          "parse_mode": "MarkdownV2",
          "disable_web_page_preview": true
        }
      },
      "id": "node-tg-alert",
      "name": "Send Alert to Telegram",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        680,
        300
      ],
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Log error to disk for post-mortem (path-allowlist guarded)\nconst fs = require('fs');\nconst path = require('path');\nconst ALLOWED_DIR = '/data/briefs/errors';\n\nconst data = $input.first().json;\nconst exec = data.execution || {};\nconst wf = data.workflow || {};\nconst err = exec.error || {};\n\nconst stamp = new Date().toISOString().replace(/[:.]/g, '-');\nconst safeName = (wf.name || 'unknown').replace(/[^a-z0-9]/gi, '_').slice(0, 40);\nconst file = path.resolve(path.join(ALLOWED_DIR, `${stamp}_${safeName}.json`));\n\nif (!file.startsWith(ALLOWED_DIR + '/')) {\n  throw new Error('Path-allowlist violation: ' + file);\n}\n\nfs.mkdirSync(ALLOWED_DIR, { recursive: true });\nfs.writeFileSync(file, JSON.stringify({\n  at: new Date().toISOString(),\n  workflowName: wf.name,\n  workflowId: wf.id,\n  executionId: exec.id,\n  lastNode: exec.lastNodeExecuted,\n  error: err\n}, null, 2), 'utf8');\n\nreturn [{ json: { logged: file } }];"
      },
      "id": "node-log-error",
      "name": "Log Error to Disk",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        680,
        480
      ],
      "notes": "Writes error to /data/briefs/errors/. Helpful for post-mortem after the alert."
    }
  ],
  "connections": {
    "Error Trigger": {
      "main": [
        [
          {
            "node": "Format Alert Message",
            "type": "main",
            "index": 0
          },
          {
            "node": "Log Error to Disk",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Alert Message": {
      "main": [
        [
          {
            "node": "Send Alert to Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "saveExecutionProgress": true,
    "saveDataErrorExecution": "all",
    "saveDataSuccessExecution": "all",
    "timezone": "Asia/Kolkata"
  },
  "tags": [
    {
      "name": "intel-brief"
    },
    {
      "name": "phase-3"
    }
  ]
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Intel Brief — Workflow C — Error Handler. Uses errorTrigger, telegram. Event-driven trigger; 4 nodes.

Source: https://github.com/balasudharsan/intel-brief-bot/blob/main/workflows/workflow_c_error_handler.json — original creator credit. Request a take-down →

More Slack & Telegram workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Slack & Telegram

clients kept booking meetings during my prayer times. i'd either miss a prayer or scramble to reschedule. the problem wasn't the clients — it was that my calendar had no blocked windows for salah. i n

Telegram Trigger, HTTP Request, Google Calendar +3
Slack & Telegram

This workflow manages clinic appointments across Google Sheets and Google Calendar, using webhooks and Telegram to book and confirm visits, Gmail and Telegram to deliver prescriptions, scheduled Teleg

Google Calendar, Telegram, Google Sheets +4
Slack & Telegram

This workflow is an AI-powered roto matte generation and first-pass compositing pipeline designed for VFX production. It transforms structured roto requests into multiple high-precision matte passes u

HTTP Request, Slack, Error Trigger +4
Slack & Telegram

007-Error-Handler. Uses errorTrigger, googleSheets, telegram. Event-driven trigger; 19 nodes.

Error Trigger, Google Sheets, Telegram
Slack & Telegram

05 · Error Handling & Retry Template. Uses errorTrigger, googleSheets, telegram, httpRequest. Event-driven trigger; 12 nodes.

Error Trigger, Google Sheets, Telegram +1