{
  "name": "VYNDR · Cascade · Real-time",
  "active": false,
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "vyndr-cascade",
        "responseMode": "lastNode",
        "options": { "responseData": "noData" }
      },
      "id": "webhook-cascade",
      "name": "Webhook · /vyndr-cascade",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1.1,
      "position": [200, 240],
      "webhookId": "vyndr-cascade-replace-on-import"
    },
    {
      "parameters": {
        "url": "={{ $env.VYNDR_API_BASE }}/api/share-card",
        "method": "POST",
        "sendHeaders": true,
        "headerParameters": { "parameters": [{ "name": "Content-Type", "value": "application/json" }] },
        "sendBody": true,
        "bodyParametersJson": "={\n  \"type\": \"recap\",\n  \"format\": \"square\",\n  \"date\": \"🚨 {{ $json.trigger_detail.player || $json.trigger_type }}\",\n  \"entries\": \"={{ $json.affected_props.slice(0, 6) }}\"\n}",
        "options": { "response": { "response": { "responseFormat": "file", "outputPropertyName": "card" } } }
      },
      "id": "generate-card",
      "name": "Generate cascade card",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [440, 240]
    },
    {
      "parameters": {
        "url": "https://api.telegram.org/bot{{ $env.TELEGRAM_BOT_TOKEN }}/sendPhoto",
        "method": "POST",
        "sendBinaryData": true,
        "binaryPropertyName": "card",
        "sendBody": true,
        "bodyContentType": "multipart-form-data",
        "bodyParameters": { "parameters": [
          { "name": "chat_id", "value": "={{ $env.TELEGRAM_CHANNEL_ID }}" },
          { "name": "caption", "value": "🚨 {{ $('Webhook · /vyndr-cascade').item.json.trigger_detail.player }} — {{ $('Webhook · /vyndr-cascade').item.json.affected_props.length }} props affected · vyndr.app" }
        ] }
      },
      "id": "push-telegram",
      "name": "Push · Telegram",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [680, 120]
    },
    {
      "parameters": {
        "url": "={{ $env.DISCORD_WEBHOOK_ALERTS }}",
        "method": "POST",
        "sendBinaryData": true,
        "binaryPropertyName": "card",
        "sendBody": true,
        "bodyContentType": "multipart-form-data",
        "bodyParameters": { "parameters": [
          { "name": "payload_json", "value": "={\"username\":\"VYNDR\",\"embeds\":[{\"description\":\"🚨 Cascade — vyndr.app/dashboard\",\"color\":16728898,\"image\":{\"url\":\"attachment://vyndr.png\"},\"footer\":{\"text\":\"VYNDR · vyndr.app\"}}]}" }
        ] }
      },
      "id": "push-discord",
      "name": "Push · Discord (#alerts)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [680, 360]
    }
  ],
  "connections": {
    "Webhook · /vyndr-cascade": { "main": [[{ "node": "Generate cascade card", "type": "main", "index": 0 }]] },
    "Generate cascade card":   { "main": [[
      { "node": "Push · Telegram",        "type": "main", "index": 0 },
      { "node": "Push · Discord (#alerts)","type": "main", "index": 0 }
    ]] }
  },
  "settings": { "timezone": "America/New_York" },
  "notes": "VYNDR backend POSTs to this webhook URL when CascadeEngine fires. Auth: rotate the path slug per environment and keep it secret."
}
