{
  "id": "1M8eORwpbrr0gS6O",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Instant Error Alert Bot for Production Downtime Prevention",
  "tags": [],
  "nodes": [
    {
      "id": "2f1543ae-0f43-4797-85a7-da4aadcb91b8",
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "notes": "This node triggers the workflow when an error is received from a service like Sentry, LogRocket, or Datadog via a POST request.",
      "position": [
        -1380,
        -220
      ],
      "parameters": {
        "path": "error-alert",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 1
    },
    {
      "id": "1569b38b-c545-42dc-b2c1-9c700c9dde63",
      "name": "Filter Critical Errors",
      "type": "n8n-nodes-base.if",
      "notes": "This IF node checks if the error level is 'critical'. Only critical errors proceed to the true branch for alerting and Jira creation.",
      "position": [
        -1160,
        -220
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "{{$node['Webhook Trigger'].json['level']}}",
              "value2": "critical"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3dec4331-92f8-4136-8c0d-354edab95551",
      "name": "Send Slack Alert",
      "type": "n8n-nodes-base.slack",
      "notes": "This node sends a notification to the 'incidents' Slack channel with details about the critical error, including message, environment, and timestamp.",
      "position": [
        -940,
        -420
      ],
      "parameters": {
        "text": "\ud83d\udea8 Critical Production Error: {{$node['Webhook Trigger'].json['message']}} \nEnvironment: {{$node['Webhook Trigger'].json['environment']}} \nTimestamp: {{$node['Webhook Trigger'].json['timestamp']}}",
        "channel": "incidents",
        "attachments": [],
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5a747244-6e20-4378-b47e-e2e3b236b119",
      "name": "Create Jira Bug",
      "type": "n8n-nodes-base.jira",
      "notes": "This node creates a Jira bug in the 'PROD' project with the error message as the summary and includes environment, timestamp, and stack trace in the description.",
      "position": [
        -940,
        -220
      ],
      "parameters": {
        "project": {
          "__rl": true,
          "mode": "id",
          "value": "1234"
        },
        "summary": "Critical Production Error: {{$node['Webhook Trigger'].json['message']}}",
        "issueType": {
          "__rl": true,
          "mode": "id",
          "value": "=7654ew"
        },
        "additionalFields": {}
      },
      "credentials": {
        "jiraSoftwareCloudApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d1228ff7-1cc9-4ae1-aba6-810993efe7aa",
      "name": "No Action for Non-Critical",
      "type": "n8n-nodes-base.noOp",
      "notes": "This node is a placeholder for non-critical errors. No action is taken if the error is not critical.",
      "position": [
        -940,
        -20
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d1b4d49a-9d02-4a06-b93f-884a3a4776aa",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1960,
        -600
      ],
      "parameters": {
        "color": 3,
        "width": 760,
        "height": 280,
        "content": "## System Architecture\n- **Error Detection Pipeline**:\n  - **Webhook Trigger**: Captures incoming error data via POST requests.\n  - **Filter Critical Errors**: Identifies and separates critical errors.\n- **Alert Generation Flow**:\n  - **Send Slack Alert**: Notifies the team via Slack for critical errors.\n  - **Create Jira Bug**: Logs critical errors as Jira issues.\n- **Non-Critical Handling**:\n  - **No Action for Non-Critical**: Skips non-critical errors with no further action.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "fb67ceb7-e385-4da9-8942-109d6880d9d5",
  "connections": {
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Filter Critical Errors",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Critical Errors": {
      "main": [
        [
          {
            "node": "Send Slack Alert",
            "type": "main",
            "index": 0
          },
          {
            "node": "Create Jira Bug",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Action for Non-Critical",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}