{
  "name": "daily-briefing-error-handler",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.errorTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "id": "900b0fd3-36c9-4bf0-927c-d05ae9f6552a",
      "name": "Error Trigger",
      "notesInFlow": true,
      "alwaysOutputData": false,
      "executeOnce": false,
      "retryOnFail": false
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "5f72384e-ba41-42dc-9480-2aeac855d442",
              "name": "executionUrl",
              "value": "={{ $json.execution.url }}",
              "type": "string"
            },
            {
              "id": "ea8664c1-d5b7-45ac-833a-63a1f1b7e2a0",
              "name": "execution.url",
              "value": "={{ $json.execution.url }}",
              "type": "string"
            },
            {
              "id": "6e93de57-6961-4f7e-9b80-290315d96fcf",
              "name": "execution.retryOf",
              "value": "={{ $json.execution.retryOf }}",
              "type": "string"
            },
            {
              "id": "65cb4034-e457-4625-9274-91515399f451",
              "name": "execution.lastNodeExecuted",
              "value": "={{ $json.execution.lastNodeExecuted }}",
              "type": "string"
            },
            {
              "id": "4af15108-3188-43b8-a7ac-f872cdd56dca",
              "name": "workflow",
              "value": "={{ $json.workflow }}",
              "type": "object"
            },
            {
              "id": "2f58c039-a8d0-46f9-903a-7d95f862ae56",
              "name": "execution.id",
              "value": "={{ $json.execution.id }}",
              "type": "number"
            },
            {
              "id": "399f5b86-96e1-4ad3-a7e8-3af657ec650e",
              "name": "execution.error.message",
              "value": "={{ $json.execution.error.message }}",
              "type": "string"
            },
            {
              "id": "a37f4dfc-568e-4639-929b-f713e5abee40",
              "name": "execution.mode",
              "value": "={{ $json.execution.mode }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        208,
        0
      ],
      "id": "c219192d-d6c6-4117-949c-64c1a09de786",
      "name": "Edit Fields Error"
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "={{ $env.SLACK_ERROR_CHANNEL }}",
          "mode": "name"
        },
        "text": "={{ `:x: *Workflow execution failed*\n*Workflow:* ${$json.workflow.name} (#${$json.workflow.id})\n*Execution ID:* ${$json.execution.id}\n*Failed node:* ${$json.execution.lastNodeExecuted}\n*Mode:* ${$json.execution.mode}\n*Retry of:* ${$json.execution.retryOf || 'n/a'}\n*Error:* ${$json.execution.error.message}\n*Execution URL:* ${$json.execution.url}` }}",
        "otherOptions": {}
      },
      "name": "Send Slack",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2,
      "position": [
        368,
        0
      ],
      "id": "7023db00-5d78-4958-94f0-6bb38d04b737",
      "retryOnFail": true,
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      },
      "onError": "continueErrorOutput"
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "={{ $env.GOOGLE_SHEETS_DOCUMENT_ID }}",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "={{ $env.GOOGLE_SHEETS_ERRORS_SHEET }}",
          "mode": "name",
          "cachedResultName": "={{ $env.GOOGLE_SHEETS_ERRORS_SHEET || 'Errors' }}"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "name": "Log to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4,
      "position": [
        608,
        112
      ],
      "id": "277124fe-4355-41d1-a2c5-3557a28c5c01",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Error Trigger": {
      "main": [
        [
          {
            "node": "Edit Fields Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields Error": {
      "main": [
        [
          {
            "node": "Send Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Slack": {
      "main": [
        [],
        [
          {
            "node": "Log to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "versionId": "2b5efd33-aa2c-426f-9de4-41ec8a989afc",
  "nodeGroups": [],
  "id": "NZuUQO34AjHlAGrA",
  "tags": []
}