Download lead-qualification.json from omerbatutandogan/n8n-workflow-patterns: direct link, hf CLI and curl.
- Browser
- Download file 4.71 kB
-
https://huggingface.co/datasets/omerbatutandogan/n8n-workflow-patterns/resolve/main/lead-qualification.json
- Command line
-
hf download hf://datasets/omerbatutandogan/n8n-workflow-patterns/lead-qualification.json
-
curl -L -o lead-qualification.json https://huggingface.co/datasets/omerbatutandogan/n8n-workflow-patterns/resolve/main/lead-qualification.json
4.71 kB
| { | |
| "name": "Lead Qualification with LLM Scoring", | |
| "nodes": [ | |
| { | |
| "parameters": { | |
| "httpMethod": "POST", | |
| "path": "new-lead", | |
| "responseMode": "responseNode", | |
| "options": {} | |
| }, | |
| "id": "1", | |
| "name": "Webhook - New Lead", | |
| "type": "n8n-nodes-base.webhook", | |
| "typeVersion": 2, | |
| "position": [240, 300] | |
| }, | |
| { | |
| "parameters": { | |
| "jsCode": "// Normalize incoming lead payload from form/CRM webhook\nconst body = $input.first().json.body || $input.first().json;\nreturn [{\n json: {\n name: body.name || '',\n email: body.email || '',\n company: body.company || '',\n message: body.message || '',\n source: body.source || 'unknown'\n }\n}];" | |
| }, | |
| "id": "2", | |
| "name": "Normalize Lead Data", | |
| "type": "n8n-nodes-base.code", | |
| "typeVersion": 2, | |
| "position": [460, 300] | |
| }, | |
| { | |
| "parameters": { | |
| "resource": "chat", | |
| "operation": "complete", | |
| "modelId": "gpt-4o-mini", | |
| "prompt": "You are a B2B lead qualifier. Given this lead's company, message, and source, score it 1-10 for sales-readiness and return a one-sentence reason. Respond as strict JSON: {\"score\": number, \"reason\": string}.\n\nCompany: {{$json.company}}\nMessage: {{$json.message}}\nSource: {{$json.source}}", | |
| "options": { "temperature": 0.2 } | |
| }, | |
| "id": "3", | |
| "name": "Score Lead (LLM)", | |
| "type": "n8n-nodes-base.openAi", | |
| "typeVersion": 1, | |
| "position": [680, 300], | |
| "notes": "Swap for any chat-completion node (OpenAI, Anthropic, Azure OpenAI). Keep temperature low for consistent scoring." | |
| }, | |
| { | |
| "parameters": { | |
| "jsCode": "const raw = $input.first().json.message?.content || $input.first().json.text || '{}';\nlet parsed;\ntry {\n parsed = JSON.parse(raw);\n} catch (e) {\n parsed = { score: 0, reason: 'parse_error' };\n}\nreturn [{ json: { ...$('Normalize Lead Data').first().json, ...parsed } }];" | |
| }, | |
| "id": "4", | |
| "name": "Parse LLM Output", | |
| "type": "n8n-nodes-base.code", | |
| "typeVersion": 2, | |
| "position": [900, 300], | |
| "notes": "Always parse defensively — models occasionally wrap JSON in prose or markdown fences despite instructions." | |
| }, | |
| { | |
| "parameters": { | |
| "conditions": { | |
| "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict" }, | |
| "conditions": [ | |
| { | |
| "leftValue": "={{$json.score}}", | |
| "rightValue": 6, | |
| "operator": { "type": "number", "operation": "gte" } | |
| } | |
| ], | |
| "combinator": "and" | |
| } | |
| }, | |
| "id": "5", | |
| "name": "Score >= 6?", | |
| "type": "n8n-nodes-base.if", | |
| "typeVersion": 2, | |
| "position": [1120, 300] | |
| }, | |
| { | |
| "parameters": { | |
| "resource": "message", | |
| "operation": "post", | |
| "channel": "#hot-leads", | |
| "text": "🔥 Hot lead ({{$json.score}}/10): {{$json.name}} @ {{$json.company}} — {{$json.reason}}" | |
| }, | |
| "id": "6", | |
| "name": "Notify Sales (Slack)", | |
| "type": "n8n-nodes-base.slack", | |
| "typeVersion": 2, | |
| "position": [1340, 200] | |
| }, | |
| { | |
| "parameters": { | |
| "operation": "append", | |
| "sheetName": "Nurture Queue", | |
| "columns": { | |
| "value": { | |
| "name": "={{$json.name}}", | |
| "email": "={{$json.email}}", | |
| "score": "={{$json.score}}", | |
| "reason": "={{$json.reason}}" | |
| } | |
| } | |
| }, | |
| "id": "7", | |
| "name": "Log to Nurture Sheet", | |
| "type": "n8n-nodes-base.googleSheets", | |
| "typeVersion": 4, | |
| "position": [1340, 400] | |
| } | |
| ], | |
| "connections": { | |
| "Webhook - New Lead": { "main": [[{ "node": "Normalize Lead Data", "type": "main", "index": 0 }]] }, | |
| "Normalize Lead Data": { "main": [[{ "node": "Score Lead (LLM)", "type": "main", "index": 0 }]] }, | |
| "Score Lead (LLM)": { "main": [[{ "node": "Parse LLM Output", "type": "main", "index": 0 }]] }, | |
| "Parse LLM Output": { "main": [[{ "node": "Score >= 6?", "type": "main", "index": 0 }]] }, | |
| "Score >= 6?": { | |
| "main": [ | |
| [{ "node": "Notify Sales (Slack)", "type": "main", "index": 0 }], | |
| [{ "node": "Log to Nurture Sheet", "type": "main", "index": 0 }] | |
| ] | |
| } | |
| }, | |
| "meta": { | |
| "description": "Scores inbound leads with an LLM and routes hot leads to Slack, cold ones to a nurture sheet. Replace credential-bound nodes (OpenAI, Slack, Google Sheets) with your own connected accounts before running.", | |
| "requiredCredentials": ["OpenAI API (or equivalent chat-completion provider)", "Slack OAuth", "Google Sheets OAuth"] | |
| } | |
| } | |