Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

How to Build a Lead Capture & Validation Workflow Using n8n

Description and use

An automated n8n workflow receives lead data via webhook, validates the email format, formats the lead information, and returns a JSON response, eliminating manual lead handling.

Problem

Businesses receive multiple leads daily and manual handling is time‑consuming.

Outcome

The workflow automatically receives lead data, validates the email format, formats the lead information, and returns an appropriate JSON response, eliminating manual lead handling.

Workflow

  • Create a new workflow in n8n
  • Add a Webhook node with POST method, path "lead-intake", response mode "Using Respond to Webhook Node"
  • Add a Code node that extracts name, email, phone, enquiry, trims spaces, lowercases email, checks email format, and returns a structured lead object or validation message
  • Add a Respond to Webhook node that returns JSON with status code 200 for success or 400 for validation failure
  • Connect nodes: Webhook → Code → Respond to Webhook
  • Test the workflow using cURL or Postman
  • Optionally import the provided JSON to create the workflow instantly

Evidence

With n8n, you can build a workflow that automatically receives lead information through a webhook, validates the submitted email address, formats the data, and returns a response.

Source

This code extracts the submitted fields, trims unnecessary spaces, converts the email to lowercase, and performs a basic email-format check.

Source

For a valid email address, the workflow returns a success response containing the formatted lead. If the email is missing or invalid, it returns a validation message.

Source

  • Record date: 2026-10-02T15:55:51.593Z