{
  "name": "VYNDR · Grade of the Day · Daily 5:15 PM ET",
  "active": false,
  "nodes": [
    {
      "parameters": {
        "rule": { "interval": [{ "field": "cronExpression", "expression": "15 17 * * *" }] }
      },
      "id": "cron-gotd",
      "name": "Cron · 5:15 PM ET",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1,
      "position": [200, 200]
    },
    {
      "parameters": {
        "url": "={{ $env.VYNDR_API_BASE }}/api/props/top-graded?limit=1",
        "method": "GET",
        "options": { "timeout": 15000 }
      },
      "id": "fetch-top",
      "name": "Fetch top grade",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [440, 200]
    },
    {
      "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\": \"gotd\",\n  \"format\": \"square\",\n  \"player\": \"={{ $json.props[0].player_name }}\",\n  \"sport\": \"={{ $json.props[0].sport }}\",\n  \"stat\": \"={{ $json.props[0].stat_type }}\",\n  \"direction\": \"={{ $json.props[0].direction }}\",\n  \"line\": \"={{ $json.props[0].line }}\",\n  \"grade\": \"={{ $json.props[0].grade }}\",\n  \"projection\": \"={{ $json.props[0].projection }}\",\n  \"summary\": \"={{ $json.props[0].one_line_reason }}\"\n}",
        "options": { "response": { "response": { "responseFormat": "file", "outputPropertyName": "card" } } }
      },
      "id": "generate-card",
      "name": "Generate GOTD card",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [680, 200]
    },
    {
      "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": "◆ Grade of the Day → vyndr.app" }
        ] }
      },
      "id": "push-telegram",
      "name": "Push · Telegram",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [920, 100]
    },
    {
      "parameters": {
        "url": "={{ $env.DISCORD_WEBHOOK_RARE }}",
        "method": "POST",
        "sendBinaryData": true,
        "binaryPropertyName": "card",
        "sendBody": true,
        "bodyContentType": "multipart-form-data",
        "bodyParameters": { "parameters": [
          { "name": "payload_json", "value": "={\"username\":\"VYNDR\",\"embeds\":[{\"description\":\"◆ Grade of the Day — vyndr.app\",\"color\":56480,\"image\":{\"url\":\"attachment://vyndr.png\"},\"footer\":{\"text\":\"VYNDR · vyndr.app\"}}]}" }
        ] }
      },
      "id": "push-discord",
      "name": "Push · Discord (#rare)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [920, 300]
    }
  ],
  "connections": {
    "Cron · 5:15 PM ET":   { "main": [[{ "node": "Fetch top grade",    "type": "main", "index": 0 }]] },
    "Fetch top grade":     { "main": [[{ "node": "Generate GOTD card", "type": "main", "index": 0 }]] },
    "Generate GOTD card":  { "main": [[
      { "node": "Push · Telegram",        "type": "main", "index": 0 },
      { "node": "Push · Discord (#rare)", "type": "main", "index": 0 }
    ]] }
  },
  "settings": { "timezone": "America/New_York" }
}
