LeadModule
Back to blog
Tutorial

How to Build a Lead Enrichment Workflow in n8n with LeadModule

·4 min read·Marco Kwak, Founder

Build a complete lead enrichment pipeline in n8n using LeadModule's API. Two approaches: webhook callbacks for hands-off automation, or polling for full control.

n8n is an open-source workflow automation tool that's self-hostable and uses execution-based pricing. At high volume, execution-based pricing tends to cost less than per-step models like Zapier's.

You don't need a native LeadModule node to build an enrichment pipeline. The standard HTTP Request node can call any API, letting you add conditional logic, error handling, and custom routing.

This guide shows how to integrate LeadModule's waterfall enrichment into n8n workflows.

Prerequisites

Before you start, make sure you have:

  • An n8n instance (cloud or self-hosted).
  • A LeadModule account with an API key (starts with lm_live_).
  • A lead source, like a Google Sheet, a CRM webhook, or a manual trigger.

The webhook approach is the most efficient way to handle enrichment. Instead of waiting for a response, you tell LeadModule where to send the results when they're ready.

1. Set up the n8n Webhook node

Create a new workflow and add a Webhook node. Set the path to /leadmodule-results and the HTTP Method to POST. This node will receive the enrichment data once the waterfall finishes.

2. Configure the enrichment request

Add an HTTP Request node to your main workflow. This node will submit the lead data to LeadModule.

  • Method: POST
  • URL: https://app.leadmodule.ai/api/v1/enrich
  • Authentication: Header Auth
  • Header Name: Authorization
  • Header Value: Bearer lm_live_your_api_key

In the Body section, select JSON and map your lead data to these fields:

{
  "firstName": "={{ $json.firstName }}",
  "lastName": "={{ $json.lastName }}",
  "companyDomain": "={{ $json.companyDomain }}",
  "linkedInUrl": "={{ $json.linkedInUrl }}",
  "enrichmentType": "email",
  "webhookUrl": "https://your-n8n-instance.com/webhook/leadmodule-results"
}

3. Handle the callback

When the enrichment completes, LeadModule will send a POST request to your Webhook node. The payload will include the runId, the status, and the result object.

{
  "runId": "uuid-string",
  "status": "completed",
  "result": {
    "email": "jane@example.com",
    "confidence": 0.95,
    "provider": "prospeo",
    "validation": {
      "status": "valid",
      "score": 100
    }
  }
}

4. Route the result

Use an IF node to check if result.email exists. If it does, you can push the data to your CRM or a spreadsheet.

The webhook approach is better for your n8n performance. It doesn't consume execution time while waiting for the enrichment to finish.

Approach B: Polling Loop

If your n8n instance is behind a firewall or you can't use a public webhook URL, you can use a polling loop instead.

1. Submit the enrichment

Use the same HTTP Request node as in Approach A, but leave the webhookUrl field empty. LeadModule will return a 202 Accepted response with a runId.

2. Add a Wait node

Enrichment takes time. Add a Wait node and set it to 30 seconds. This gives the waterfall enough time to query multiple providers.

3. Poll for the result

Add another HTTP Request node. Set the method to GET and the URL to:

https://app.leadmodule.ai/api/v1/enrich/{{ $json.runId }}

4. Check the status

Use an IF node to check the status field in the response.

  • If status equals completed: Continue to your CRM or next step.
  • If status is still pending: Loop back to the Wait node.

Handling Multiple Leads

When processing a list of leads, you should wrap your logic in a Loop Over Items (or Split In Batches) node.

  • Batch size: Set this to 1 to respect rate limits.
  • Rate limits: The default limit is 60 requests per minute. Add a 1-second Wait node between batches to stay safe.
  • Throughput: At 60 requests per minute, you can process 1,000 contacts in about 17 minutes.

Error Handling

Don't let a single failed request stop your entire workflow.

  • HTTP Status Codes: Watch for 429 (rate limited), 402 (out of credits), or 401 (invalid API key).
  • Continue on Fail: Enable the "Continue on Fail" option in the HTTP Request node settings. This allows you to catch errors and log them without crashing the execution.

Build Your Enrichment Workflow

LeadModule's API works with n8n, Make.com, and any HTTP client. Start free.

Get Your API Key

Frequently Asked Questions

Does LeadModule have a native n8n node?

No. LeadModule uses a standard REST API that works with n8n's HTTP Request node. No custom node is needed.

Which approach should I use — webhook or polling?

Use the webhook approach if your n8n instance has a public URL. It's simpler and doesn't consume execution time while waiting. Use polling if you're behind a firewall.

How long does enrichment take?

Waterfall enrichment typically completes in 5 to 30 seconds per contact depending on how many providers are queried.

What happens if the API rate limits me?

You'll get a 429 response with a Retry-After header. Add a Wait node and retry. Default limit is 60 requests per minute.

Can I use this workflow with Make.com instead of n8n?

Yes. The API is the same. Replace n8n's HTTP Request node with Make's HTTP module. The webhook approach works identically.