{
  "name": "VW24 \u2014 Daily Revenue Report",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 24,
              "triggerAtHour": 7
            }
          ]
        }
      },
      "name": "Every Day at 7am",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1,
      "position": [
        240,
        300
      ],
      "id": "2375b4c8-2e79-4358-a86c-e641974af6df"
    },
    {
      "parameters": {
        "url": "https://vibeworld24.com/api/finance",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "name": "Fetch Finance Data",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        460,
        300
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "2",
          "name": "VW24 API Key"
        }
      },
      "id": "aa1507fc-7275-4623-adbf-f9cc7692ed0c"
    },
    {
      "parameters": {
        "functionCode": "const d = items[0].json;\nconst today = new Date().toLocaleDateString('en-GB', {weekday:'long',day:'2-digit',month:'long',year:'numeric'});\nconst recentRev = d.revenueHistory?.slice(-1)[0]?.revenue || 0;\nconst prevRev   = d.revenueHistory?.slice(-2)[0]?.revenue || 0;\nconst growth    = prevRev > 0 ? (((recentRev - prevRev) / prevRev) * 100).toFixed(1) : '0';\nreturn [{ json: {\n  ...d,\n  today,\n  recentRev: Math.round(recentRev),\n  growth,\n  growthStr: parseFloat(growth) >= 0 ? '\u2191 +' + growth + '%' : '\u2193 ' + growth + '%'\n}}];"
      },
      "name": "Calculate Metrics",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        680,
        300
      ],
      "id": "77ca028d-a7df-4ec2-b37e-15d1b30276c8"
    },
    {
      "parameters": {
        "fromEmail": "info@vibeworld24.com",
        "toEmail": "klodiantaipi51@gmail.com",
        "subject": "\ud83d\udcca VW24 Daily Revenue Report \u2014 {{$json.today}}",
        "emailType": "html",
        "message": "<!DOCTYPE html><html><head><style>body{margin:0;padding:0;background:#03030f;font-family:'Segoe UI',sans-serif;color:#e2e8f0}.wrap{max-width:600px;margin:0 auto;padding:30px 20px}.header{background:linear-gradient(135deg,#00f0ff15,#7c3aed15);border:1px solid rgba(0,240,255,.12);border-radius:16px;padding:24px;text-align:center;margin-bottom:20px}.logo{font-size:1.4rem;font-weight:900;background:linear-gradient(135deg,#00f0ff,#7c3aed);-webkit-background-clip:text;-webkit-text-fill-color:transparent}.kpi-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:16px}.kpi{background:#0d0d22;border:1px solid rgba(0,240,255,.1);border-radius:12px;padding:16px;text-align:center}.kpi-val{font-size:1.8rem;font-weight:900;color:#00f0ff;line-height:1}.kpi-lbl{font-size:.7rem;color:#5a6a82;margin-top:6px}.footer{text-align:center;font-size:.72rem;color:#2a3a55;margin-top:20px}</style></head><body><div class=\"wrap\"><div class=\"header\"><div class=\"logo\">VibeWorld24</div><div style=\"color:#5a6a82;font-size:.8rem;margin-top:4px\">Daily Revenue Report \u00b7 {{$json.today}}</div></div><div class=\"kpi-grid\"><div class=\"kpi\"><div class=\"kpi-val\">\u20ac{{$json.mrr}}</div><div class=\"kpi-lbl\">Monthly Recurring Revenue</div></div><div class=\"kpi\"><div class=\"kpi-val\" style=\"color:#a78bfa\">\u20ac{{$json.arr}}</div><div class=\"kpi-lbl\">Annual Recurring Revenue</div></div><div class=\"kpi\"><div class=\"kpi-val\" style=\"color:#00ff88\">{{$json.activeSubscriptions}}</div><div class=\"kpi-lbl\">Active Subscribers</div></div><div class=\"kpi\"><div class=\"kpi-val\" style=\"color:#ffa502\">{{$json.conversionRate}}%</div><div class=\"kpi-lbl\">Conversion Rate</div></div></div><div style=\"background:#0d0d22;border:1px solid rgba(0,240,255,.08);border-radius:12px;padding:16px;margin-bottom:16px\"><div style=\"font-size:.8rem;color:#5a6a82;margin-bottom:8px\">Monthly Growth</div><div style=\"font-size:1.4rem;font-weight:800;color:#00ff88\">{{$json.growthStr}}</div></div><div class=\"footer\">VibeWorld24 \u00b7 Automated Daily Report \u00b7 <a href=\"https://vibeworld24.com/finance.html\" style=\"color:#5a6a82\">View Finance Hub \u2192</a></div></div></body></html>"
      },
      "name": "Send Daily Report",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 1,
      "position": [
        900,
        300
      ],
      "credentials": {
        "smtp": {
          "id": "1",
          "name": "VW24 SMTP"
        }
      },
      "id": "3034c331-b821-4755-a419-4689527f6026"
    }
  ],
  "connections": {
    "Every Day at 7am": {
      "main": [
        [
          {
            "node": "Fetch Finance Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Finance Data": {
      "main": [
        [
          {
            "node": "Calculate Metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Metrics": {
      "main": [
        [
          {
            "node": "Send Daily Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "id": "fed54eba-e0d1-4bac-8c36-2659e26c4ae0"
}