// open to GTM engineering roles & freelance in the UK — reach out →
ingh@
← back to how-to
n8n7 min readMay 2026

How to automate lead routing with webhooks in n8n

When a new lead comes in, five or six things need to happen at once. Most teams do this manually. Here is how to automate the entire handoff with one webhook workflow.

n8nHubSpotSlackOpenAIClearbit

What lead routing actually is

Lead routing is the process of deciding what happens to a new lead when it comes in and making sure all of it happens consistently. Who gets notified, which system gets updated, which sequence the lead goes into, which team member owns the follow-up.

In most teams, this is done manually. Someone checks the form submission, creates the HubSpot contact by hand, slacks the relevant rep, maybe enriches the record with a quick Google. It takes five to ten minutes per lead and it is inconsistent. Busy days mean things get missed.

Automating lead routing with n8n replaces all of this with a single webhook workflow that runs in under 30 seconds for every lead that comes in.

Mapping the routing logic before you build

Before you open n8n, map out exactly what needs to happen when a new lead comes in. Write it as a sequence of steps, not as a flowchart. Every step becomes a node.

A typical routing workflow looks like this: receive the lead data from a form or an external tool, create or update a contact in HubSpot, enrich the contact with company data, classify the lead by ICP fit using AI, notify the right person on Slack based on the classification, and add the lead to the appropriate outreach sequence.

That is six steps. Six nodes. Each one does exactly one thing. The order matters because the output of each step feeds into the next.

If your routing has conditional logic — enterprise leads go to one rep, SMB leads go to another, specific industries get a different sequence — map those branches explicitly before you build. Adding branching logic after the fact to a workflow that was built assuming a single path is painful.

Building the webhook entry point

Create a new n8n workflow and add a Webhook trigger node. This is your entry point. Every lead that comes in will hit this URL.

Set the HTTP method to POST. n8n gives you a webhook URL. This is what you paste into your form tool, your CRM, or whatever is sending you leads. Configure the response mode to "Respond to Webhook" and set it to return a 200 status immediately. You do not want the sending system waiting for your entire workflow to complete.

Test the webhook by sending a sample payload using Postman or curl. Look at the Input panel in the webhook node to see exactly how the data comes through. The field names in the incoming payload will be what you reference throughout the rest of the workflow. Note them down before you add the next node.

One practical note: if you are receiving leads from a third-party tool like Typeform, HubSpot forms, or Apollo, check their webhook documentation to understand their payload structure. The field names are often not obvious.

Enrichment, classification, and notification

After the webhook node, add a HubSpot node set to create or update contact. Map the fields from the incoming payload to the HubSpot contact properties. Use the email address as the unique identifier so existing contacts get updated rather than duplicated.

Add an HTTP Request node to enrich the contact. Clearbit's company enrichment API takes a domain and returns headcount, industry, tech stack, and funding data. Pass the company domain from the contact data and store the enrichment response for use in the next step.

Add an OpenAI node. Pass it the contact data and the enrichment data. Ask it to return a JSON object with two fields: a tier (Hot, Warm, or Cold) based on your ICP criteria, and a one-sentence reason. This becomes the brief that goes into the Slack notification.

Add an If node to branch on the tier. Hot leads go to one branch, everything else to another. In the Hot branch, add a Slack node that sends a detailed message to your sales channel. Include the contact name, company, the ICP classification, and a direct link to the HubSpot record. In the other branch, add the lead to a nurture sequence or just log it without a Slack alert.

The whole workflow from webhook to Slack notification runs in under 30 seconds. The rep sees a structured brief with everything they need to decide on follow-up. No manual research, no context switching, no leads falling through.

Handling failures gracefully

Every step in this workflow can fail. The enrichment API can time out. HubSpot can return an error. OpenAI can produce malformed JSON. If you do not handle failures, one API error kills the entire routing workflow for that lead.

Add error handling to every external API call. In n8n, you can set nodes to "Continue on Fail" which means the workflow keeps running even if that node errors. Add logic downstream to detect when a node failed — usually by checking whether the expected output exists — and route accordingly.

The minimum failure handling: if enrichment fails, continue with whatever data you have from the original payload. If the AI classification fails, default to the Warm tier and flag it for manual review. If the Slack notification fails, log the error and move on — the lead is already in HubSpot so nothing is lost.

Add a final node that sends an error summary to a dedicated Slack channel when any node fails. This keeps the workflow running for the lead while making sure you know something went wrong. You can review and fix the failure without it silently missing leads.