{ "name": "Outlevo: Actions waiting for approval to Gmail", "nodes": [ { "id": "37f0eaf6-e11d-4d70-8b41-628880b5a42e", "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**: `revenue_actions:read`.\n\n**Replace**: `you@example.com`.\n\nThen switch the workflow to **Active**.", "height": 300, "width": 620 } }, { "id": "ee577746-5bbf-43b8-a87e-a67b624dd2d5", "name": "Every morning", "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1.2, "position": [ 0, 0 ], "parameters": { "rule": { "interval": [ { "field": "days", "daysInterval": 1, "triggerAtHour": 9 } ] } } }, { "id": "32eefa04-ce12-4909-8297-992921525e8c", "name": "Proposed actions", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 240, 0 ], "parameters": { "method": "GET", "url": "=https://api.outlevo.com/v1/revenue-actions", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendQuery": true, "queryParameters": { "parameters": [ { "name": "status", "value": "proposed" }, { "name": "limit", "value": "50" } ] }, "options": {} }, "credentials": { "httpHeaderAuth": { "id": "", "name": "Outlevo API key (Authorization: Bearer olv_live_…)" } } }, { "id": "669737e2-e444-4b08-9f25-ad38b07298aa", "name": "Write the digest", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 480, 0 ], "parameters": { "mode": "runOnceForAllItems", "jsCode": "const s = (v) => (v == null ? '' : typeof v === 'string' ? v : typeof v === 'object' ? JSON.stringify(v) : String(v));\nconst person = (c) => [c.first_name, c.last_name].filter(Boolean).join(' ');\nconst when = (d) => (d ? new Date(d).toUTCString().replace(/:\\d\\d GMT$/, ' UTC') : '');\nconst LABEL = { crm_task: 'CRM task', outbound_step: 'Outbound step', ad_audience: 'Ad audience', research_request: 'Research request', handoff: 'Handoff' };\nconst list = ($input.first().json.data || []).filter((a) => ['pending', 'required'].includes(a.approval_status));\nif (!list.length) return [];\nconst lines = list.slice(0, 20).map((a) => `• ${LABEL[a.action_type] || 'Action'}${a.reason ? `: ${s(a.reason).slice(0, 200)}` : ''}`);\nconst more = list.length > 20 ? `\\n…and ${list.length - 20} more` : '';\nreturn [{ json: { text: `🗳️ ${list.length} action(s) wait for your approval:\\n${lines.join('\\n')}${more}\\nhttps://app.outlevo.com/approvals`, subject: `${list.length} action(s) to approve` } }];\n" } }, { "id": "86de4dcd-6622-4081-96a1-02d38bd50d7d", "name": "Email it", "type": "n8n-nodes-base.gmail", "typeVersion": 2.1, "position": [ 720, 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": "Proposed actions", "type": "main", "index": 0 } ] ] }, "Proposed actions": { "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 } }