How do you automate lead generation with AI? You set up a workflow that scrapes prospect URLs, enriches each record with firmographic data, scores the lead, and finally asks an LLM to write a personalized opening line. The result is a ready-to-export CSV (or direct CRM push) that you can use for outbound outreach without manual research.
What is AI lead generation? AI lead generation is the process of using artificial intelligence to discover, enrich, and qualify prospects automatically.
What you need
| Tool | Plan / Price* | Role |
|---|---|---|
| n8n (self-hosted) | Community Edition - Free | Orchestrates the entire pipeline |
| OpenAI GPT-4 API | Pay-as-you-go (≈ $0.03 / 1 K prompt tokens, $0.06 / 1 K completion tokens) | Generates icebreaker text and scoring logic |
| Browserless.io (headless Chrome) | Free tier for low volume, paid plans start at $29/mo for 100 k runs | Executes the web-scraping steps |
| HubSpot CRM (Free) | Free | Stores enriched leads and syncs with outreach tools |
| Google Sheets | Free | Quick view of results during development |
| Zapier (optional) | Free tier for ≤ 100 tasks/mo | Pushes scored leads to email outreach platforms |
\*Pricing is current as of August 2026; check each provider's pricing page for the latest details.
Estimated build time: 6-8 hours for a developer comfortable with n8n and basic API usage.
Step-by-step build
1. Provision the n8n instance
- Pull the Docker image: docker run -d --restart unless-stopped -p 5678:5678 n8nio/n8n
- Open http://localhost:5678 and create a new workflow called Lead Enrichment + Icebreaker.
2. Add a "HTTP Request" node to fetch a prospect list
- Set Method to GET.
- URL: https://api.example.com/prospects?status=active (replace with your source).
- Enable Pagination if the API returns paged results.
3. Split the list into individual items
- Add a "SplitInBatches" node, batch size 1. This feeds each prospect into the downstream nodes one-by-one.
4. Scrape the company website for extra data
- Insert a "Browserless" node (provided by the Browserless.io integration).
- Endpoint: https://chrome.browserless.io/scrape
- Payload (JSON):
What this does: Visits the prospect's website, clicks the contact link, waits for the company info block, and returns the raw text as companyInfo.
5. Enrich with third-party data (e.g., Clearbit)
- Add another "HTTP Request" node.
- Method: GET
- URL: https://person.clearbit.com/v2/people/find?email={{$json["email"]}}
- Authentication: API Key header Authorization: Bearer YOUR_CLEARBIT_KEY.
6. Score the lead
- Insert a "Set" node called Score.
- Add a field score with the expression:
This simple rule adds points for Fortune-500 mentions, a C-level title, and a positive sentiment from the icebreaker draft (computed later).
7. Generate a personalized icebreaker
- Add an "OpenAI" node (built-in in n8n).
- Model: gpt-4
- Prompt (copy-paste exact):
What this does: Sends the prospect's enriched data to GPT-4, which returns a concise, context-aware opening line.
8. Store results in Google Sheets (optional for review)
- Add a "Google Sheets" node, connect to a sheet named Leads.
- Map columns: First Name, Last Name, Email, Company, Score, Icebreaker.
9. Push qualified leads to HubSpot
- Insert a "HubSpot" node, set Operation to Create/Update Contact.
- Map the same fields plus a custom property lead_score.
- Enable a filter: only contacts with score >= 50 are sent.
10. Activate the workflow - Set a cron trigger to run daily at 02:00 UTC. - Turn the workflow Active.
Your pipeline now automates lead generation with AI, delivering enriched, scored contacts and a ready-to-send icebreaker without any manual copy-pasting.
Where this breaks
| Failure mode | Symptoms | Mitigation |
|---|---|---|
| Browserless rate limit | Scrape nodes start returning HTTP 429 or empty companyInfo. | Upgrade to a paid plan or add a "Throttle" node limiting calls to 10 req/min. |
| OpenAI token quota exceeded | "Insufficient quota" error from the OpenAI node. | Monitor usage via the OpenAI dashboard; set a daily cap in the workflow or switch to a lower-cost model (e.g., gpt-3.5-turbo). |
| Clearbit API key expiry | 401 Unauthorized responses. | Rotate the API key monthly; store the key in n8n's Credentials and enable automatic secret rotation if your vault supports it. |
| HubSpot field mismatch | Leads are not created, error "Property does not exist". | Verify custom properties (lead_score) exist in HubSpot before activation; use HubSpot's schema API to create missing fields programmatically. |
| Data quality gaps | Empty companyInfo leads to low scores. | Add a fallback "If/Else" branch: if companyInfo missing, assign a default low score and flag for manual review. |
| Cost blow-up | Monthly spend spikes unexpectedly. | Enable n8n's built-in Execution History alerts; set a budget alarm in OpenAI and Browserless dashboards. |
For a deeper technical reference, see n8n's documentation.