This workflow corresponds to n8n.io template #13979 — we link there as the canonical source.
This workflow follows the Chainllm → Gmail recipe pattern — see all workflows that pair these two integrations.
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 →
{
"nodes": [
{
"id": "45e1f381-8a76-4207-9fcd-abe847624191",
"name": "HubSpot Contact Created",
"type": "n8n-nodes-base.hubspotTrigger",
"position": [
-48,
80
],
"parameters": {
"additionalFields": {}
},
"typeVersion": 1
},
{
"id": "6a4b4d14-a182-4a20-b236-f126b80f6a7b",
"name": "Clearbit Company Enrichment",
"type": "n8n-nodes-base.httpRequest",
"position": [
176,
80
],
"parameters": {
"url": "https://person.clearbit.com/v2/people/find",
"options": {},
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"typeVersion": 4.2
},
{
"id": "f20a4c05-8a6f-45d2-aa0f-829790e15df4",
"name": "Set Scoring Criteria",
"type": "n8n-nodes-base.set",
"position": [
400,
80
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "scoring_criteria",
"name": "target_industries",
"type": "array",
"value": "['SaaS', 'Technology', 'Fintech', 'E-commerce']"
},
{
"id": "company_size_weights",
"name": "company_size_weights",
"type": "object",
"value": "{'startup': 3, 'small': 5, 'medium': 8, 'large': 10}"
},
{
"id": "role_weights",
"name": "role_weights",
"type": "object",
"value": "{'founder': 10, 'ceo': 10, 'cto': 9, 'vp': 8, 'director': 7, 'manager': 6, 'other': 3}"
},
{
"id": "hot_threshold",
"name": "hot_threshold",
"type": "number",
"value": 80
},
{
"id": "warm_threshold",
"name": "warm_threshold",
"type": "number",
"value": 50
}
]
}
},
"typeVersion": 3.4
},
{
"id": "09613fd8-26d3-4c91-98cc-6e5fed74b0d8",
"name": "Calculate Basic Score",
"type": "n8n-nodes-base.code",
"position": [
688,
80
],
"parameters": {
"jsCode": "// Calculate basic lead score\nconst contact = $('HubSpot Contact Created').first().json;\nconst enrichment = $('Clearbit Company Enrichment').first().json;\nconst criteria = $json;\n\n// Base score\nlet score = 0;\n\n// Company size scoring\nconst employees = enrichment?.company?.metrics?.employees || 0;\nlet sizeCategory = 'startup';\nif (employees > 1000) sizeCategory = 'large';\nelse if (employees > 100) sizeCategory = 'medium';\nelse if (employees > 10) sizeCategory = 'small';\n\nscore += criteria.company_size_weights[sizeCategory] || 0;\n\n// Industry scoring\nconst industry = enrichment?.company?.category?.industry || '';\nif (criteria.target_industries.some(target => industry.toLowerCase().includes(target.toLowerCase()))) {\n score += 20;\n}\n\n// Role/title scoring\nconst title = contact.properties?.jobtitle?.toLowerCase() || '';\nlet roleScore = 3; // default\nfor (const [role, weight] of Object.entries(criteria.role_weights)) {\n if (title.includes(role)) {\n roleScore = weight;\n break;\n }\n}\nscore += roleScore;\n\n// Funding bonus (if available)\nif (enrichment?.company?.metrics?.raised) {\n score += 15;\n}\n\nreturn {\n contact_data: contact,\n enrichment_data: enrichment,\n basic_score: score,\n size_category: sizeCategory,\n industry_match: criteria.target_industries.some(target => industry.toLowerCase().includes(target.toLowerCase()))\n};"
},
"typeVersion": 2
},
{
"id": "84e9ecb5-9c62-42a7-b3b8-aced78658339",
"name": "AI Lead Analysis",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
928,
80
],
"parameters": {
"text": "You are a lead scoring AI for a B2B SaaS company. Analyze this lead and provide a comprehensive scoring and personalized email content.\n\nContact Information:\nName: {{ $json.contact_data.properties.firstname }} {{ $json.contact_data.properties.lastname }}\nEmail: {{ $json.contact_data.properties.email }}\nJob Title: {{ $json.contact_data.properties.jobtitle }}\nCompany: {{ $json.enrichment_data.company.name }}\n\nCompany Data:\nIndustry: {{ $json.enrichment_data.company.category.industry }}\nEmployee Count: {{ $json.enrichment_data.company.metrics.employees }}\nFunding: {{ $json.enrichment_data.company.metrics.raised }}\nWebsite: {{ $json.enrichment_data.company.domain }}\n\nBasic Score: {{ $json.basic_score }}/100\nIndustry Match: {{ $json.industry_match }}\nCompany Size: {{ $json.size_category }}\n\nTasks:\n1. Analyze the lead quality and provide additional scoring factors (tech stack, company growth indicators, decision-making authority)\n2. Calculate a final AI-enhanced score (0-100)\n3. Generate a personalized email subject and body for hot leads\n4. Provide nurturing strategy recommendations\n\nRespond in this JSON format:\n{\n \"ai_score_adjustment\": number,\n \"final_score\": number,\n \"lead_category\": \"hot|warm|cold\",\n \"reasoning\": \"brief explanation\",\n \"personalized_email\": {\n \"subject\": \"email subject\",\n \"body\": \"email content\"\n },\n \"nurturing_notes\": \"strategy for follow-up\"\n}",
"promptType": "define"
},
"typeVersion": 1.4
},
{
"id": "f6283615-1151-40ac-a518-82ae1fc772d1",
"name": "Score Threshold Check",
"type": "n8n-nodes-base.if",
"position": [
1184,
80
],
"parameters": {
"options": {},
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "hot_lead",
"operator": {
"type": "number",
"operation": "gte"
},
"leftValue": "{{ $json.final_score }}",
"rightValue": "{{ $('Set Scoring Criteria').first().json.hot_threshold }}"
}
]
}
},
"typeVersion": 2
},
{
"id": "ea26aabc-feb5-41aa-9d8c-c9ee33de1cd4",
"name": "Update Contact Properties",
"type": "n8n-nodes-base.hubspot",
"position": [
1632,
240
],
"parameters": {
"operation": "update"
},
"typeVersion": 2
},
{
"id": "feefd14b-f229-41f7-84c7-d557f871177d",
"name": "Send Personalized Email",
"type": "n8n-nodes-base.gmail",
"position": [
2128,
176
],
"parameters": {
"sendTo": "={{ $('HubSpot Contact Created').first().json.properties.email }}",
"message": "={{ $json.personalized_email.body }}",
"options": {
"ccList": "",
"bccList": "user@example.com"
},
"subject": "={{ $json.personalized_email.subject }}"
},
"typeVersion": 2.1
},
{
"id": "aadf9557-5134-49fb-b31c-43265afe4da6",
"name": "Add to Nurturing Sequence",
"type": "n8n-nodes-base.hubspot",
"position": [
1632,
448
],
"parameters": {
"operation": "update"
},
"typeVersion": 2
},
{
"id": "4e788ba6-6e08-4c70-9299-e4d3ee105a31",
"name": "Notify Sales Team",
"type": "n8n-nodes-base.slack",
"position": [
2128,
0
],
"parameters": {
"text": "\ud83d\udd25 *New Hot Lead Alert!*\n\n*Contact:* {{ $('HubSpot Contact Created').first().json.properties.firstname }} {{ $('HubSpot Contact Created').first().json.properties.lastname }}\n*Company:* {{ $json.enrichment_data?.company?.name || 'Unknown' }}\n*Title:* {{ $('HubSpot Contact Created').first().json.properties.jobtitle }}\n*Email:* {{ $('HubSpot Contact Created').first().json.properties.email }}\n\n*AI Score:* {{ $json.final_score }}/100\n*Category:* {{ $json.lead_category }}\n\n*Reasoning:* {{ $json.reasoning }}\n\n<{{ $('HubSpot Contact Created').first().json.properties.hs_object_id }}|View in HubSpot>",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "name",
"value": "sales-alerts"
},
"otherOptions": {}
},
"typeVersion": 2.1
},
{
"id": "ef768151-30ae-4595-b420-46cf62deb34e",
"name": "Log Scoring History",
"type": "n8n-nodes-base.googleSheets",
"position": [
2144,
368
],
"parameters": {
"columns": {
"value": {
"Email": "={{ $('HubSpot Contact Created').first().json.properties.email }}",
"Company": "={{ $json.enrichment_data?.company?.name }}",
"Category": "={{ $json.lead_category }}",
"Industry": "={{ $json.enrichment_data?.company?.category?.industry }}",
"Job Title": "={{ $('HubSpot Contact Created').first().json.properties.jobtitle }}",
"Reasoning": "={{ $json.reasoning }}",
"Timestamp": "={{ new Date().toISOString() }}",
"Basic Score": "={{ $('Calculate Basic Score').first().json.basic_score }}",
"Final Score": "={{ $json.final_score }}",
"Contact Name": "={{ $('HubSpot Contact Created').first().json.properties.firstname }} {{ $('HubSpot Contact Created').first().json.properties.lastname }}",
"Employee Count": "={{ $json.enrichment_data?.company?.metrics?.employees }}"
},
"mappingMode": "defineBelow"
},
"options": {},
"operation": "appendOrUpdate",
"sheetName": {
"__rl": true,
"mode": "name",
"value": "Lead Scoring Log"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "your-lead-scoring-sheet-id"
}
},
"typeVersion": 4.4
},
{
"id": "4ea14e8c-a452-4e52-9fe0-5c8d08867401",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-608,
-112
],
"parameters": {
"width": 452,
"height": 648,
"content": "# Lead Scoring Automation\n\nThis workflow automatically scores and nurtures new HubSpot contacts using Clearbit enrichment and Gemini AI analysis.\n\n## How it works\n1. **Trigger**: New contact created in HubSpot\n2. **Enrich**: Clearbit adds company data\n3. **Score**: Basic algorithm + AI enhancement\n4. **Route**: Hot leads get immediate outreach, warm leads enter nurturing\n5. **Notify**: Sales team alerted for hot leads\n6. **Track**: All scores logged to Google Sheets\n\n## Setup steps\n1. Configure HubSpot, Clearbit, Gemini AI credentials\n2. Update Slack channel name and Gmail settings\n3. Create Google Sheet for scoring history\n4. Adjust scoring thresholds in Set node\n5. Customize email templates in AI prompt\n\n## Customization\n- Modify scoring criteria (industries, role weights)\n- Adjust hot/warm thresholds (default: 80/50)\n- Personalize email templates and Slack messages"
},
"typeVersion": 1
},
{
"id": "a8494e55-1e7d-4373-8a44-fc8e2da38860",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-128,
-112
],
"parameters": {
"color": 7,
"width": 712,
"height": 528,
"content": "## Data enrichment\nClearbit adds company information to score based on size, industry, and funding status."
},
"typeVersion": 1
},
{
"id": "9f7c3baa-ede2-469e-b4d3-ab8c66eb2770",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
608,
-112
],
"parameters": {
"color": 7,
"width": 692,
"height": 528,
"content": "## AI-powered scoring\nGemini AI analyzes the enriched data and generates personalized outreach content."
},
"typeVersion": 1
},
{
"id": "dafbadce-96e6-4a2f-8004-51310555c5e8",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1312,
-112
],
"parameters": {
"color": 7,
"width": 568,
"height": 736,
"content": "## Lead routing & outreach\nHot leads get personalized emails, warm leads enter nurturing sequences."
},
"typeVersion": 1
},
{
"id": "55cdb857-8695-4f39-ad5b-0865e90cca06",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1904,
-112
],
"parameters": {
"color": 7,
"width": 584,
"height": 736,
"content": "## Notifications & tracking\nSales team gets Slack alerts for hot leads. All scores are logged for analysis."
},
"typeVersion": 1
},
{
"id": "eb2716f3-ede4-4b64-a5bf-9babe45fe76d",
"name": "Google Gemini Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
928,
256
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
}
],
"connections": {
"AI Lead Analysis": {
"main": [
[
{
"node": "Score Threshold Check",
"type": "main",
"index": 0
}
]
]
},
"Set Scoring Criteria": {
"main": [
[
{
"node": "Calculate Basic Score",
"type": "main",
"index": 0
}
]
]
},
"Calculate Basic Score": {
"main": [
[
{
"node": "AI Lead Analysis",
"type": "main",
"index": 0
}
]
]
},
"Score Threshold Check": {
"main": [
[
{
"node": "Update Contact Properties",
"type": "main",
"index": 0
},
{
"node": "Send Personalized Email",
"type": "main",
"index": 0
},
{
"node": "Notify Sales Team",
"type": "main",
"index": 0
}
],
[
{
"node": "Update Contact Properties",
"type": "main",
"index": 0
},
{
"node": "Add to Nurturing Sequence",
"type": "main",
"index": 0
}
]
]
},
"HubSpot Contact Created": {
"main": [
[
{
"node": "Clearbit Company Enrichment",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Lead Analysis",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Update Contact Properties": {
"main": [
[
{
"node": "Log Scoring History",
"type": "main",
"index": 0
}
]
]
},
"Clearbit Company Enrichment": {
"main": [
[
{
"node": "Set Scoring Criteria",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
googlePalmApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
SMB sales teams and SaaS companies who want to automatically prioritize and nurture new leads without manual qualification. Perfect for businesses getting 50+ leads per month who need to identify high-value prospects quickly.
Source: https://n8n.io/workflows/13979/ — 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 template is perfect for: Marketing Teams looking to automatically qualify inbound leads from campaigns Sales Teams wanting to prioritize high-value prospects instantly Agencies offering lead qual
This is ideal for agencies, freelancers, SaaS founders, and small sales teams who want every lead recorded and followed up automatically within seconds. The workflow supports two storage options: HubS
Real-Time Lead Processing - Captures and processes leads instantly from website forms with zero delay Intelligent Fit Scoring - Automatically scores leads 0-100 based on company size, seniority, and r
Monitor CRM accounts for hiring spikes by enriching HubSpot companies with PredictLeads job data and alerting your team via Slack.
This workflow automatically qualifies great leads from a form and sends them an email 😮.. It also adds the user to Hubspot if not already added and records the outreach. Add you MadKudu, Hunter, and G