{ "name": "Outlevo: Daily credit balance to Slack", "nodes": [ { "id": "fa34ab8c-fa6b-4b4b-bb09-6a9443b0388e", "name": "How to set it up", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ -40, -364 ], "parameters": { "content": "## How to set it up\n\n**Credentials** (n8n asks for each on first open):\n- **Outlevo API key**: a Header Auth credential, name `Authorization`, value `Bearer olv_live_…` (Settings → API keys in Outlevo).\n- **Slack**: connect your Slack account.\n\n**API key scopes**: `usage:read`.\n\n**Pick in the node**:\n- **Post to Slack**: the channel (#ops by default)\n\nThen switch the workflow to **Active**.", "height": 304, "width": 620 } }, { "id": "d10779ba-89cd-4119-bda1-4304d480eebe", "name": "Every morning", "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1.2, "position": [ 0, 0 ], "parameters": { "rule": { "interval": [ { "field": "days", "daysInterval": 1, "triggerAtHour": 8 } ] } } }, { "id": "2fd1eef6-659e-498f-91d6-40091f22a1fa", "name": "Get the balance", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 240, 0 ], "parameters": { "method": "GET", "url": "=https://api.outlevo.com/v1/usage", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "options": {} }, "credentials": { "httpHeaderAuth": { "id": "", "name": "Outlevo API key (Authorization: Bearer olv_live_…)" } } }, { "id": "ab5e62ae-b779-475d-8c94-dfae65496b8a", "name": "Get the budget", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 480, 0 ], "parameters": { "method": "GET", "url": "=https://api.outlevo.com/v1/usage/budget", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "options": {} }, "credentials": { "httpHeaderAuth": { "id": "", "name": "Outlevo API key (Authorization: Bearer olv_live_…)" } } }, { "id": "cd81576b-6a2e-4264-879e-0a6cd2ef200a", "name": "Write the digest", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 720, 0 ], "parameters": { "mode": "runOnceForAllItems", "jsCode": "const u = $('Get the balance').first().json;\nconst b = $input.first().json;\nconst m = u.monthly || {};\nconst lines = [\n `Available now: ${u.available ?? 0} credits`,\n `This month's grant: ${m.remaining ?? 0} of ${m.granted ?? 0} left`,\n `Top-ups: ${(u.topups || {}).remaining ?? 0} left`,\n `Spent today: ${b.spent_today ?? 0}${b.daily_credit_budget ? ` of a ${b.daily_credit_budget} daily budget` : ''}`,\n `Spent this month: ${b.spent_this_month ?? 0}${b.monthly_credit_budget ? ` of a ${b.monthly_credit_budget} monthly budget` : ''}`,\n];\nreturn [{ json: { text: `💳 Outlevo credits:\\n${lines.map((l) => `• ${l}`).join('\\n')}\\nhttps://app.outlevo.com/billing`, subject: `Outlevo: ${u.available ?? 0} credits available` } }];\n" } }, { "id": "a8e913de-0cdb-4daf-9733-36546723d346", "name": "Post to Slack", "type": "n8n-nodes-base.slack", "typeVersion": 2.2, "position": [ 960, 0 ], "parameters": { "resource": "message", "operation": "post", "select": "channel", "channelId": { "__rl": true, "mode": "name", "value": "#ops" }, "text": "={{ $json.text }}", "otherOptions": { "includeLinkToWorkflow": false } }, "credentials": { "slackApi": { "id": "", "name": "Slack" } } } ], "connections": { "Every morning": { "main": [ [ { "node": "Get the balance", "type": "main", "index": 0 } ] ] }, "Get the balance": { "main": [ [ { "node": "Get the budget", "type": "main", "index": 0 } ] ] }, "Get the budget": { "main": [ [ { "node": "Write the digest", "type": "main", "index": 0 } ] ] }, "Write the digest": { "main": [ [ { "node": "Post to Slack", "type": "main", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" }, "pinData": {}, "meta": { "templateCredsSetupCompleted": false } }