A lead routing and deal risk system I built on HubSpot, n8n and Claude for a made-up accounts payable software company. Watch it run, then score a test lead.
Tier A is the best fit and goes to a sales rep first. Tier D is nurtured or disqualified.
Fill it in the way a buyer would. Use a real company or make one up.
Same scoring code as the live form, minus the website lookup. Lead details go to Claude. I keep the company, email domain, job title, result and any ref tag from your link. Nothing is written to HubSpot.
The same contacts and deals also go through these jobs.
| Job | Runs | What it does |
|---|---|---|
| Speed to lead | Every 5 minutes | Checks new leads for a first call, email or meeting. A missed deadline puts a task on the sales manager. |
| Deal risk | Mondays | Rules score every open deal. Claude reads recent calls and notes, can move the score one level and writes the owner a next step. |
| Forecast snapshot | Mondays, 7:20am | Saves the open pipeline each week to show what was added, won, lost or slipped. Claude writes the CRO brief from figures the code computed. |
| Portal audit | Mondays, 7:40am | 31 read-only checks on data quality, pipeline hygiene and governance. Claude ranks the fixes. |
| Reporting | Always on | Four HubSpot dashboards: pipeline and forecast, funnel by source, speed to lead, and data quality. |
| Change control | Every deploy | Fields, pipeline and forms deploy from a spec locked to this portal. Every AI decision is logged with its model and prompt version. |
20 test leads with known answers, including spam, a competitor and three prompt injections. A prompt change ships only if it clears all three bars.
| Bar | Needed | v5 got |
|---|---|---|
| Spam, competitor and injection cases handled | All | All |
| Right tier, owner and deadline | 19 of 20 | 20 of 20 |
| Leads that pass every check | 17 of 20 | 20 of 20 |
v5 is live. It scored 20 of 20 on three runs in a row on Oct 17, at about $0.009 per full test.
Happy to walk you through the portal and the n8n workflows. All the data is synthetic.