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 Intake & Classification",
"nodes": [
{
"parameters": {
"path": "webhook/lead-intake",
"httpMethod": "POST",
"responseMode": "responseNode"
},
"id": "node_webhook_trigger",
"name": "Webhook Trigger",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
100,
100
]
},
{
"parameters": {
"functionCode": "// Validate PDPL consent and required fields\nconst lead = $input.first().body;\n\nconst validation = {\n has_consent: lead.pdpl_consent === true,\n has_email: lead.email && lead.email.length > 0,\n has_name: lead.name && lead.name.length > 0,\n has_phone: lead.phone && lead.phone.length > 0\n};\n\nconst is_valid = validation.has_consent && validation.has_email && validation.has_name;\n\nreturn [\n {\n ...lead,\n validation_status: is_valid ? 'VALID' : 'INVALID',\n validation_errors: Object.entries(validation)\n .filter(([_, v]) => !v)\n .map(([k, _]) => k),\n timestamp: new Date().toISOString()\n }\n];"
},
"id": "node_validate_consent",
"name": "Validate Consent & Fields",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
300,
100
]
},
{
"parameters": {
"functionCode": "// Classify lead priority based on signals\nconst lead = $input.first();\n\nlet score = 0;\nlet signals = [];\n\nif (lead.investment_size && lead.investment_size > 5000000) { score += 30; signals.push('HIGH_INVESTMENT'); }\nif (lead.investor_type === 'UHNI' || lead.investor_type === 'FAMILY_OFFICE') { score += 25; signals.push('INSTITUTIONAL'); }\nif (lead.location === 'UAE' || lead.location === 'GULF') { score += 15; signals.push('REGIONAL'); }\nif (lead.property_focus === 'LUXURY' || lead.property_focus === 'PORTFOLIO') { score += 15; signals.push('STRATEGIC_FOCUS'); }\nif (lead.previous_transaction === true) { score += 15; signals.push('EXPERIENCED'); }\n\nconst priority = score >= 60 ? 'IMMEDIATE' : score >= 40 ? 'HIGH' : score >= 20 ? 'MEDIUM' : 'LOW';\n\nreturn [\n {\n ...lead,\n priority_score: score,\n priority_level: priority,\n priority_signals: signals\n }\n];"
},
"id": "node_classify_priority",
"name": "Classify Lead Priority",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
500,
100
]
},
{
"parameters": {
"method": "POST",
"url": "https://maqqjchekovcgtbzrbrv.supabase.co/rest/v1/lead_intelligence_log",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer {{ $env.SUPABASE_SERVICE_ROLE_KEY }}"
},
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"requestFormat": "json",
"jsonParameters": {
"parameters": [
{
"name": "name",
"value": "={{ $input.first().name }}"
},
{
"name": "email",
"value": "={{ $input.first().email }}"
},
{
"name": "phone",
"value": "={{ $input.first().phone }}"
},
{
"name": "investor_type",
"value": "={{ $input.first().investor_type }}"
},
{
"name": "priority_level",
"value": "={{ $input.first().priority_level }}"
},
{
"name": "priority_score",
"value": "={{ $input.first().priority_score }}"
},
{
"name": "validation_status",
"value": "={{ $input.first().validation_status }}"
},
{
"name": "source",
"value": "={{ $input.first().source || 'webhook' }}"
},
{
"name": "received_at",
"value": "={{ $input.first().timestamp }}"
}
]
}
},
"id": "node_insert_lead_log",
"name": "Insert Lead to Intelligence Log",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4,
"position": [
700,
100
]
},
{
"parameters": {
"method": "POST",
"url": "https://maqqjchekovcgtbzrbrv.supabase.co/rest/v1/task_queue",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer {{ $env.SUPABASE_SERVICE_ROLE_KEY }}"
},
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"requestFormat": "json",
"jsonParameters": {
"parameters": [
{
"name": "task_type",
"value": "LEAD_FOLLOWUP"
},
{
"name": "assigned_to",
"value": "SALES_TEAM"
},
{
"name": "lead_email",
"value": "={{ $input.first().email }}"
},
{
"name": "lead_name",
"value": "={{ $input.first().name }}"
},
{
"name": "priority",
"value": "={{ $input.first().priority_level }}"
},
{
"name": "status",
"value": "PENDING"
}
]
}
},
"id": "node_create_task",
"name": "Create Follow-up Task",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4,
"position": [
900,
100
]
},
{
"parameters": {
"method": "POST",
"url": "https://maqqjchekovcgtbzrbrv.supabase.co/rest/v1/execution_logs",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer {{ $env.SUPABASE_SERVICE_ROLE_KEY }}"
},
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"requestFormat": "json",
"jsonParameters": {
"parameters": [
{
"name": "workflow_name",
"value": "Lead Intake & Classification"
},
{
"name": "workflow_run_id",
"value": "={{ $execution.id }}"
},
{
"name": "status",
"value": "{{ $input.first().validation_status === 'VALID' ? 'COMPLETED' : 'VALIDATION_FAILED' }}"
},
{
"name": "lead_email",
"value": "={{ $input.first().email }}"
},
{
"name": "action_log",
"value": "Lead intake processed - validation={{ $input.first().validation_status }}, priority={{ $input.first().priority_level }}"
},
{
"name": "execution_timestamp",
"value": "={{ new Date().toISOString() }}"
}
]
}
},
"id": "node_audit_log",
"name": "Write Audit Log",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4,
"position": [
1100,
100
]
},
{
"parameters": {
"responseData": "={{ { success: true, message: 'Lead processed', lead_email: $input.first().email, priority: $input.first().priority_level } }}"
},
"id": "node_success_response",
"name": "Respond - Success",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
1300,
100
]
},
{
"parameters": {
"responseData": "={{ { success: false, message: 'Invalid request', errors: $input.first().validation_errors } }}"
},
"id": "node_error_response",
"name": "Respond - Validation Error",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
500,
300
]
}
],
"connections": {
"node_webhook_trigger": {
"main": [
[
{
"node": "node_validate_consent",
"branch": 0
}
]
]
},
"node_validate_consent": {
"main": [
[
{
"node": "node_classify_priority",
"branch": 0
}
]
]
},
"node_classify_priority": {
"main": [
[
{
"node": "node_insert_lead_log",
"branch": 0
}
]
]
},
"node_insert_lead_log": {
"main": [
[
{
"node": "node_create_task",
"branch": 0
}
]
]
},
"node_create_task": {
"main": [
[
{
"node": "node_audit_log",
"branch": 0
}
]
]
},
"node_audit_log": {
"main": [
[
{
"node": "node_success_response",
"branch": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Lead Intake & Classification. Uses httpRequest. Webhook trigger; 8 nodes.
Source: https://gist.github.com/prateekgehlot09/37341cecd133286bbbc84ec6be171b90 — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This workflow automates bulk email campaigns with built-in validation, deliverability protection, and smart send-time optimization.
This workflow is designed to manage the assignment and validation of unique QR code coupons within a lead generation system with SuiteCRM.
This workflow acts as an instant SDR that replies to new inbound leads across multiple channels in real time. It first captures and normalizes all incoming lead data into a unified structure. The work
AI Lead Qualification & Roting System. Uses httpRequest, twilio, airtable. Webhook trigger; 26 nodes.
A comprehensive n8n workflow template for streamlining influencer application processing with real-time social media data validation, intelligent scoring algorithms, and automated onboarding workflows