{ "name": "Lead Classifier", "nodes": [ { "parameters": {}, "id": "1efd4a3a-08e0-4ee6-b499-9d9c6a29fe05", "name": "Start", "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, "position": [ 192, -144 ] }, { "parameters": { "promptType": "define", "text": "=Classify this lead as hot, warm, or cold based on the following criteria:\nHOT: High budget (>$25k), immediate timeline (within 1-3 months), high engagement, decision maker involved\nWARM: Medium budget ($10k-$25k), timeline 3-6 months, moderate engagement, some decision maker contact\nCOLD: Low budget (<$10k), timeline >6 months or unclear, low engagement, no decision maker contact\n\nLead Details:\nName: {{ $json.Name }}\nCompany: {{ $json.Company }}\nRole: {{ $json.Role }}\nBudget Range: {{ $json[\"Budget Range\"] }}\nTimeline: {{ $json.Timeline }}\nInquiry: {{ $json.Inquiry }}\nIntent Signals: {{ $json[\"Intent Signals\"] }}\nIndustry: {{ $json.Industry }}\nEmployees: {{ $json.Employees }}\n\nProvide classification (hot/warm/cold), confidence score (0-1), and brief reasoning.\n\nAlso include these fields in your response exactly as provided:\nname: {{ $json.Name }}\nemail: {{ $json.Email }}\ncompany: {{ $json.Company }}\nrole: {{ $json.Role }}", "hasOutputParser": true, "options": { "systemMessage": "You are a sales lead qualification expert. Analyze leads objectively and classify them accurately based on the provided criteria." } }, "id": "d55512c3-1e0a-40e6-90d1-fa8b85c48518", "name": "Classify Lead", "type": "@n8n/n8n-nodes-langchain.agent", "typeVersion": 3.1, "position": [ 864, -144 ] }, { "parameters": { "model": { "__rl": true, "value": "gpt-5-mini", "mode": "list", "cachedResultName": "gpt-5-mini" }, "builtInTools": {}, "options": {} }, "id": "09f398bc-df03-4f63-8696-729c098d36ae", "name": "OpenAI Model", "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "typeVersion": 1.3, "position": [ 864, 160 ], "credentials": { "openAiApi": { "id": "8TsZKHzHiFGz3qUr", "name": "n8n free OpenAI API credits" } } }, { "parameters": { "jsonSchemaExample": "{\n \"classification\": \"hot\",\n \"confidence\": 0.95,\n \"reasoning\": \"High budget, immediate timeline, and high engagement indicate strong buying intent\",\n \"name\": \"Rahul Sharma\",\n \"email\": \"rahul@acme.com\",\n \"company\": \"Acme Tech\",\n \"role\": \"CTO\"\n}" }, "id": "a17eb058-82b8-4719-85ee-e764d46fc237", "name": "Classification Parser", "type": "@n8n/n8n-nodes-langchain.outputParserStructured", "typeVersion": 1.3, "position": [ 1008, 80 ] }, { "parameters": { "operation": "download", "fileId": { "__rl": true, "value": "15RRzm7-y-NVKdqcCHkH8KAoy3rMBy0CM", "mode": "list", "cachedResultName": "sample_lead_classifier_dataset (1).xlsx", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/15RRzm7-y-NVKdqcCHkH8KAoy3rMBy0CM/edit?usp=drivesdk&ouid=116344764654877516442&rtpof=true&sd=true" }, "options": { "googleFileConversion": { "conversion": { "sheetsToFormat": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" } } } }, "id": "358ded0f-5690-4c34-8ac9-3982f6640cff", "name": "Download Spreadsheet", "type": "n8n-nodes-base.googleDrive", "typeVersion": 3, "position": [ 416, -144 ], "credentials": { "googleDriveOAuth2Api": { "id": "mXbUEmkgYiOKdmU3", "name": "Google Drive account" } } }, { "parameters": { "operation": "xlsx", "options": { "headerRow": true } }, "id": "a0c768d9-ca9f-4780-a99f-4a255f5e2bc1", "name": "Extract Leads", "type": "n8n-nodes-base.extractFromFile", "typeVersion": 1.1, "position": [ 640, -144 ] }, { "parameters": { "jsCode": "const items = $input.all();\n\nconst leads = items.map(item => {\n const o = item.json.output || {};\n return {\n name: o.name || '-',\n company: o.company || '-',\n role: o.role || '-',\n email: o.email || '-',\n classification: o.classification || '-',\n confidence: o.confidence || 0,\n reasoning: o.reasoning || '-'\n };\n});\n\nconst hotLeads = leads.filter(l => l.classification === 'hot');\nconst warmLeads = leads.filter(l => l.classification === 'warm');\nconst coldLeads = leads.filter(l => l.classification === 'cold');\n\nconst renderRows = (arr) => arr.map(l => `\n