{ "name": "SMB ยท Lead Intake", "nodes": [ { "parameters": { "httpMethod": "POST", "path": "lead-intake", "responseMode": "onReceived", "options": { "allowedOrigins": "*" } }, "id": "f60ee339-9809-4962-9c5d-68ad9a5ec452", "name": "Webhook", "type": "n8n-nodes-base.webhook", "typeVersion": 2, "position": [240, 300], "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:true }}];" }, "id": "a5d0db99-93c2-46aa-8c0f-af1f4ee7300c", "name": "Build lead row", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [460, 300] }, { "parameters": { "method": "POST", "url": "http://smb-crm:8080/api/leads", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "X-CRM-Token", "value": "__CRM_TOKEN__" } ] }, "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify($json) }}", "options": {} }, "id": "11111111-2222-3333-4444-555555555555", "name": "Save to CRM (DB)", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [680, 300], "retryOnFail": true, "maxTries": 4, "waitBetweenTries": 3000 }, { "parameters": { "resource": "message", "operation": "sendMessage", "chatId": "5499280257", "text": "=๐Ÿ†• Neue Anfrage\nName: {{ $('Build lead row').item.json.name || 'โ€”' }}\nKontakt: {{ $('Build lead row').item.json.contact || 'โ€”' }}\nInteresse: {{ $('Build lead row').item.json.service_interest || 'โ€”' }}\nQuelle: {{ $('Build lead row').item.json.source || 'โ€”' }}\nClient: {{ $('Build lead row').item.json.client_id || 'โ€”' }}\nNachricht: {{ $('Build lead row').item.json.message || 'โ€”' }}", "additionalFields": { "appendAttribution": false } }, "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)" } } } ], "connections": { "Webhook": { "main": [[{ "node": "Build lead row", "type": "main", "index": 0 }]] }, "Build lead row": { "main": [[{ "node": "Save to CRM (DB)", "type": "main", "index": 0 }]] }, "Save to CRM (DB)": { "main": [[{ "node": "Notify Telegram", "type": "main", "index": 0 }]] } }, "settings": { "executionOrder": "v1", "callerPolicy": "workflowsFromSameOwner", "availableInMCP": false } }