The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "Lead Processor Pro (Telegram \u2192 AI \u2192 CRM)",
"nodes": [
{
"id": "Webhook_Lead",
"name": "Telegram / Form Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
260,
300
],
"parameters": {
"httpMethod": "POST",
"path": "lead-intake",
"options": {
"responseCode": 200,
"responseMode": "onReceived",
"responseData": "firstEntryJson",
"responseBody": "OK"
}
}
},
{
"id": "If_Hot_Lead",
"name": "Hot lead?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
520,
300
],
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json.message?.text || $json.text || '' }}",
"operation": "contains",
"value2": "\u043a\u0443\u043f\u0438\u0442\u044c"
},
{
"value1": "={{ $json.message?.text || $json.text || '' }}",
"operation": "contains",
"value2": "\u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c"
}
]
},
"combineOperation": "any"
}
},
{
"id": "Code_Normalize",
"name": "Normalize Lead Data",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
780,
200
],
"parameters": {
"language": "javascript",
"jsCode": "const msg = $json.message || $json;\n\nreturn {\n json: {\n name: msg.from?.first_name || msg.name || '',\n username: msg.from?.username || '',\n contact: msg.from?.phone_number || msg.phone || '',\n text: msg.text || msg.message?.text || '',\n source: 'telegram',\n createdAt: new Date().toISOString()\n }\n};"
}
},
{
"id": "AI_Classify",
"name": "Classify Lead (LLM)",
"type": "n8n-nodes-base.openAi",
"typeVersion": 1,
"position": [
1040,
200
],
"parameters": {
"resource": "chat",
"operation": "createChatCompletion",
"model": "gpt-4o-mini",
"options": {
"temperature": 0.2,
"maxTokens": 256
},
"messages": [
{
"role": "system",
"content": "\u0422\u044b \u043f\u043e\u043c\u043e\u0449\u043d\u0438\u043a \u043e\u0442\u0434\u0435\u043b\u0430 \u043f\u0440\u043e\u0434\u0430\u0436. \u041f\u043e \u0442\u0435\u043a\u0441\u0442\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043b\u0438\u0434\u0430 \u0432\u0435\u0440\u043d\u0438 JSON \u0441 \u043f\u043e\u043b\u044f\u043c\u0438: intent (\"\u0438\u043d\u0442\u0435\u0440\u0435\u0441\", \"\u0432\u043e\u043f\u0440\u043e\u0441\", \"\u0445\u043e\u043b\u043e\u0434\u043d\u044b\u0439\"), budget (\"\u043d\u0438\u0437\u043a\u0438\u0439\", \"\u0441\u0440\u0435\u0434\u043d\u0438\u0439\", \"\u0432\u044b\u0441\u043e\u043a\u0438\u0439\"), urgency (\"\u0441\u0440\u043e\u0447\u043d\u043e\", \"\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043e\u0436\u0434\u0430\u0442\u044c\"). \u041e\u0442\u0432\u0435\u0447\u0430\u0439 \u0442\u043e\u043b\u044c\u043a\u043e JSON."
},
{
"role": "user",
"content": "\u0422\u0435\u043a\u0441\u0442 \u043b\u0438\u0434\u0430: {{$json[\"text\"]}}"
}
]
}
},
{
"id": "Code_Merge",
"name": "Merge Lead + AI Tags",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1300,
200
],
"parameters": {
"language": "javascript",
"jsCode": "const lead = $items(\"Normalize Lead Data\")[0].json;\nlet tags = {};\n\ntry {\n tags = JSON.parse($json.choices[0].message.content);\n} catch (e) {}\n\nreturn {\n json: {\n ...lead,\n intent: tags.intent || '',\n budget: tags.budget || '',\n urgency: tags.urgency || ''\n }\n};"
}
},
{
"id": "Save_Sheet",
"name": "Save to Google Sheet",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 3,
"position": [
1560,
200
],
"parameters": {
"operation": "append",
"documentId": "",
"sheetId": "",
"options": {
"locationDefine": "range",
"range": "Leads!A:F"
},
"valueInputMode": "RAW",
"columns": [
"createdAt",
"name",
"username",
"contact",
"intent",
"budget",
"urgency",
"text",
"source"
],
"values": "={{ [$json.createdAt, $json.name, $json.username, $json.contact, $json.intent, $json.budget, $json.urgency, $json.text, $json.source] }}"
},
"credentials": {}
}
],
"connections": {
"Telegram / Form Webhook": {
"main": [
[
{
"node": "Hot lead?",
"type": "main",
"index": 0
}
]
]
},
"Hot lead?": {
"main": [
[
{
"node": "Normalize Lead Data",
"type": "main",
"index": 0
}
],
[]
]
},
"Normalize Lead Data": {
"main": [
[
{
"node": "Classify Lead (LLM)",
"type": "main",
"index": 0
}
]
]
},
"Classify Lead (LLM)": {
"main": [
[
{
"node": "Merge Lead + AI Tags",
"type": "main",
"index": 0
}
]
]
},
"Merge Lead + AI Tags": {
"main": [
[
{
"node": "Save to Google Sheet",
"type": "main",
"index": 0
}
]
]
}
}
}
About this workflow
Lead Processor Pro (Telegram → AI → CRM). Uses openAi, googleSheets. Webhook trigger; 6 nodes.
Source: https://github.com/Codimart/n8n-ai-agents-starter-kit/blob/main/workflows/lead-processor.json — original creator credit. Request a take-down →