Skip to content
Sadra Raadfar
All work
CRMPortfolio project2026

B2B Lead Qualification & Follow-up Automation

Capture, score, route and follow up on inbound leads without manual triage.

  • Workflow orchestration
  • HubSpot
  • OpenAI API
  • PostgreSQL
  • Gmail API
01

Overview

A complete inbound lead pipeline designed around one constraint: every lead gets a consistent decision and a reply within minutes, and every decision is explainable afterwards.

02

The problem

Inbound leads arrive through forms and inboxes, then wait for someone to read, judge and forward them. Response times slip and qualification is inconsistent between people and days.

03

Existing process

  1. 01Lead submits a website form; a notification email lands in a shared inbox.
  2. 02Someone reads the message, guesses fit, and copies fields into the CRM by hand.
  3. 03The lead is forwarded to a rep over chat, sometimes with context, sometimes without.
  4. 04Follow-up depends on whoever remembers; no shared definition of a qualified lead.
04

Proposed system

  • Single intake endpoint normalises every source into one lead schema.
  • Deterministic validation runs before any AI: email syntax, domain checks, duplicate lookup.
  • An LLM step returns a strict JSON verdict — segment, fit score, reasoning, next action.
  • CRM record is created or merged idempotently using the email domain as the merge key.
  • Routing rules assign an owner by segment and territory, with a fallback queue.
  • A templated first-touch email is generated, then queued for send with a human-review gate on low-confidence leads.
05 — Workflow

The system, node by node

  1. 01

    Form intake

    Webhook receives payload, stamps source + timestamp

  2. 02

    Validation

    Schema check, disposable-domain filter, dedupe lookup

  3. 03

    Enrichment

    Company domain metadata attached to the record

  4. 04

    AI qualification

    Structured JSON: score, segment, reasoning

  5. 05

    CRM sync

    Upsert contact + company, write score fields

  6. 06

    Routing

    Owner assignment by segment, territory and load

  7. 07

    Follow-up

    Personalised first-touch email, review gate under threshold

  8. 08

    Reporting

    Daily rollup: volume, score distribution, response time

  1. Form intake
  2. Validation
  3. Enrichment
  4. AI qualification
  5. CRM sync
  6. Routing
  7. Follow-up
  8. Reporting
06

Business logic

Score >= 70
Route to sales owner immediately, send first-touch email automatically.
Score 40–69
Route to nurture sequence, notify owner without an SLA clock.
Score < 40
Store in CRM, no outreach, included in the weekly review sample.
Confidence < 0.6
Hold outbound email and flag the lead for human review.
Existing open deal
Never create a duplicate; append the message to the deal timeline.
07

Failure handling

CRM API timeout
Exponential backoff, three retries, then a dead-letter table with alert.
Invalid or partial payload
Rejected at the schema gate, stored raw for inspection, never silently dropped.
Duplicate submission
Idempotency key on email + form + 10-minute window.
LLM returns malformed JSON
One reparse attempt with a stricter prompt, then fall back to rule-based scoring.
Ambiguous fit
Escalated to a human review queue rather than guessed.
08

Demonstration

Simulation notice

This project is a portfolio simulation built to demonstrate automation architecture and workflow implementation. It was exercised against a generated dataset of synthetic leads to test routing, deduplication and failure paths — the figures below describe the simulation, not a client deployment.

09

Design decisions

  • Validate before you spend a token

    Deterministic checks run first. Junk never reaches the model, which keeps cost predictable and makes failures easier to read.

  • Structured output, not prose

    The model returns a strict schema. Anything that fails the schema falls back to rules instead of half-parsing free text.

  • Idempotency is the whole game

    Retries are only safe when every write is keyed. Most of the design time went into merge keys, not into the happy path.

Next

Want a process mapped like this?

Contact Me