Automation projects are a growing part of our work. One of the most requested is a lead generation engine: a workflow that collects potential customers from a source, qualifies them, enriches the data and starts a personalised outreach sequence – with as little manual work as possible. We build these with n8n, usually self-hosted. We have completed only a few automation projects so far, so this article describes the architecture and lessons rather than statistics.
The architecture
1. Trigger
The workflow starts from a trigger: a schedule (for example daily), a webhook, or a form submission. For inbound leads, a form or webhook starts the flow; for outbound prospecting, a schedule does.
2. Lead source
The workflow calls a lead source API – a business directory, a data provider or a platform with a public API – and retrieves new records that match defined criteria (industry, location, size).
3. AI qualification
Each lead is evaluated by an AI step against the ideal customer profile: does this business fit? The model gets structured criteria and returns a score and a short reason. Unqualified leads are filtered out before any cost is spent on them.
4. Enrichment
Qualified leads are enriched with additional data: website, contact person, role, company details. Enrichment services usually cost per lookup, which is why qualification comes first.
5. Storage
Results go into a sheet or database, and optionally into a CRM, with status fields so the team can see what happened to each lead: found, qualified, enriched, contacted, replied.
6. Outreach
An email sequence starts for qualified leads, with personalisation based on the collected data. Replies stop the sequence and notify the team.
Lesson 1: build in our environment, then migrate
We build and test the workflow on our own n8n instance first. Once it works, it is migrated to the client's server. This keeps development fast and avoids experimenting on production infrastructure. The migration is a planned step: credentials, environment variables and webhooks change.
Lesson 2: self-hosting needs proper infrastructure
Self-hosted n8n runs well in Docker behind a reverse proxy with SSL. It needs updates, backups and monitoring like any server application. We set this up as part of the project.
Lesson 3: failures must be loud
APIs fail: rate limits, expired keys, changed responses, downtime. A workflow that fails silently is worse than no workflow, because everyone assumes it is working. We add error-trigger workflows that alert the team when any step fails, with enough context to fix it.
Lesson 4: minimise paid API calls
Every lookup, enrichment and AI call has a cost. Ordering matters: filter cheaply first, then qualify, then enrich only the leads that passed. Caching results avoids paying twice for the same company.
Lesson 5: AI needs guardrails
AI qualification is useful but not infallible. We use clear criteria, structured outputs and a confidence threshold. Borderline leads go to a human review list instead of being discarded or contacted automatically.
Lesson 6: deliverability matters for outreach
Outreach emails need an authenticated sending domain, sensible volumes and clean lists. Sending too much too fast from a new domain damages reputation. We usually recommend a separate sending domain for outreach.
Lesson 7: compliance
Outbound email in the EU is regulated. B2B outreach rules differ by country, and consumer outreach without consent is generally not allowed. We discuss the legal basis with the client before activating sequences.
Testing before going live
Before a lead engine runs unattended, we test each step with real but limited data: a small batch from the lead source, qualification results reviewed by the client, enrichment checked for accuracy, and outreach sent first to internal addresses. Only when the client is happy with the quality of qualified leads and the wording of messages do we switch to the full schedule. We also agree daily or weekly limits, so a configuration error cannot send hundreds of emails or burn through API credits overnight.
Workflow overview
| Step | Tool or method | Cost driver |
|---|---|---|
| Trigger | Schedule, webhook or form | None |
| Lead source | Source API | Per request or subscription |
| Qualification | AI model with structured criteria | Per call |
| Enrichment | Enrichment API | Per lookup |
| Storage | Sheet, database or CRM | Low |
| Outreach | Email tool or CRM sequence | Per contact or subscription |
| Monitoring | Error-trigger workflow and alerts | None |
What the client needs to define
- [ ] Ideal customer profile: industries, locations, company size, signals
- [ ] Lead sources they have access to or want to use
- [ ] Where leads should end up (sheet, database, CRM)
- [ ] Outreach messages and sequence rules
- [ ] Legal basis for contacting leads
- [ ] Who handles replies
FAQ
Why n8n instead of Zapier or Make?
Self-hosted n8n gives more control over data, complex logic and running costs at volume. For simple automations, hosted tools can be quicker to start.
Does the AI decide who gets contacted?
It scores and filters based on criteria you define. Borderline cases go to a human, and you approve the outreach messages.
What happens when an API changes?
The error-trigger workflow alerts us, and we adapt the affected step.
What happens when an automation fails?
Without error handling, nothing – it fails silently. We add error workflows that notify someone and log the failed run, so it can be fixed and repeated.
What limits automations most in practice?
API limits and changes on the connected services. In our experience, rate limits, expiring tokens and changed fields are the usual cause of broken workflows, not the automation tool itself.
Planning a automation project?
If you want a realistic plan for your own project, book a short call with our team and we will walk you through the phases, what we need from you and where projects like yours usually lose time. You can also browse finished work in our automation portfolio.
Comments