Lead enrichment & routing engine
Clients came to me because follow-up was slow or the reps said the leads were bad. In each case, new leads sat in a queue until someone sorted them by hand.
- Role
- Architecture, build, live demo
- Stack
- Python, Apollo, Claude, Slack, CRM API
- Ships as
- Runnable repo, dry-run by default
- Result
- Lead to assigned rep in under 60 seconds
How the problem gets described
It usually arrives as one of these:
- “Our follow-up is too slow.”
- “The reps say the leads are garbage.”
- “We pay for Apollo and I can’t tell you what it’s doing for us.”
Trace any of the three back far enough and you arrive at the same queue:
- A form fill lands in an inbox, a CRM list or a spreadsheet tab.
- Someone looks the company up by hand to decide whether it’s worth caring about.
- Whoever checks the queue next takes what’s on top, whether or not it’s urgent.
- A VP asking for pricing sits in the same undifferentiated list as a student doing a class project.
- The CRM and the channel your team works in never talk to each other.
A lead that arrives at 4pm on a Friday and gets opened Monday has spent the weekend talking to whoever replied first. That’s the cost, and it doesn’t show up on any dashboard.
What I built
Four stages that fire the moment a lead arrives, ending with it in the CRM and the right person notified.
Enrichment
Company size, industry and an estimated deal value come from Apollo, so the score isn’t built only on what the lead chose to type. People under-describe themselves constantly. Enrichment is what stops a real buyer from being judged on a two-word job title.
Scoring that says why
An editable point system across company size, deal value, urgency language in the message and seniority of title. The part that got it adopted: Claude writes a one-line plain-English rationale next to the number, so a rep opening the record sees the reasoning instead of an integer they have no cause to trust.
Routing from a file
Assignment rules live in routing_rules.json. You can move a threshold, add a rep or add a tier without a redeploy or an engineering ticket. It also happens to be the easiest thing to demo: open the file, change one number, re-run, watch a different rep get the lead.
The part you’d be right to argue with
If you have a data science team, they will tell you this scoring is primitive. They are correct. A trained propensity model would score better on a backtest. It would also be unexplainable to the rep using it and unchangeable by the ops person maintaining it, and I have watched that combination kill adoption more than once.
- The model never touches the number. It writes the explanation; the rules produce the score. Same lead, same score, every time. That matters the first time someone asks why a deal got routed the way it did.
- Dry run is the default. With
DRY_RUN=true, every step prints what it would do, with no API spend and no real CRM or Slack writes. That turned out to matter more for winning the work than any feature in it, because it means I can run the thing live in front of you.
What it does
- Form fill to an enriched, scored, assigned lead in the right queue
- < 60sForm fill to an enriched, scored, assigned lead in the right queue
What I haven’t solved: the score leans on urgency language, and the people who write “just having a look around” while holding signed budget score low every time. I don’t have a clean fix for that one yet. If you’ve seen it handled well, I’d like to hear how.