diff --git a/n8n/lead-intake.json b/n8n/lead-intake.json index 4c40c8a..ab5ccd1 100644 --- a/n8n/lead-intake.json +++ b/n8n/lead-intake.json @@ -5,34 +5,36 @@ "parameters": { "httpMethod": "POST", "path": "lead-intake", + "responseMode": "onReceived", "options": {} }, - "id": "2e5b1c7a-55b0-43ca-a300-d9f856b4e808", + "id": "f60ee339-9809-4962-9c5d-68ad9a5ec452", "name": "Webhook", "type": "n8n-nodes-base.webhook", "typeVersion": 2, "position": [ 240, - 304 + 300 ], - "webhookId": "ef3cbead-dfbc-494f-8030-c627603bee73" + "webhookId": "bb5f87d2-4647-4f38-9d6b-82a863158937" }, { "parameters": { - "jsCode": "const i=$input.first().json; const b=i.body||i;\nconst now=new Date().toISOString().replace('T',' ').slice(0,16);\nconst s=v=>{v=(v==null?'':String(v)); return /^[=+\\-@\\t\\r]/.test(v)?\"'\"+v:v;};\nreturn [{ json:{ lead_id:'L-'+Date.now(), received_at:now, client_id:s(b.client_id),\n source:s(b.source), name:s(b.name), contact:s(b.contact||b.email||b.phone),\n service_interest:s(b.service_interest||b.service), message:s(b.message), status:'new',\n notified:'FALSE' }}];" + "jsCode": "const i=$input.first().json; const b=i.body||i;\nconst now=new Date().toISOString().replace('T',' ').slice(0,16);\nconst s=v=>{v=(v==null?'':String(v)); return /^[=+\\-@\\t\\r]/.test(v)?\"'\"+v:v;};\nreturn [{ json:{ lead_id:'L-'+Date.now(), received_at:now, client_id:s(b.client_id),\n source:s(b.source), name:s(b.name), contact:s(b.contact||b.email||b.phone),\n service_interest:s(b.service_interest||b.service), message:s(b.message), status:'new',\n notified:'TRUE' }}];" }, - "id": "1d63c005-b837-4d76-8ecb-621fd9f142f9", + "id": "a5d0db99-93c2-46aa-8c0f-af1f4ee7300c", "name": "Build lead row", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ - 464, - 304 + 460, + 300 ] }, { "parameters": { "authentication": "serviceAccount", + "resource": "sheet", "operation": "append", "documentId": { "__rl": true, @@ -53,13 +55,13 @@ }, "options": {} }, - "id": "19c6fb29-4dd4-4860-b0e7-0ef370ca6eaa", + "id": "04c41d84-fb8c-41e3-aaba-5db270096a0c", "name": "Append to Leads", "type": "n8n-nodes-base.googleSheets", "typeVersion": 4.5, "position": [ - 688, - 304 + 680, + 300 ], "credentials": { "googleApi": { @@ -70,20 +72,46 @@ }, { "parameters": { - "jsCode": "const lead=$('Build lead row').first().json;\nconst now=new Date().toISOString().replace('T',' ').slice(0,16);\nreturn [{ json:{ ts:now, workflow:'lead-intake', client_id:lead.client_id||'',\n action:'lead captured', detail:(lead.name||'')+' / '+(lead.contact||''), result:'ok' }}];" + "resource": "message", + "operation": "sendMessage", + "chatId": "5499280257", + "text": "=\ud83c\udd95 Neue Anfrage\nName: {{ $('Build lead row').item.json.name || '\u2014' }}\nKontakt: {{ $('Build lead row').item.json.contact || '\u2014' }}\nInteresse: {{ $('Build lead row').item.json.service_interest || '\u2014' }}\nQuelle: {{ $('Build lead row').item.json.source || '\u2014' }}\nClient: {{ $('Build lead row').item.json.client_id || '\u2014' }}\nNachricht: {{ $('Build lead row').item.json.message || '\u2014' }}", + "additionalFields": { + "appendAttribution": false + } }, - "id": "95572843-5dc4-4839-a7f4-ebeaf19e5fc3", + "id": "4734816a-f253-44e4-9158-4038e4011142", + "name": "Notify Telegram", + "type": "n8n-nodes-base.telegram", + "typeVersion": 1.2, + "position": [ + 900, + 300 + ], + "credentials": { + "telegramApi": { + "id": "d9s4Ec5ocEH8FAxh", + "name": "SMB Telegram (leads bot)" + } + } + }, + { + "parameters": { + "jsCode": "const lead=$('Build lead row').first().json;\nconst now=new Date().toISOString().replace('T',' ').slice(0,16);\nreturn [{ json:{ ts:now, workflow:'lead-intake', client_id:lead.client_id||'',\n action:'lead captured + notified', detail:(lead.name||'')+' / '+(lead.contact||''), result:'ok' }}];" + }, + "id": "0c8f8de9-565a-40f3-a24f-cd1833545c4d", "name": "Build activity", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ - 912, - 304 + 1120, + 300 ] }, { "parameters": { "authentication": "serviceAccount", + "resource": "sheet", "operation": "append", "documentId": { "__rl": true, @@ -104,13 +132,13 @@ }, "options": {} }, - "id": "eed090ac-e64a-4369-9122-da535fd1139b", + "id": "6b4bf9d8-e850-473e-85d1-45aaa709d06a", "name": "Append to Activity Log", "type": "n8n-nodes-base.googleSheets", "typeVersion": 4.5, "position": [ - 1120, - 304 + 1340, + 300 ], "credentials": { "googleApi": { @@ -144,6 +172,17 @@ ] }, "Append to Leads": { + "main": [ + [ + { + "node": "Notify Telegram", + "type": "main", + "index": 0 + } + ] + ] + }, + "Notify Telegram": { "main": [ [ {