{
  "name": "Sentinel incident to Slack",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "sentinel-incidents",
        "authentication": "headerAuth",
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "a1f2c6d0-7e3b-4b2a-9c1d-5e6f7a8b9c01",
      "name": "Sentinel webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [0, 0],
      "webhookId": "a1f2c6d0-7e3b-4b2a-9c1d-5e6f7a8b9c01",
      "notes": "Sentinel posts every incident and recovery here. Set the Header Auth credential to the same header name and value you give the webhook in Sentinel (Integrations, Webhooks, auth type Custom header)."
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "b2e3d7e1-8f4c-4c3b-8d2e-6f7a8b9c0d12",
              "leftValue": "={{ $json.body.event }}",
              "rightValue": "(down|failed|missed|missing|found)$",
              "operator": {
                "type": "string",
                "operation": "regex"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "c3f4e8f2-9a5d-4d4c-9e3f-7a8b9c0d1e23",
      "name": "Outage or recovery?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [260, 0],
      "notes": "Event names ending in down, failed, missed, missing or found are outages (true). up, recovered and resolved are recoveries (false)."
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "name",
          "value": "#ops"
        },
        "text": "=:red_circle: *{{ $json.body.monitor.name }}* is down\n{{ $json.body.status.root_cause }}{{ $json.body.status.diagnosis ? ' · ' + $json.body.status.diagnosis.label : '' }}\n{{ $json.body.status.confirmed_regions ? 'Confirmed by ' + $json.body.status.confirmed_regions.count + ' of ' + $json.body.status.confirmed_regions.total + ' regions' : 'Seen from ' + $json.body.status.region }}\n<{{ $json.body.incident.dashboard_url }}|Open the incident>",
        "otherOptions": {}
      },
      "id": "d4a5f9a3-0b6e-4e5d-af4a-8b9c0d1e2f34",
      "name": "Post outage",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.3,
      "position": [540, -120],
      "notes": "Swap this node for Jira, PagerDuty, email or an HTTP Request to your own API. Everything in the message comes from the Sentinel payload."
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "name",
          "value": "#ops"
        },
        "text": "=:large_green_circle: *{{ $json.body.monitor.name }}* is back up\n<{{ $json.body.monitor.dashboard_url }}|Open the monitor>",
        "otherOptions": {}
      },
      "id": "e5b6a0b4-1c7f-4f6e-b05b-9c0d1e2f3a45",
      "name": "Post recovery",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.3,
      "position": [540, 120]
    }
  ],
  "connections": {
    "Sentinel webhook": {
      "main": [
        [
          {
            "node": "Outage or recovery?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Outage or recovery?": {
      "main": [
        [
          {
            "node": "Post outage",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Post recovery",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "active": false,
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false
  }
}
