{ "name": "Outlevo: Booked meeting to a Pipedrive deal", "nodes": [ { "id": "356e7022-459a-44de-9265-73a614599e8f", "name": "How to set it up", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ -40, -540 ], "parameters": { "content": "## How to set it up\n\n**Credentials** (n8n asks for each on first open):\n- **Outlevo webhook signing secret**: a Crypto credential; paste the `secret` Outlevo returns when you register the webhook (below) as its secret.\n- **Outlevo API key**: a Header Auth credential, name `Authorization`, value `Bearer olv_live_…` (Settings → API keys in Outlevo).\n- **Pipedrive**: connect your Pipedrive account.\n\n**API key scopes**: `companies:read`, `contacts:read`.\n\n**Register the webhook** (needs a key with `webhooks:manage`): copy the Production URL of the **Outlevo webhook** node, then:\n```\ncurl -X POST https://api.outlevo.com/v1/webhooks \\\n -H \"Authorization: Bearer $OUTLEVO_KEY\" \\\n -H \"Idempotency-Key: $(uuidgen)\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"\", \"events\": [\"meeting.booked\"]}'\n```\nPut the `secret` from the answer into the Crypto credential.\n\nThen switch the workflow to **Active**.", "height": 480, "width": 620 } }, { "id": "571f1e39-f3ed-4fe0-b3fd-46a44cb70665", "name": "Outlevo webhook", "type": "n8n-nodes-base.webhook", "typeVersion": 2, "position": [ 0, 0 ], "parameters": { "httpMethod": "POST", "path": "outlevo-meeting-booked-to-pipedrive-deal", "responseMode": "onReceived", "options": { "rawBody": true } }, "webhookId": "36e8baf9-1929-4bec-8c68-fda78b9bb9cc" }, { "id": "0f9f59a1-4bef-4b06-ae06-859c98707155", "name": "Read the body", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 240, 0 ], "parameters": { "mode": "runOnceForAllItems", "jsCode": "// Outlevo signs every delivery: Outlevo-Signature: t=,v1=.\n// This node reads the raw body and the header; the Crypto node signs the same text with your secret; the next node compares.\nconst item = $input.first();\nconst raw = (await this.helpers.getBinaryDataBuffer(0, 'data')).toString('utf8');\nconst header = String((item.json.headers || {})['outlevo-signature'] || '');\nconst parts = header.split(',').map((kv) => kv.trim().split('='));\nconst t = Number((parts.find(([k]) => k === 't') || [])[1]) || 0;\nconst sigs = parts.filter(([k]) => k === 'v1').map(([, v]) => v || '');\nreturn [{ json: { raw, t, sigs, signed: `${t}.${raw}` } }];\n" } }, { "id": "8ef9ecd8-2f64-4ddb-8c91-a2db267bf983", "name": "Sign with your secret", "type": "n8n-nodes-base.crypto", "typeVersion": 2, "position": [ 480, 0 ], "parameters": { "action": "hmac", "type": "SHA256", "value": "={{ $json.signed }}", "dataPropertyName": "hmac", "encoding": "hex" }, "credentials": { "crypto": { "id": "", "name": "Outlevo webhook signing secret" } } }, { "id": "02e721d3-17b2-4897-9eba-1505ce7ece51", "name": "Check signature", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 720, 0 ], "parameters": { "mode": "runOnceForAllItems", "jsCode": "// Accept the event only if a v1 signature equals the HMAC and it was signed in the last 5 minutes; anything else stops here.\nconst { raw, t, sigs, hmac } = $input.first().json;\nconst same = (a, b) => { if (typeof a !== 'string' || a.length !== b.length) return false; let d = 0; for (let i = 0; i < a.length; i++) d |= a.charCodeAt(i) ^ b.charCodeAt(i); return d === 0; };\nif (!t || Math.abs(Date.now() / 1000 - t) > 300 || !sigs.some((s) => same(s, hmac))) throw new Error('Outlevo signature did not verify');\nconst event = JSON.parse(raw);\nreturn [{ json: { ...event.data, event_id: event.id, event: event.type, created_at: event.created_at } }];\n" } }, { "id": "d55b27b3-535e-4e98-80e6-c73ffe0b36ff", "name": "Meeting booked?", "type": "n8n-nodes-base.if", "typeVersion": 2, "position": [ 960, 0 ], "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict" }, "conditions": [ { "id": "4841073e-1c1d-48d6-b64f-560ba74b9742", "leftValue": "={{ $json.event }}", "rightValue": "meeting.booked", "operator": { "type": "string", "operation": "equals" } } ], "combinator": "and" }, "options": {} } }, { "id": "4cb238ed-004d-41f3-9e86-901722918291", "name": "Get the contact", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 1200, 0 ], "parameters": { "method": "GET", "url": "=https://api.outlevo.com/v1/contacts/{{ $('Meeting booked?').item.json.contact_id || 'none' }}", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "options": { "response": { "response": { "neverError": true } } } }, "credentials": { "httpHeaderAuth": { "id": "", "name": "Outlevo API key (Authorization: Bearer olv_live_…)" } } }, { "id": "7bc39a90-1c8f-4046-8858-1dce314d8abf", "name": "Get the company", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 1440, 0 ], "parameters": { "method": "GET", "url": "=https://api.outlevo.com/v1/companies/{{ $('Meeting booked?').item.json.company_id || 'none' }}", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "options": { "response": { "response": { "neverError": true } } } }, "credentials": { "httpHeaderAuth": { "id": "", "name": "Outlevo API key (Authorization: Bearer olv_live_…)" } } }, { "id": "5ec5f3bc-7207-467c-9cc4-92c7293c8c8d", "name": "Write the deal", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 1680, 0 ], "parameters": { "mode": "runOnceForAllItems", "jsCode": "const ev = $('Meeting booked?').first().json;\nconst c = $('Get the contact').first().json;\nconst co = $('Get the company').first().json;\nconst 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 company = co.name || co.domain || 'Unknown company';\nconst who = person(c);\nconst note = [`Meeting booked by Outlevo: ${when(ev.starts_at)}`, who ? `With ${who}${c.title ? `, ${c.title}` : ''}` : '', ev.title ? `Title: ${ev.title}` : '', `https://app.outlevo.com/accounts/${ev.company_id}`].filter(Boolean).join('\\n');\nreturn [{ json: { title: `${company}: meeting ${String(ev.starts_at || '').slice(0, 10)}`.trim(), company, close: new Date(Date.now() + 30 * 864e5).toISOString().slice(0, 10), note } }];\n" } }, { "id": "b3c7a8d9-c2da-4ca4-88cc-7fd3bed1b178", "name": "Add the organization", "type": "n8n-nodes-base.pipedrive", "typeVersion": 1, "position": [ 1920, 0 ], "parameters": { "resource": "organization", "operation": "create", "name": "={{ $json.company }}", "additionalFields": {} }, "credentials": { "pipedriveApi": { "id": "", "name": "Pipedrive" } } }, { "id": "f46120c7-b239-49e1-8d26-a1b9f4c54765", "name": "Add the deal", "type": "n8n-nodes-base.pipedrive", "typeVersion": 1, "position": [ 2160, 0 ], "parameters": { "resource": "deal", "operation": "create", "title": "={{ $('Write the deal').item.json.title }}", "associateWith": "organization", "org_id": "={{ $json.id }}", "additionalFields": {} }, "credentials": { "pipedriveApi": { "id": "", "name": "Pipedrive" } } }, { "id": "09fdb661-82b9-41a7-bd3a-9cdab21fae59", "name": "Add the note", "type": "n8n-nodes-base.pipedrive", "typeVersion": 1, "position": [ 2400, 0 ], "parameters": { "resource": "note", "operation": "create", "content": "={{ $('Write the deal').item.json.note }}", "additionalFields": { "deal_id": "={{ $json.id }}" } }, "credentials": { "pipedriveApi": { "id": "", "name": "Pipedrive" } } } ], "connections": { "Outlevo webhook": { "main": [ [ { "node": "Read the body", "type": "main", "index": 0 } ] ] }, "Read the body": { "main": [ [ { "node": "Sign with your secret", "type": "main", "index": 0 } ] ] }, "Sign with your secret": { "main": [ [ { "node": "Check signature", "type": "main", "index": 0 } ] ] }, "Check signature": { "main": [ [ { "node": "Meeting booked?", "type": "main", "index": 0 } ] ] }, "Meeting booked?": { "main": [ [ { "node": "Get the contact", "type": "main", "index": 0 } ], [] ] }, "Get the contact": { "main": [ [ { "node": "Get the company", "type": "main", "index": 0 } ] ] }, "Get the company": { "main": [ [ { "node": "Write the deal", "type": "main", "index": 0 } ] ] }, "Write the deal": { "main": [ [ { "node": "Add the organization", "type": "main", "index": 0 } ] ] }, "Add the organization": { "main": [ [ { "node": "Add the deal", "type": "main", "index": 0 } ] ] }, "Add the deal": { "main": [ [ { "node": "Add the note", "type": "main", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" }, "pinData": {}, "meta": { "templateCredsSetupCompleted": false } }