Video Chapters
0:00 Build a Lead Enrichment Workflow | AI Automation with n8n | Capstone Project - Part 01
0:00 How to Enrich Leads Automatically Using Hunter IO and n8n - Capstone Project - Part 02
0:00 Enrich Leads Automatically in n8n [Capstone Project] | How to create PDF in n8n - Capstone Project - Part 03

Lead Enrichment Capstone

Build a complete lead enrichment workflow in n8n with form capture, email validation, scoring, assignment, and notifications automation.

Table of Contents

Overview

In this lesson, you will build a comprehensive lead enrichment and assignment workflow using n8n. This capstone project automates the entire lead lifecycle—from form submission and email validation to lead enrichment, lead scoring, assignment, and notification. You will learn how to use various n8n nodes, including the n8n Form Trigger, conditional logic with IF nodes, third-party integrations such as Hunter.io for email and lead enrichment, Google Sheets for logging, and HTTP requests for API calls not directly supported by native nodes.

By the end of this tutorial, you’ll have a fully automated lead processing workflow that you can adapt for your business or sell as a service. If you are new to setting up n8n, consider reviewing how to install n8n via npm/Node.js or install n8n via Docker to get started quickly.


1. Mapping the Business Process

Before building the workflow, it’s critical to understand the business process you are automating. This ensures that you design a workflow that replicates the manual process and optimizes it effectively.

Lead Processing Flow Overview:

  • Lead capture: A user fills out a "Contact Us" form on your website with details such as name, email, company, job title, and interest area.
  • Email validation: The lead’s email is first checked for basic format correctness and then verified through a third-party service (Hunter.io) to ensure deliverability and legitimacy.
  • Lead enrichment: Additional company and personal information is fetched from Hunter.io to build a detailed lead profile.
  • Lead scoring: Based on criteria like company size, region, and email quality, leads are classified into High, Medium, or Low value.
  • Lead assignment: Based on the score, leads are assigned to sales executives, managers, or added to nurture lists.
  • Logging: All leads and their statuses are logged into Google Sheets for tracking and reporting.
  • Notifications and follow-ups: Assigned reps receive notifications and automated follow-up emails or calendar invites.

2. Setting Up the Lead Capture with n8n Form Trigger

Step 1: Create a New Workflow

  • Log into your n8n workspace.
  • Click on Create New Workflow.
  • Rename the workflow to Lead Processing Workflow.

Step 2: Add the n8n Form Trigger Node

  1. Add a node and search for Form Trigger.
  2. Select On New n8n Form event.
  3. Configure the form:
    • Form Title: Contact Us
    • Description: Please fill out the below details and we will get back to you shortly.
    • Authentication: None (since this is a public contact form)

Step 3: Define Form Fields

Add form elements to capture lead details:

Field Name Element Type Required Placeholder / Options
name Text Yes Your name goes here
email Email Yes
company Text Yes
website Text No
jobTitle Text No
interestArea Dropdown (list) Yes Multiple choice enabled, e.g., Sales, Support, Partnership

Step 4: Test the Form

  • Click Execute Node.
  • Open the Test URL displayed at the top.
  • Submit a sample lead form.
  • Verify that the node receives the form data.

3. Basic Email Validation with the IF Node

After capturing the lead, you need to validate the email format before proceeding.

Step 1: Add an IF Node for Basic Validation

  • Add an IF node named Basic Email Validation.
  • Use n8n’s built-in expression functions:
{{$json["email"] && $json["email"].length > 10 && $json["email"].match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)}}
  • Alternatively, use the built-in isEmail() function:
{{ $json.email.isEmail() && $json.email.length >= 10 }}
  • Additional condition: Check that the domain is not in a blacklist (e.g., fake.com, tempmail.com):
{{ !["fake.com", "tempmail.com", "test.com"].includes($json.email.extractDomain()) }}
  • Set the condition logic to AND so all must be true.

Step 2: Branch Logic

  • True branch: Email passes basic validation → proceed to third-party validation.
  • False branch: Email fails → log the lead as discarded.

4. Logging Discarded Leads to Google Sheets

Step 1: Prepare Google Sheet

Create a Google Sheet with the following columns:

  • Timestamp
  • Full Name
  • Email
  • Company Name
  • Lead Value
  • Status
  • Reason

Step 2: Add Google Sheets Node

  • Use the Append Row operation.
  • Map fields from the form data.
  • For discarded leads, set:
    • Status: Discarded
    • Reason: e.g., Basic email validation failed

Step 3: Connect to the False Branch

Connect the false branch of the Basic Email Validation node to this logging node.


5. Third-Party Email Validation Using Hunter.io

Hunter.io provides an API to verify email deliverability and confidence scores.

Step 1: Add the Hunter Node

  • Add the Hunter node.
  • Select operation: Email Verifier.
  • Pass the email from the form data.

Step 2: Configure API Key

  • Register at Hunter.io to get an API key.
  • Add the API key in the credentials section of the Hunter node.

Step 3: Add an IF Node for Hunter Validation

  • Conditions:
    • status equals valid (case insensitive)
    • score greater than 20

Example n8n expression for conditions:

{{ $json.status.toLowerCase() === 'valid' && $json.score > 20 }}

Step 4: Logging Discarded Leads on Hunter Failure

  • If the lead fails this validation, log it to Google Sheets with status Discarded and reason indicating Hunter validation failure including the score.

6. Enriching Lead Data with Hunter.io Company & Person API

Hunter.io offers APIs to enrich lead data with company and person information.

Step 1: Use HTTP Request Node for Enrichment

Since n8n’s Hunter node does not support enrichment APIs, use an HTTP Request node.

  • Method: GET
  • URL: https://api.hunter.io/v2/enrich?email={{$json["email"]}}&api_key=YOUR_API_KEY
  • Replace YOUR_API_KEY with your Hunter.io API key.

For more details on configuring this node, refer to the n8n HTTP Request node documentation.

Step 2: Parse Response Data

  • Extract company info, person info, job titles, social profiles, etc.
  • Use Set or Function nodes if needed to restructure data.

7. Lead Scoring and Classification

Based on enriched data, you can score leads:

  • Check company size, industry, region.
  • Validate if the email is a professional domain.
  • Define rules for high, medium, or low value.

Use an IF node or Switch node with multiple conditions to assign lead value. For advanced workflow management and scaling, consider exploring how to scale n8n with enterprise features.


8. Lead Assignment and Notifications

Step 1: Assign Leads Based on Score

  • High value → assign to sales executive.
  • Medium value → assign to sales manager for approval.
  • Low value → add to nurture list.

Step 2: Notify Teams

  • Use Slack or Email nodes to notify the assigned person.
  • Include lead details and next steps.

9. Logging Approved Leads and Nurture List

  • Log all approved leads into Google Sheets with their assigned status.
  • Log nurture leads in a separate sheet/tab.

10. Automating Follow-ups and Scheduling

  • For assigned leads, automate calendar invites and follow-up emails.
  • Use Google Calendar and SMTP or Send Email nodes.
  • Schedule follow-ups after a set number of days.

Common Mistakes & Troubleshooting

  • Not activating the workflow: The n8n Form Trigger test URL only works when the workflow is active.
  • Incorrect API keys: Ensure Hunter.io API keys are valid and have the necessary permissions.
  • Email regex too restrictive or permissive: Adjust basic email validation to avoid false negatives/positives.
  • Incorrect Google Sheets range or permissions: Confirm your Google Sheets node has access and the sheet columns match your mapping.
  • Not handling null or missing data: Use IF and fallback conditions to handle incomplete enrichment responses.
  • Case sensitivity in string comparisons: Use .toLowerCase() to avoid mismatches.

For more information on hosting and running n8n workflows reliably, see the n8n hosting documentation.


Useful n8n Expressions

  • Extract domain from email:
{{$json.email.extractDomain()}}
  • Check if string is email:
{{$json.email.isEmail()}}
  • Current timestamp:
{{ new Date().toISOString() }}

Quick Reference Cheat Sheet

Step Node Type Key Settings / Expressions
Capture lead form n8n Form Trigger Define form fields, no auth, test URL
Basic email validation IF isEmail() && length > 10 && !blacklist.includes(domain)
Log discarded lead Google Sheets Append row with status Discarded and reason
Hunter email validation Hunter Operation: Email Verifier, check status & score
Log Hunter validation fail Google Sheets Append row with reason including score
Enrich lead data HTTP Request GET https://api.hunter.io/v2/enrich?email=...
Lead scoring IF or Switch Conditions based on company size, region, etc.
Assign leads IF or Switch Map lead value to sales exec, manager, nurture
Notify team Slack or Email Send notification with lead info
Schedule follow-ups Google Calendar Create event, send invites

Additional Resources


By following this tutorial and building along with the video, you will have created a robust, automated lead enrichment and assignment workflow in n8n that replaces manual tasks and streamlines your sales operations.

Frequently Asked Questions

Add the Form Trigger node, select 'On New n8n Form' event, configure the form title and fields like name, email, and company to capture lead data.

Use HTTP Request nodes or native Hunter.io integration to verify email deliverability and fetch additional lead details for enrichment.

Lead scoring can be based on company size, region, email quality, and other custom attributes using IF nodes and conditional logic.

Use IF nodes to branch logic by lead score and assign leads to specific users or teams, then send notifications or follow-up emails accordingly.

Integrate the Google Sheets node to append or update rows with lead details and status updates for tracking and reporting.

Dheeraj Sharma

Dheeraj Sharma

AI Systems Builder
Creator of the n8n Zero to Hero course (42 lessons, 31+ hours). I help solopreneurs build AI systems that grow revenue without growing workload.

Get the n8n Mastery Bundle

All workflows, cheat sheets, and premium resources from the entire course in one package.

Get Premium Resources