{ "name": "Outlevo: Handoffs waiting for a rep to Gmail", "nodes": [ { "id": "eae9b98a-b3d1-473e-8eb8-621c6189d9c9", "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**: `handoffs:read`.\n\n**Replace**: `you@example.com`.\n\nThen switch the workflow to **Active**.", "height": 300, "width": 620 } }, { "id": "1539677b-9b10-4e3a-bea6-a5fc2e4eb677", "name": "Every morning", "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1.2, "position": [ 0, 0 ], "parameters": { "rule": { "interval": [ { "field": "days", "daysInterval": 1, "triggerAtHour": 9 } ] } } }, { "id": "64ee3f84-2ebb-4219-8b06-0c3f5d0b9b0a", "name": "Delivered handoffs", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 240, 0 ], "parameters": { "method": "GET", "url": "=https://api.outlevo.com/v1/handoffs", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendQuery": true, "queryParameters": { "parameters": [ { "name": "status", "value": "delivered" }, { "name": "limit", "value": "200" } ] }, "options": {} }, "credentials": { "httpHeaderAuth": { "id": "", "name": "Outlevo API key (Authorization: Bearer olv_live_…)" } } }, { "id": "2015992d-eb95-4eff-9a6b-b80100c7cb41", "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 all = [...($input.first().json.data || [])].sort((a, b) => Number(b.overdue === true) - Number(a.overdue === true) || String(a.due_at || '').localeCompare(String(b.due_at || '')));\nif (!all.length) return [];\nconst lines = all.slice(0, 20).map((h) => {\n const card = h.card || {};\n const co = card.company || {};\n const p = card.contact || {};\n return `• ${co.name || co.domain || 'An account'}${p.name ? `, ${p.name}` : ''}${h.overdue ? ' — overdue' : h.due_at ? ` — due ${when(h.due_at)}` : ''}`;\n});\nconst more = all.length > 20 ? `\\n…and ${all.length - 20} more` : '';\nreturn [{ json: { text: `🤝 ${all.length} handoff(s) waiting for a rep:\\n${lines.join('\\n')}${more}\\nhttps://app.outlevo.com/handoffs`, subject: `${all.length} handoff(s) waiting` } }];\n" } }, { "id": "933f8439-64d2-406f-99ca-d0a3f9903943", "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": "Delivered handoffs", "type": "main", "index": 0 } ] ] }, "Delivered handoffs": { "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 } }