{ "name": "Outlevo: Handoffs waiting for a rep to Microsoft Teams", "nodes": [ { "id": "2ef34008-e0d1-45d1-9050-082c983b994a", "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- **Microsoft Teams**: connect your Microsoft Teams account.\n\n**API key scopes**: `handoffs:read`.\n\n**Pick in the node**:\n- **Post to Teams**: the team and the channel\n\nThen switch the workflow to **Active**.", "height": 304, "width": 620 } }, { "id": "881cbc4d-5fae-4486-b140-113f42270ff8", "name": "Every morning", "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1.2, "position": [ 0, 0 ], "parameters": { "rule": { "interval": [ { "field": "days", "daysInterval": 1, "triggerAtHour": 9 } ] } } }, { "id": "5bbeac4c-5204-42b8-837b-fba7d22aed25", "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": "4fd93386-b546-4499-a22f-90572a2498cf", "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": "6e28919f-5f98-4018-90a4-5efedb5b7b08", "name": "Post to Teams", "type": "n8n-nodes-base.microsoftTeams", "typeVersion": 2, "position": [ 720, 0 ], "parameters": { "resource": "channelMessage", "operation": "create", "teamId": { "__rl": true, "mode": "list", "value": "" }, "channelId": { "__rl": true, "mode": "list", "value": "" }, "contentType": "html", "message": "={{ $json.text.split('&').join('&').split('<').join('<').split('>').join('>').split('\\n').join('
') }}", "options": { "includeLinkToWorkflow": false } }, "credentials": { "microsoftTeamsOAuth2Api": { "id": "", "name": "Microsoft Teams" } } } ], "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": "Post to Teams", "type": "main", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" }, "pinData": {}, "meta": { "templateCredsSetupCompleted": false } }