{
  "name": "alert-on-risk-threshold",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "risk-alert",
        "responseMode": "responseNode"
      },
      "id": "webhook",
      "name": "Risk Alert Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        260,
        320
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": false,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "leftValue": "={{$json.body?.risk_level}}",
              "rightValue": "high",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "if",
      "name": "Is High Risk?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        500,
        320
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{$env.APP_API_BASE_URL}}/api/automation/events",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "={{'Bearer ' + $env.AUTOMATION_WEBHOOK_TOKEN}}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\"workflow\":\"alert-on-risk-threshold\",\"source\":\"n8n\",\"status\":\"success\",\"payload\":$json.body}",
        "options": {}
      },
      "id": "record",
      "name": "Record Alert",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        760,
        240
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={\"ok\": true, \"handled\": {{$json.body?.risk_level === 'high'}}}"
      },
      "id": "respond",
      "name": "Respond",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.4,
      "position": [
        980,
        320
      ]
    }
  ],
  "connections": {
    "Risk Alert Webhook": {
      "main": [
        [
          {
            "node": "Is High Risk?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is High Risk?": {
      "main": [
        [
          {
            "node": "Record Alert",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Record Alert": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {}
}