{ "name": "Outlevo: Daily campaign totals to Microsoft Teams", "nodes": [ { "id": "ac153299-850a-4d07-8e85-0c80a6d63458", "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**: `campaigns: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": "583b39f9-d46d-44cb-a81b-4e67e9d9679a", "name": "Every morning", "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1.2, "position": [ 0, 0 ], "parameters": { "rule": { "interval": [ { "field": "days", "daysInterval": 1, "triggerAtHour": 8 } ] } } }, { "id": "db6afc96-736b-4105-8b7b-d3c3a9c3eea5", "name": "List campaigns", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 240, 0 ], "parameters": { "method": "GET", "url": "=https://api.outlevo.com/v1/campaigns", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendQuery": true, "queryParameters": { "parameters": [ { "name": "limit", "value": "100" } ] }, "options": {} }, "credentials": { "httpHeaderAuth": { "id": "", "name": "Outlevo API key (Authorization: Bearer olv_live_…)" } } }, { "id": "5fb47439-cc33-40b3-92c6-a9617efd629f", "name": "Active campaigns", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 480, 0 ], "parameters": { "mode": "runOnceForAllItems", "jsCode": "// One item per running campaign; nothing is sent when none is running.\nreturn ($input.first().json.data || []).filter((c) => c.status === 'active').map((c) => ({ json: { id: c.id, name: c.name } }));\n" } }, { "id": "92a4e09a-01ae-40a7-a63f-b84746b9fdf1", "name": "Get the numbers", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 720, 0 ], "parameters": { "method": "GET", "url": "=https://api.outlevo.com/v1/campaigns/{{ $json.id }}/stats", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "options": {} }, "credentials": { "httpHeaderAuth": { "id": "", "name": "Outlevo API key (Authorization: Bearer olv_live_…)" } } }, { "id": "fc973960-b9fd-4015-ae22-45b60b167f4a", "name": "Write the digest", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 960, 0 ], "parameters": { "mode": "runOnceForAllItems", "jsCode": "const names = $('Active campaigns').all().map((i) => i.json.name);\nconst pct = (x) => (x == null ? '—' : `${(x * 100).toFixed(1)}%`);\nconst lines = $input.all().map((i, k) => {\n const st = i.json;\n return `• ${names[k]}: ${st.sent ?? 0} sent, ${st.replied ?? 0} replies (${pct(st.reply_rate)}), ${st.interested_replies ?? 0} interested, ${st.meetings ?? 0} meetings, bounces ${pct(st.bounce_rate)}`;\n});\nreturn [{ json: { text: `📊 Outlevo campaign totals:\\n${lines.join('\\n')}\\nhttps://app.outlevo.com/campaigns`, subject: 'Outlevo campaign totals' } }];\n" } }, { "id": "17d99a9c-09f8-4e87-b304-2b3227cd2395", "name": "Post to Teams", "type": "n8n-nodes-base.microsoftTeams", "typeVersion": 2, "position": [ 1200, 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": "List campaigns", "type": "main", "index": 0 } ] ] }, "List campaigns": { "main": [ [ { "node": "Active campaigns", "type": "main", "index": 0 } ] ] }, "Active campaigns": { "main": [ [ { "node": "Get the numbers", "type": "main", "index": 0 } ] ] }, "Get the numbers": { "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 } }