How to Build a Lead Generation Workflow in n8n Step by Step

Someone fills out the contact form on your site. By the time a salesperson sees it, it should already say who they are, what company they work for, and whether they're worth a call today.
This guide builds that in n8n with five pieces: a form catcher, a data lookup, an AI score, a CRM write, and an alert when something fails. The scoring step is a prompt, not code.
You'll need an n8n account (cloud or self-hosted), an enrichment API key, a model API key, and access to your CRM.
This guide first went up in February 2025 and was rechecked in September 2026. Two things changed since then. Clearbit no longer sells new accounts, so the lookup step points elsewhere. And the scoring step works with any current small model from OpenAI, Anthropic, or Google.
Why n8n for this
n8n can call any API, run your own logic, and put an AI model in the middle of the flow. You can also run it on your own server, which keeps prospect data with you.
The self-hosted Community Edition is free under n8n's Sustainable Use License. That license allows internal business use, but it isn't an open-source license.
n8n
Pros
- Self-hostable under a fair-code license
- Native nodes for common CRMs and form tools
- AI nodes for lead scoring
- Free Community Edition available
Cons
- Steeper learning curve than Zapier
- Self-hosting requires server management
Step 1: Catch the lead
Every workflow starts with a trigger, the thing that kicks it off. n8n gives you a few ways to catch leads:
- Webhook node: a URL your site's form posts to directly
- Email trigger: watches an inbox for inquiries
- Scheduled scrape: pulls leads from directories or databases on a timer, using HTTP Request nodes
- Typeform or Google Forms: built-in connections to those form tools
Start with the webhook. Create a new workflow, add a Webhook node, and set it to accept POST requests. n8n gives you a URL. Point your website's contact form at it.
Step 2: Look up who they are
A form usually gives you a name and an email. That's not enough to judge a lead. Enrichment means sending that email to a data service and getting back the rest: company name, job title, company size, industry.
Add an HTTP Request node after the trigger and point it at an enrichment API. As of September 2026, three with public API docs are:
- Hunter: Email, Company, and Combined Enrichment endpoints. Its free plan includes 50 credits a month, enough to test the pipeline.
- People Data Labs: a person enrichment API with a small free monthly allowance that hides contact fields.
- Apollo: a people enrichment endpoint. How much API access you get depends on your plan, so check before you build on it.
Only map the fields your scoring prompt will actually use. The rest is clutter.
Older versions of this guide recommended Clearbit. Don't use it for a new build. After HubSpot bought it, Clearbit stopped selling new accounts and points new buyers to HubSpot, and its free tools were shut down in 2025.
If your CRM is HubSpot, you may not need a separate lookup at all. HubSpot now calls the Clearbit-based feature data enrichment (it was sold as Breeze Intelligence) and includes it in all paid Smart CRM plans. In that case, create the contact in HubSpot first and let HubSpot fill in the company fields.
Start with Hunter's free plan to check that email addresses are real before you pay for a bigger data provider. It weeds out bad emails early and costs nothing while you test.
Step 3: Score the lead with AI
Add an AI node (OpenAI, Anthropic, Google, or any model n8n supports) after the lookup. Its job is to read the lead's details and give it a score.
A small, cheap model is enough. Pick one that supports structured output, which means it returns the score as JSON your workflow can read instead of a paragraph of prose.
Write a prompt that compares the lead to your ideal customer: company size, industry, how senior their title is, and where they're located. Ask for a score from 1 to 10 and a one-line reason.
Then add an If node to split the flow. High scores go straight to sales. Lower scores go into a nurture sequence.
Step 4: Send it to your CRM
n8n has built-in nodes for HubSpot, Salesforce, Pipedrive, Airtable, and Google Sheets. Add the one you use and match each lead field to the CRM field it belongs in.
For the best leads, add a branch that sends a Slack message or email to sales. Speed matters. InsideSales' research found conversion rates run far higher when a lead is contacted in the first five minutes rather than later.
If a lead comes in overnight, still write it to the CRM right away. Just hold the Slack alert with a time check until business hours, so sales sees it when they can act on it.
Step 5: Know when it breaks
Things will fail: the lookup service hits its rate limit, someone types a bad email, the CRM connection times out. Set up an Error Trigger workflow in n8n that catches failures and messages you.
Log every lead in a simple Google Sheet or Airtable base with its score and whether it reached the CRM. Look at it once a week. That log is how you'll tune the scoring prompt and decide which data sources are worth keeping.
Most of the running cost is per lead: one lookup call and one model call. Self-hosting n8n removes the platform fee. If you'd rather not run a server, n8n's hosted plans charge per workflow run.
Make it better over time
Track how many captured leads turn into real sales opportunities. Then adjust the scoring prompt based on which leads actually bought. Drop lookup fields that never change the score. Add a new data source once you notice a pattern in your best customers.
Run 50 leads through the workflow before you turn it on for real. That's enough to surface the odd cases in lookup and scoring that a handful of test submissions won't show you.


