How to Build a Lead Generation Automation in n8n Step by Step
Building a lead generation automation in n8n can save your agency dozens of hours per week while filling your clients' pipelines with qualified prospects. In this tutorial, you'll build a complete end-to-end lead generation system — from data sourcing and enrichment to CRM entry and automated outreach triggers.
This is one of the highest-value automations you can sell as an AI agency. Clients pay $500–$3,000/month for systems that run what you're about to build. Let's get into it.
What You'll Build
By the end of this tutorial, your n8n workflow will:
- Pull leads from a source (Apollo, LinkedIn CSV, or a Google Sheet)
- Enrich each lead with company data using Clearbit or Hunter.io
- Score leads based on fit criteria using an OpenAI node
- Create contacts and deals in a CRM (HubSpot or Pipedrive)
- Trigger a cold outreach sequence via email or SMS
- Notify your team in Slack when a high-score lead is added
Step 1: Set Up Your n8n Instance
First, make sure you have n8n running. You can use n8n Cloud (easiest) or self-host on Railway or Render for lower cost. For this tutorial, n8n Cloud works perfectly.
Once logged in, click New Workflow and name it Lead Gen Automation v1.
Step 2: Create the Trigger Node
Your workflow needs a trigger — the event that kicks everything off. You have three options depending on your client's setup:
- Schedule Trigger — runs daily at a set time, pulling from a Google Sheet
- Webhook Trigger — fires instantly when a new lead is added via a form or API
- Google Sheets Trigger — watches for new rows in a spreadsheet
For this tutorial, use the Schedule Trigger node set to run every day at 8:00 AM. In the node settings:
- Mode: Every Day
- Hour: 8
- Minute: 0
Step 3: Pull Leads from Google Sheets
Add a Google Sheets node after the trigger. Connect your Google account via OAuth, then configure:
- Operation: Read Rows
- Spreadsheet ID: your leads sheet ID
- Sheet Name: New Leads
- Filters: only pull rows where Status = "New"
Your sheet should have columns: first_name, last_name, email, company, linkedin_url, status.
Step 4: Enrich Lead Data
Add an HTTP Request node to hit the Hunter.io API for email verification and enrichment. Configure:
- Method: GET
- URL:
https://api.hunter.io/v2/email-verifier?email={{$json.email}}&api_key=YOUR_KEY - Authentication: None (key in URL)
Then add a second HTTP Request node for Clearbit enrichment:
- Method: GET
- URL:
https://company.clearbit.com/v2/companies/find?domain={{$json.company_domain}} - Authentication: Basic Auth — username = your Clearbit API key, password = blank
Step 5: Score Leads with OpenAI
This is where AI turns your workflow into something powerful. Add an OpenAI node and configure it as a Chat Completion:
- Model: gpt-4o-mini (fast and cheap)
- System prompt: "You are a B2B lead qualification expert. Score leads from 1–10 based on ICP fit."
- User message: Include company size, industry, job title, and any enrichment data
Your user message template should look like:
Score this lead: Name: {{$json.first_name}} {{$json.last_name}}, Title: {{$json.title}}, Company: {{$json.company}}, Employees: {{$json.employees}}, Industry: {{$json.industry}}. Return a JSON object with score (1-10) and reason.
Set Response Format to JSON and parse the output. Add a Code node after to extract the score:
const result = JSON.parse($input.first().json.message.content); return [{ json: { ...($input.first().json), lead_score: result.score, score_reason: result.reason } }];
Step 6: Filter by Score
Add an IF node to split leads by quality:
- Condition:
lead_scoregreater than or equal to 7 - True branch → high-priority leads → CRM + immediate outreach
- False branch → low-priority leads → CRM only, no immediate outreach
Step 7: Create Contacts in HubSpot
On the true branch, add a HubSpot node. Configure:
- Resource: Contact
- Operation: Create or Update
- Email:
{{$json.email}} - First Name:
{{$json.first_name}} - Last Name:
{{$json.last_name}} - Company:
{{$json.company}} - Custom field
lead_score:{{$json.lead_score}} - Custom field
lead_source: n8n-automation
Then add a HubSpot node to create a deal:
- Resource: Deal
- Operation: Create
- Deal Name:
{{$json.first_name}} {{$json.last_name}} — Inbound Lead - Stage: appointmentscheduled
- Amount: leave blank or set a placeholder
Step 8: Trigger Email Outreach
Add an HTTP Request node to call your email sending API (Instantly, Lemlist, or Smartlead). Here's the Instantly.ai API call:
- Method: POST
- URL:
https://api.instantly.ai/api/v1/lead/add - Body (JSON):
{ "api_key": "YOUR_KEY", "campaign_id": "YOUR_CAMPAIGN_ID", "email": "{{$json.email}}", "first_name": "{{$json.first_name}}", "personalization": "{{$json.score_reason}}" }
This adds the lead to an active cold email campaign with the AI-generated personalization line already filled in.
Step 9: Send Slack Notification
Add a Slack node to notify your team about high-score leads. Configure:
- Resource: Message
- Operation: Send
- Channel: #hot-leads
- Text:
🔥 New hot lead: {{$json.first_name}} {{$json.last_name}} from {{$json.company}} — Score: {{$json.lead_score}}/10. {{$json.score_reason}}
Step 10: Update Lead Status in Google Sheets
Finally, add a Google Sheets node to mark the lead as processed:
- Operation: Update Row
- Column to match: email
- Update
statusto: Processed - Update
crm_idto:{{$json.hubspot_contact_id}}
This prevents the same lead from being processed twice on the next run.
Testing Your Workflow
Before going live, test each node individually. In n8n, click Execute Node on each step to verify the data flows correctly. Check:
- Google Sheets returns the expected rows
- Hunter.io returns a valid verification result
- OpenAI returns a valid JSON score object
- HubSpot creates the contact without errors
- Slack message appears in the correct channel
What to Charge Clients for This
This workflow typically sells for $800–$2,500 as a one-time setup fee, plus $200–$500/month for maintenance and API costs. Clients who are manually doing this process see immediate ROI within the first week.
If you want to go deeper on building and selling n8n workflows, check out our guide on how to build AI agents in n8n for beginners and our comparison of n8n vs Make vs Zapier for AI agents.
Want to learn how to build and sell AI automations? Join our free community. Join the free AI Agency Sprint community.
Join 215+ AI Agency Owners
Get free access to our LinkedIn automation tool, AI content templates, and a community of builders landing clients in days.
