{
  "name": "E \u2014 \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u0448\u0438\u0431\u043e\u043a (\u0427\u0435\u043b\u043b\u0435\u043d\u0434\u0436 200 \u0434\u043d\u0435\u0439)",
  "nodes": [
    {
      "parameters": {},
      "id": "e-trigger",
      "name": "Error Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "typeVersion": 1,
      "position": [
        -600,
        0
      ]
    },
    {
      "parameters": {
        "jsCode": "const e = $json;\nconst wf = (e.workflow && e.workflow.name) || '\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 workflow';\nconst node = (e.execution && e.execution.lastNodeExecuted) || '?';\nconst msg = (e.execution && e.execution.error && (e.execution.error.message || e.execution.error.description)) || JSON.stringify(e).slice(0, 300);\nconst execUrl = (e.execution && e.execution.url) || '';\n\nreturn [{ json: {\n  text: `\u26a0\ufe0f \u041e\u0448\u0438\u0431\u043a\u0430 \u0432 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0435\\n\\nWorkflow: ${wf}\\n\u042d\u0442\u0430\u043f (\u043d\u043e\u0434\u0430): ${node}\\n\u041e\u0448\u0438\u0431\u043a\u0430: ${String(msg).slice(0, 500)}\\n${execUrl ? 'Execution: ' + execUrl : ''}`,\n  workflow: wf,\n  node,\n  error: String(msg).slice(0, 500),\n  ts: new Date().toISOString()\n} }];"
      },
      "id": "e-format",
      "name": "\u0421\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -380,
        0
      ]
    },
    {
      "parameters": {
        "chatId": "={{ $env.TELEGRAM_CHAT_ID }}",
        "text": "={{ $json.text }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "id": "e-telegram",
      "name": "\u0423\u0432\u0435\u0434\u043e\u043c\u0438\u0442\u044c \u0432 Telegram",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        -160,
        -80
      ],
      "retryOnFail": true,
      "maxTries": 3,
      "waitBetweenTries": 5000
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $env.GOOGLE_SHEETS_ID }}"
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "log"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "timestamp": "={{ $json.ts }}",
            "workflow": "={{ $json.workflow }}",
            "node": "={{ $json.node }}",
            "error": "={{ $json.error }}"
          },
          "matchingColumns": [],
          "schema": []
        },
        "options": {}
      },
      "id": "e-log",
      "name": "\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043b\u0438\u0441\u0442 log",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        -160,
        100
      ],
      "onError": "continueRegularOutput"
    }
  ],
  "connections": {
    "Error Trigger": {
      "main": [
        [
          {
            "node": "\u0421\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0421\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435": {
      "main": [
        [
          {
            "node": "\u0423\u0432\u0435\u0434\u043e\u043c\u0438\u0442\u044c \u0432 Telegram",
            "type": "main",
            "index": 0
          },
          {
            "node": "\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043b\u0438\u0441\u0442 log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}