{"name":"Property Lead Qualifier","nodes":[{"id":"webhook","type":"n8n-nodes-base.webhook","name":"New Lead Received","position":[250,300],"parameters":{"path":"real-estate-lead","method":"POST"}},{"id":"normalize","type":"n8n-nodes-base.code","name":"Normalize Lead Data","position":[450,300],"parameters":{"language":"javascript","code":"const lead = $json;\nreturn { json: { name: lead.name || lead.full_name, email: lead.email, phone: (lead.phone||\"\").replace(/\\D/g,\"\"), source: lead.source || \"website\", property_interest: lead.property_type, budget: lead.budget, timeline: lead.timeline, pre_approved: lead.pre_approved || false, message: lead.message } };"}},{"id":"enrich","type":"n8n-nodes-base.httpRequest","name":"Enrich with Property Data","position":[650,300],"parameters":{"url":"={{$env.PROPERTY_DATA_API}}/enrich","method":"POST","body":{"address":"={{$json.property_interest}}","email":"={{$json.email}}"}}},{"id":"aiScore","type":"n8n-nodes-base.openAi","name":"AI Lead Scoring","position":[850,300],"parameters":{"model":"gpt-4o-mini","prompt":"Score this real estate lead 1-100 on purchase readiness. Consider: budget alignment, timeline, pre-approval, engagement level. Return JSON: {score: number, tier: \"hot\"|\"warm\"|\"cold\", reasoning: string, recommended_agent_specialty: string}\n\nLead: {{JSON.stringify($json)}}"}},{"id":"router","type":"n8n-nodes-base.switch","name":"Route by Score","position":[1050,300],"parameters":{"rules":[{"value":"={{$json.tier}}","output":0,"operation":"equal","value2":"hot"},{"value":"={{$json.tier}}","output":1,"operation":"equal","value2":"warm"}]}},{"id":"hotAlert","type":"n8n-nodes-base.slack","name":"Urgent Agent Alert","position":[1250,150],"parameters":{"channel":"#hot-leads","text":"HOT LEAD ({{$json.score}}/100): {{$json.name}} — Budget: {{$json.budget}}, Timeline: {{$json.timeline}}. Pre-approved: {{$json.pre_approved}}"}},{"id":"warmNurture","type":"n8n-nodes-base.httpRequest","name":"Add to Nurture Sequence","position":[1250,300],"parameters":{"url":"={{$env.CRM_API}}/sequences/nurture/add","method":"POST"}},{"id":"pushCRM","type":"n8n-nodes-base.httpRequest","name":"Push to CRM","position":[1250,450],"parameters":{"url":"={{$env.CRM_API}}/contacts","method":"POST"}}],"connections":{"New Lead Received":{"main":[[{"node":"Normalize Lead Data","type":"main","index":0}]]},"Normalize Lead Data":{"main":[[{"node":"Enrich with Property Data","type":"main","index":0}]]},"Enrich with Property Data":{"main":[[{"node":"AI Lead Scoring","type":"main","index":0}]]},"AI Lead Scoring":{"main":[[{"node":"Route by Score","type":"main","index":0}]]},"Route by Score":{"main":[[{"node":"Urgent Agent Alert","type":"main","index":0}],[{"node":"Add to Nurture Sequence","type":"main","index":0}],[{"node":"Push to CRM","type":"main","index":0}]]}}}