{
  "name": "Vorlux AI | Incident Replay Collector",
  "nodes": [
    {
      "id": "a948f1e3-b6c1-48c6-8d13-663901267ab2",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        220,
        300
      ],
      "webhookId": "d4e81663-3e77-45be-9ffa-6625c409c9db",
      "parameters": {
        "httpMethod": "POST",
        "path": "incident-replay",
        "options": {
          "responseMode": "lastNode"
        }
      }
    },
    {
      "id": "ded88bf7-f343-4881-aa80-7c9fad16640c",
      "name": "Process",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        460,
        300
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const d=$input.first().json.body||$input.first().json;\nreturn [{json:{type:d.type||'stream_crash',severity:d.severity||'medium',desc:d.description||'',sessionId:d.sessionId||'',error:d.errorLog||d.error||'',ts:new Date().toISOString()}}];"
      }
    },
    {
      "id": "ebd27a00-c56f-4afd-a780-e6c07e3410d7",
      "name": "Save",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        700,
        200
      ],
      "parameters": {
        "method": "POST",
        "url": "={{$env.VORLUX_HUB_URL}}/api/incidents",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify($json) }}",
        "options": {
          "timeout": 15000
        }
      }
    },
    {
      "id": "6d5cc57e-a8b5-48c9-acaf-2646e3888be7",
      "name": "Alert",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        700,
        400
      ],
      "parameters": {
        "method": "POST",
        "url": "={{$env.DISCORD_OPS_WEBHOOK}}",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\"embeds\":[{\"title\":\"\ud83d\udea8 {{ $json.type || $json.severity || 'Alert' }}\",\"description\":\"{{ $json.desc || $json.error || 'See details' }}\",\"color\":15158332}]}",
        "options": {
          "timeout": 10000
        }
      }
    },
    {
      "id": "a7a35bdd-c8c7-4053-94cc-d688c11a9d80",
      "name": "Respond",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        940,
        300
      ],
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ok:true}) }}"
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Process",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process": {
      "main": [
        [
          {
            "node": "Save",
            "type": "main",
            "index": 0
          },
          {
            "node": "Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Alert": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true,
    "saveExecutionProgress": true
  }
}