{
  "name": "Vorlux AI | Daily Digest",
  "active": false,
  "nodes": [
    { "parameters": { "rule": { "interval": [{ "field": "days", "daysInterval": 1 }] } }, "id": "sched", "name": "Daily at 8AM", "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1.2, "position": [220, 300] },
    { "parameters": { "url": "http://host.docker.internal:3010/api/health/comprehensive", "method": "GET", "options": { "timeout": 15000 } }, "id": "health", "name": "System Health", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [460, 100] },
    { "parameters": { "url": "http://host.docker.internal:3010/api/agents/metrics", "method": "GET", "options": { "timeout": 15000 } }, "id": "agents", "name": "Agent Activity", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [460, 250] },
    { "parameters": { "url": "http://host.docker.internal:3010/api/analytics/dashboard", "method": "GET", "options": { "timeout": 15000 } }, "id": "analytics", "name": "Analytics Summary", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [460, 400] },
    { "parameters": { "url": "http://host.docker.internal:3010/api/incidents", "method": "GET", "qs": { "period": "24h" }, "options": { "timeout": 15000 } }, "id": "incidents", "name": "Recent Incidents", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [460, 550] },
    { "parameters": { "mode": "runOnceForAllItems", "jsCode": "const health = $('System Health').first().json;\nconst agents = $('Agent Activity').first().json;\nconst analytics = $('Analytics Summary').first().json;\nconst incidents = $('Recent Incidents').first().json;\nconst digest = {\n  date: new Date().toISOString().split('T')[0],\n  systemHealth: health.status || health.healthy ? 'Healthy' : 'Degraded',\n  activeAgents: agents.active || agents.data?.length || 0,\n  totalTasks: agents.totalTasks || 0,\n  visitors: analytics.visitors || analytics.pageViews || 0,\n  openIncidents: (incidents.data || incidents.incidents || []).length,\n  highlights: []\n};\nreturn [{ json: digest }];" }, "id": "compile", "name": "Compile Digest", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [740, 300] },
    { "parameters": { "url": "http://host.docker.internal:3010/api/cron/daily-digest", "method": "POST", "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify($json) }}", "options": { "timeout": 15000 } }, "id": "save", "name": "Save Digest", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [980, 200] },
    { "parameters": { "method": "POST", "url": "={{$env.DISCORD_OPS_WEBHOOK}}", "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify({ content: '📋 **Daily Digest — ' + $json.date + '**\\n🏥 System: ' + $json.systemHealth + '\\n🤖 Active Agents: ' + $json.activeAgents + '\\n📊 Tasks: ' + $json.totalTasks + '\\n👁️ Visitors: ' + $json.visitors + '\\n🚨 Incidents: ' + $json.openIncidents }) }}" }, "id": "notify", "name": "Discord Notify", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [980, 400] }
  ],
  "connections": {
    "Daily at 8AM": { "main": [[{ "node": "System Health", "type": "main", "index": 0 }, { "node": "Agent Activity", "type": "main", "index": 0 }, { "node": "Analytics Summary", "type": "main", "index": 0 }, { "node": "Recent Incidents", "type": "main", "index": 0 }]] },
    "System Health": { "main": [[{ "node": "Compile Digest", "type": "main", "index": 0 }]] },
    "Agent Activity": { "main": [[{ "node": "Compile Digest", "type": "main", "index": 0 }]] },
    "Analytics Summary": { "main": [[{ "node": "Compile Digest", "type": "main", "index": 0 }]] },
    "Recent Incidents": { "main": [[{ "node": "Compile Digest", "type": "main", "index": 0 }]] },
    "Compile Digest": { "main": [[{ "node": "Save Digest", "type": "main", "index": 0 }, { "node": "Discord Notify", "type": "main", "index": 0 }]] }
  },
  "settings": { "executionOrder": "v1" }
}
