The Multi-Source Lead Enrichment Pipeline

Difficulty
6/10
Tags
http-requestapierror-handlingmergeconditional-routing

Your startup receives inbound leads that need validation and enrichment before routing to sales. You'll work with real APIs to check if email domains exist and pull company data.

What you'll practice:

  • HTTP Request nodes with authentication headers
  • IF nodes for branching logic
  • Merge nodes to combine paths
  • Native error handling with "On Error" settings

Hints

API Setup: Get a free API key at api-ninjas.com. Include header X-Api-Key: YOUR_API_KEY in requests.

Step 1: Domain Validation Extract email domain and check DNS:

GET https://api.api-ninjas.com/v1/dnslookup?domain={domain}

DNS records returned = valid, empty/error = invalid

Step 2: Company Enrichment For valid domains, fetch company data:

GET https://api.api-ninjas.com/v1/company?domain={domain}

Not all domains have data — handle gracefully.

Step 3: Routing Logic Use IF nodes to evaluate criteria and route to buckets.

Step 4: Error Handling API failures should route to NEEDS_REVIEW, not crash the workflow.

Constraints:

  • Use at least 3 separate paths that merge back together
  • No Code node over 50 lines
  • API calls must use HTTP Request nodes
  • Use n8n's native error handling ("On Error" setting)

Explanation

The solution uses HTTP Request nodes to fetch input data and call the API Ninjas endpoints for DNS lookup and company enrichment.

Key concepts demonstrated:

  • Fetching JSON data from a URL with an HTTP Request node
  • Extracting domains from email addresses using expressions or a Code node
  • Branching with IF nodes based on API responses
  • Merging multiple paths back together with Merge nodes
  • Using "On Error" settings for graceful failure handling
  • Building routing logic with multiple criteria

Login to see the exercise

Create an account to access challenges and track your progress.

Log in to see exercise