{ "name": "CEO OS — Daily Planner", "nodes": [ { "id": "n2-trigger", "name": "Every Day 7:00", "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1, "position": [ 0, 300 ], "parameters": { "rule": { "interval": [ { "field": "cronExpression", "expression": "0 7 * * 1-5" } ] } } }, { "id": "n2-vars", "name": "Config", "type": "n8n-nodes-base.set", "typeVersion": 3, "position": [ 220, 300 ], "parameters": { "mode": "manual", "assignments": { "assignments": [ { "id": "b1", "name": "api", "value": "={{$env['CEO_OS_API_URL'] ?? 'https://boardmind.dev/api'}}", "type": "string" }, { "id": "b2", "name": "tenantId", "value": "={{$env['CEO_OS_TENANT_ID']}}", "type": "string" }, { "id": "b3", "name": "serviceKey", "value": "={{$env['CEO_OS_SERVICE_KEY']}}", "type": "string" } ] } } }, { "id": "n2-daily-brief", "name": "Get Daily Brief", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4, "position": [ 440, 200 ], "parameters": { "url": "={{$json.api}}/v1/ai/daily-brief", "method": "GET", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "X-Service-Key", "value": "={{$json.serviceKey}}" } ] } } }, { "id": "n2-get-tasks", "name": "Get Active Tasks", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4, "position": [ 440, 400 ], "parameters": { "url": "={{$('Config').item.json.api}}/v1/tasks?tenantId={{$('Config').item.json.tenantId}}&status=active", "method": "GET", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "X-Service-Key", "value": "={{$('Config').item.json.serviceKey}}" } ] } } }, { "id": "n2-build-plan", "name": "Build Daily Plan", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 680, 300 ], "parameters": { "jsCode": "const cfg = $('Config').item.json;\nconst brief = $('Get Daily Brief').first()?.json?.brief ?? '';\nconst tasks = $('Get Active Tasks').all().map(i => i.json);\n\n// Sort by priority tags\nconst priority = tasks.filter(t => (t.tags || []).some(g => ['urgent','important','high'].includes(g)));\nconst normal = tasks.filter(t => !priority.find(p => p.id === t.id));\n\nconst plan = [\n `📅 Planul zilei — ${new Date().toLocaleDateString('ro-RO', {weekday:'long', day:'numeric', month:'long'})}`,\n '',\n '### AI Brief',\n brief,\n '',\n `### ⚡ Prioritare (${priority.length})`,\n ...priority.slice(0, 5).map((t,i) => `${i+1}. ${t.title}`),\n '',\n `### 📋 Normale (${normal.length})`,\n ...normal.slice(0, 10).map(t => `• ${t.title}`),\n].join('\\n');\n\nreturn [{ json: {\n plan,\n totalTasks: tasks.length,\n priorityCount: priority.length,\n api: cfg.api, tenantId: cfg.tenantId, serviceKey: cfg.serviceKey,\n}}];" } }, { "id": "n2-save", "name": "Save Daily Plan", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4, "position": [ 900, 300 ], "parameters": { "url": "={{$json.api}}/v1/observations", "method": "POST", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "X-Service-Key", "value": "={{$json.serviceKey}}" }, { "name": "Content-Type", "value": "application/json" } ] }, "sendBody": true, "specifyBody": "json", "jsonBody": "={\"tenantId\": \"{{$json.tenantId}}\", \"metric\": \"daily-plan\", \"value\": {{JSON.stringify($json.plan)}}, \"unit\": \"{{$json.totalTasks}} tasks\", \"subjectType\": \"planning\", \"confidence\": 1}" } } ], "connections": { "Every Day 7:00": { "main": [ [ { "node": "Config", "type": "main", "index": 0 } ] ] }, "Config": { "main": [ [ { "node": "Get Daily Brief", "type": "main", "index": 0 }, { "node": "Get Active Tasks", "type": "main", "index": 0 } ] ] }, "Get Daily Brief": { "main": [ [ { "node": "Build Daily Plan", "type": "main", "index": 0 } ] ] }, "Get Active Tasks": { "main": [ [ { "node": "Build Daily Plan", "type": "main", "index": 0 } ] ] }, "Build Daily Plan": { "main": [ [ { "node": "Save Daily Plan", "type": "main", "index": 0 } ] ] } }, "active": false, "settings": { "executionOrder": "v1" }, "tags": [ { "name": "ceo-os" }, { "name": "automation" } ] }