In modern B2B marketing, the speed of contact after capturing a lead (Speed to Lead) is the main factor in closing sales. If a lead fills out your website form and takes hours to be registered in the CRM and distributed to a salesperson, the probability of closing plummets.
In this article, we detail how to automate this workflow utilizing the flexibility of n8n to connect with market-leading sales platforms (HubSpot and Salesforce).
1. The Capture and Data Validation Workflow
Instead of sending leads directly from the form to the final target CRM, n8n acts as an intelligent data cleaning layer.
The Steps:
- The website form triggers an HTTP POST request (webhook) to n8n.
- n8n intercepts the data and validates the email format, removing invalid domains or test contacts.
- Using integration nodes with data enrichment APIs (such as Lusha or Clearbit), n8n extracts information about the lead's company (such as size and estimated revenue).
2. Intelligent Routing (HubSpot to Salesforce)
Depending on the size of the business opportunity, the lead can follow different paths within the sales team.
Logic in n8n:
- SMB Lead (Small Business): Automatically directed to email nurturing workflows in HubSpot using the native API.
- Enterprise Lead (Large Corporation): Automatically creates an "Opportunity" in Salesforce and assigns the contact to a senior Account Executive, triggering an immediate notification in the salesperson's Slack or Teams.
3. Run n8n and test the webhook
n8n stays on the server and listens only on 127.0.0.1. The tag below is 1.104.1. Before you copy it, check the current stable tag on hub.docker.com/r/n8nio/n8n.
services:
n8n:
image: n8nio/n8n:1.104.1
ports:
- "127.0.0.1:5678:5678"
environment:
N8N_HOST: localhost
N8N_PORT: 5678
N8N_PROTOCOL: http
WEBHOOK_URL: http://localhost:5678/
volumes:
- n8n_data:/home/node/.n8n
volumes:
n8n_data:
docker compose up -d
curl -sS -X POST http://127.0.0.1:5678/webhook-test/lead \
-H 'Content-Type: application/json' \
-d '{"email":"ana@example.com","company":"Example Co","employees":120}'
Replace webhook-test/lead with the path the Webhook node shows. A 404 means the workflow is not active. JSON in the response means n8n received the lead.
The next node calls the CRM. HubSpot, new contact:
curl -sS https://api.hubapi.com/crm/v3/objects/contacts \
-H "Authorization: Bearer $HUBSPOT_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"properties":{"email":"ana@example.com","company":"Example Co"}}'
Salesforce, new lead. The API version is in Setup. v62.0 below is the example:
curl -sS "https://YOUR_DOMAIN.my.salesforce.com/services/data/v62.0/sobjects/Lead" \
-H "Authorization: Bearer $SF_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"LastName":"Silva","Company":"Example Co","Email":"ana@example.com","LeadSource":"Website"}'
In n8n the routing rule reads employees: up to 200 follows the HubSpot HTTP node. Above that, the Salesforce HTTP node and a Slack message. The token stays in an n8n credential, not in the workflow body.
Conclusion
Automating business lead management avoids manual bottlenecks and data entry errors. Designing reliable integrations with n8n ensures registration consistency across platforms and significantly accelerates the sales closing cycle for new business partners.