n8n portfolio · workflow 2 of 3
AI Lead Qualification Engine
An AI SDR that researches, scores and answers every inbound lead within about a minute, puts hot leads in front of a rep with talking points, and runs a follow-up sequence that stops the moment someone replies. Built for B2B teams whose leads go cold waiting for a reply.
Architecture
Three triggers share one config and one router: new leads, a 15-minute sequencer tick, and inbound replies.
- Trigger
- Code / routing
- Postgres
- App action
- Claude step
Hybrid scoring
Claude judges fit and intent. Deterministic rules keep that judgement honest.
Engineering decisions
Why it is built this way.
- Answer the form firstThe webhook replies 202 before enrichment starts, so the website form never hangs. Bots get the same 202 and are dropped silently.
- Researcher, then judgeOne Claude agent gathers facts with live web search; a second Claude pass scores against the ICP with a strict JSON schema. Research can fail without blocking the score.
- Concurrency-safe round robinRep assignment locks one row with
FOR UPDATE SKIP LOCKED, so two leads arriving together are still spread fairly. - Sequences that cannot double-sendThe sequencer claims due steps atomically and replies inside the original Gmail thread, which is also how replies are matched back to the lead.
- Humans approve the hard repliesWhen a prospect asks a question, Claude drafts the answer as a Gmail draft for the rep. Nothing is sent automatically.
- Compliance built inAn unsubscribe reply cancels every pending step and adds the address to a suppression list that intake and the sequencer both check.