{
  "name": "TrustField Program Events \u2192 n8n",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "trustfield-program-events",
        "responseMode": "onReceived"
      },
      "id": "wh",
      "name": "Program Events Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const b = $input.first().json.body || $input.first().json;\nreturn [{ json: { chain: b.chain || 'program_events', event_type: b.event_type, registration_id: b.registration_id, source: b.source, payload: b.payload || {} } }];"
      },
      "id": "norm",
      "name": "Normalize",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        480,
        300
      ]
    },
    {
      "parameters": {
        "chatId": "={{$env.TELEGRAM_CHANNEL_ID}}",
        "text": "=TF program_event {{$json.event_type}} reg={{$json.registration_id}}"
      },
      "id": "tg",
      "name": "Optional Telegram",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1,
      "position": [
        720,
        300
      ]
    }
  ],
  "connections": {
    "Program Events Webhook": {
      "main": [
        [
          {
            "node": "Normalize",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize": {
      "main": [
        [
          {
            "node": "Optional Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "meta": {
    "description": "Point N8N_PROGRAM_EVENTS_WEBHOOK_URL or POST /api/operator/webhooks at this webhook URL."
  }
}