{ "name": "Outlevo: Daily credit balance to Gmail", "nodes": [ { "id": "d207be3e-f41d-4776-9424-e599bfc6416e", "name": "How to set it up", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ -40, -360 ], "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- **Gmail**: connect your Gmail account.\n\n**API key scopes**: `usage:read`.\n\n**Replace**: `you@example.com`.\n\nThen switch the workflow to **Active**.", "height": 300, "width": 620 } }, { "id": "b677eef6-25d3-489d-b988-8049669f2cfd", "name": "Every morning", "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1.2, "position": [ 0, 0 ], "parameters": { "rule": { "interval": [ { "field": "days", "daysInterval": 1, "triggerAtHour": 8 } ] } } }, { "id": "102a0f0f-ae74-4579-a57f-099ad71b6d6c", "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": "9a33994c-679a-46e9-b634-c8ae58eaa7e6", "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": "691a2188-3bed-4759-bfb4-e5af3ad34d5a", "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": "a095c586-8474-487b-9b23-ba225780b7fc", "name": "Email it", "type": "n8n-nodes-base.gmail", "typeVersion": 2.1, "position": [ 960, 0 ], "parameters": { "sendTo": "you@example.com", "subject": "={{ $json.subject }}", "emailType": "text", "message": "={{ $json.text }}", "options": { "appendAttribution": false } }, "credentials": { "gmailOAuth2": { "id": "", "name": "Gmail" } } } ], "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": "Email it", "type": "main", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" }, "pinData": {}, "meta": { "templateCredsSetupCompleted": false } }