{
  "name": "11 · Workflow Errored → PagerDuty/Slack Alert",
  "nodes": [
    {
      "name": "Lindo: Workflow Errored",
      "type": "n8n-nodes-lindo.lindoTrigger",
      "typeVersion": 1,
      "position": [
        0,
        96
      ],
      "parameters": {
        "event": "workflow.errored"
      },
      "webhookId": "18aa101b-2c08-40af-bd3e-3ef5c4c243cf",
      "credentials": {
        "lindoApi": {
          "id": "EZiHryOUuVuxcDYQ",
          "name": "Lindo account"
        }
      }
    },
    {
      "name": "Classify Severity",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        224,
        96
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "severity",
              "value": "={{ $json.data.workflow_type === \"create-website\" ? \"high\" : \"medium\" }}",
              "type": "string"
            },
            {
              "id": "a2",
              "name": "workflow_id",
              "value": "={{ $json.data.workflow_id }}",
              "type": "string"
            },
            {
              "id": "a3",
              "name": "workflow_type",
              "value": "={{ $json.data.workflow_type }}",
              "type": "string"
            },
            {
              "id": "a4",
              "name": "error_message",
              "value": "={{ $json.data.error_message }}",
              "type": "string"
            },
            {
              "id": "a5",
              "name": "website_id",
              "value": "={{ $json.data.website_id || \"\" }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "name": "Slack: Error Alert",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.4,
      "position": [
        448,
        96
      ],
      "parameters": {
        "resource": "message",
        "operation": "post",
        "channel": "#website-errors",
        "text": "=⚠️ Workflow {{ $json.workflow_id }} failed ({{ $json.workflow_type }}): {{ $json.error_message }}. Severity: {{ $json.severity }}."
      },
      "webhookId": "e156fba0-7bef-450f-8a3d-7343f455e3ee",
      "credentials": {
        "slackApi": {
          "id": "sXUjiMVMx3RPbSTG",
          "name": "Slack account"
        }
      }
    },
    {
      "name": "High Severity?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        672,
        96
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "h1",
              "leftValue": "={{ $json.severity }}",
              "rightValue": "high",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "name": "PagerDuty Incident",
      "type": "n8n-nodes-base.pagerDuty",
      "typeVersion": 1,
      "position": [
        896,
        0
      ],
      "parameters": {
        "resource": "incident",
        "operation": "create",
        "title": "=Lindo Workflow Error: {{ $(\"Classify Severity\").first().json.workflow_type }}",
        "serviceId": "",
        "urgency": "high",
        "details": "={{ $(\"Classify Severity\").first().json.error_message }}"
      }
    },
    {
      "name": "Log Error",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        896,
        192
      ],
      "parameters": {
        "resource": "sheet",
        "operation": "append",
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "workflow_id": "={{ $(\"Classify Severity\").first().json.workflow_id }}",
            "type": "={{ $(\"Classify Severity\").first().json.workflow_type }}",
            "error": "={{ $(\"Classify Severity\").first().json.error_message }}",
            "severity": "={{ $(\"Classify Severity\").first().json.severity }}",
            "date": "={{ $now.toISO() }}"
          }
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "r85NdSPIckoWBdlR",
          "name": "Google Sheets account"
        }
      }
    }
  ],
  "connections": {
    "Lindo: Workflow Errored": {
      "main": [
        [
          {
            "node": "Classify Severity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Classify Severity": {
      "main": [
        [
          {
            "node": "Slack: Error Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack: Error Alert": {
      "main": [
        [
          {
            "node": "High Severity?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "High Severity?": {
      "main": [
        [
          {
            "node": "PagerDuty Incident",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  }
}