339fb1a1a7
- Notify Telegram node (bot @smb_leads_bot) between Leads append and Activity Log; notified flag set TRUE. Verified end-to-end (lead → Telegram + Leads row + Activity Log). - Re-export n8n/lead-intake.json with the notify node. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
213 lines
5.7 KiB
JSON
213 lines
5.7 KiB
JSON
{
|
|
"name": "SMB \u00b7 Lead Intake",
|
|
"nodes": [
|
|
{
|
|
"parameters": {
|
|
"httpMethod": "POST",
|
|
"path": "lead-intake",
|
|
"responseMode": "onReceived",
|
|
"options": {}
|
|
},
|
|
"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": {
|
|
"authentication": "serviceAccount",
|
|
"resource": "sheet",
|
|
"operation": "append",
|
|
"documentId": {
|
|
"__rl": true,
|
|
"value": "1raMSWRZw_JfHlWqOb3LbhaQ6LWx0VGblxIV4Z2pSzp8",
|
|
"mode": "id"
|
|
},
|
|
"sheetName": {
|
|
"__rl": true,
|
|
"value": "571719114",
|
|
"mode": "list",
|
|
"cachedResultName": "Leads"
|
|
},
|
|
"columns": {
|
|
"mappingMode": "autoMapInputData",
|
|
"value": {},
|
|
"matchingColumns": [],
|
|
"schema": []
|
|
},
|
|
"options": {}
|
|
},
|
|
"id": "04c41d84-fb8c-41e3-aaba-5db270096a0c",
|
|
"name": "Append to Leads",
|
|
"type": "n8n-nodes-base.googleSheets",
|
|
"typeVersion": 4.5,
|
|
"position": [
|
|
680,
|
|
300
|
|
],
|
|
"credentials": {
|
|
"googleApi": {
|
|
"id": "45TWPyl1wVk2Vxdm",
|
|
"name": "SMB Google (service account)"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"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": "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": [
|
|
1120,
|
|
300
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"authentication": "serviceAccount",
|
|
"resource": "sheet",
|
|
"operation": "append",
|
|
"documentId": {
|
|
"__rl": true,
|
|
"value": "1raMSWRZw_JfHlWqOb3LbhaQ6LWx0VGblxIV4Z2pSzp8",
|
|
"mode": "id"
|
|
},
|
|
"sheetName": {
|
|
"__rl": true,
|
|
"value": "170940481",
|
|
"mode": "list",
|
|
"cachedResultName": "Activity Log"
|
|
},
|
|
"columns": {
|
|
"mappingMode": "autoMapInputData",
|
|
"value": {},
|
|
"matchingColumns": [],
|
|
"schema": []
|
|
},
|
|
"options": {}
|
|
},
|
|
"id": "6b4bf9d8-e850-473e-85d1-45aaa709d06a",
|
|
"name": "Append to Activity Log",
|
|
"type": "n8n-nodes-base.googleSheets",
|
|
"typeVersion": 4.5,
|
|
"position": [
|
|
1340,
|
|
300
|
|
],
|
|
"credentials": {
|
|
"googleApi": {
|
|
"id": "45TWPyl1wVk2Vxdm",
|
|
"name": "SMB Google (service account)"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"connections": {
|
|
"Webhook": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Build lead row",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Build lead row": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Append to Leads",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Append to Leads": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Notify Telegram",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Notify Telegram": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Build activity",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Build activity": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Append to Activity Log",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
},
|
|
"settings": {
|
|
"executionOrder": "v1",
|
|
"callerPolicy": "workflowsFromSameOwner",
|
|
"availableInMCP": false
|
|
}
|
|
} |