Skip to content
William Lei
All work

A lead-routing backend that puts every enquiry in the CRM and in front of the right consultant

A Python backend that takes leads from WhatsApp, Facebook and Instagram ads, website forms and CSV uploads, cleans them into one shape, assigns a consultant fairly, and writes them into Odoo, for two companies from one deployment.

Context
Freelance project
Role
Sole engineer: design, build, deployment
When
May to Oct 2026

Results

MeasureBeforeAfter
Consultant assignmentManualAutomatic, leave-aware
Lead entry into OdooBy handAutomatic create or update
Duplicate checkEmail onlyMatched against Odoo
Lead sourcesWhatsApp, Meta ads, web forms, CSV
Automated tests233

The problem

Consultants were assigned by hand and leads were typed into Odoo manually. The old website integration only checked email for duplicates, so the same person could appear several times, and leads from WhatsApp and Meta ads had no automated path at all.

What I did

  • One intake for every channel

    FastAPI webhooks receive SleekFlow (WhatsApp), Facebook Lead Ads and website form events, plus staff CSV uploads of Meta exports. Every payload is stored the moment it arrives, acknowledged fast, and normalised into one lead shape.

  • Rules the team can edit

    Market segments, value translations and consultant queues live in Google Sheets that the business maintains, so routing changes without a code release. Assignment is round-robin per queue and skips anyone on leave.

  • Reliable delivery

    Durable SQLite-backed queues with retries and idempotency handle consultant and client WhatsApp notifications, and hold Facebook leads until working hours. Every Odoo write adds an audit note with the evidence behind the routing decision.

  • Checking the chatbot's answers

    Qualification answers from the WhatsApp flow are cross-checked against the conversation transcript, with a shadow mode that records mismatches before anything is changed, and an LLM gives advisory validation on uploaded CSVs.

How it fits together

  1. 1

    Channels

    SleekFlow WhatsApp, Meta Lead Ads, web forms, CSV

  2. 2

    Intake

    FastAPI webhooks, payloads persisted on arrival

  3. 3

    Rules

    Google Sheets dictionaries and consultant queues

  4. 4

    CRM

    Odoo JSON-RPC lead create or update with audit note

  5. 5

    Notify

    Queued, retried WhatsApp templates via SleekFlow

Stack

  • Python
  • FastAPI
  • Celery and Redis
  • SQLAlchemy and Alembic
  • Odoo JSON-RPC
  • SleekFlow API
  • Meta Graph API
  • Google Sheets API
  • Pytest

Have something similar in mind?

Book a 20-minute intro call, or write to william@wlei.org.

Book a 20-min intro call