{
  "name": "99-error-handler",
  "nodes": [
    {
      "id": "99000000-0000-4000-8000-000000000001",
      "name": "Error terpicu",
      "type": "n8n-nodes-base.errorTrigger",
      "typeVersion": 1,
      "position": [
        260,
        300
      ],
      "parameters": {}
    },
    {
      "id": "99000000-0000-4000-8000-000000000002",
      "name": "Susun pesan",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        480,
        300
      ],
      "parameters": {
        "language": "javaScript",
        "jsCode": "const e = $input.first().json;\nconst workflowName = e['Workflow Name'] ?? e?.workflow?.name ?? 'N/A';\nconst lastNode = e['Last Node Executed'] ?? e?.execution?.lastNodeExecuted ?? 'N/A';\nconst errorMsg = e['Error Message'] ?? e?.execution?.error?.message ?? 'N/A';\nconst execId = e['Execution ID'] ?? e?.execution?.id ?? 'N/A';\nconst lines = [\n  `\u26a0\ufe0f Error workflow: ${workflowName}`,\n  `Node: ${lastNode}`,\n  `Error: ${errorMsg}`,\n  `ID eksekusi: ${execId}`,\n];\nreturn [{ json: { text: lines.join('\\n') } }];"
      }
    },
    {
      "id": "99000000-0000-4000-8000-000000000003",
      "name": "Beri tahu admin",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        700,
        300
      ],
      "parameters": {
        "resource": "message",
        "operation": "sendMessage",
        "chatId": "={{ $env.TELEGRAM_ADMIN_CHAT_ID }}",
        "text": "={{ $json.text }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Error terpicu": {
      "main": [
        [
          {
            "node": "Susun pesan",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Susun pesan": {
      "main": [
        [
          {
            "node": "Beri tahu admin",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "id": "workflow-99-error-handler"
}