← All work Case Study · AI Automation

The Lead Engine — optional AI lead capture and inquiry routing

Many small businesses treat every form submission the same and follow up whenever they get to it — so the hot lead and the spam can land in the same inbox. The Lead Engine is an optional automation behind Wilde Digital's own forms: it captures each inquiry, uses Claude to help qualify and prioritize it, files it in a CRM, and notifies the owner — with an email fallback designed so inquiries aren't silently lost.

How it works
Form submit Validate + spam filter AI qualify (Claude) Save to CRM Instant alert

Inquiries are scored and prioritized before they reach a human. If the AI, the CRM, or the alert ever fails, the visitor is handed a prefilled email instead — so the system degrades to a prepared email rather than a dropped inquiry.

The problem

A contact form is where most small-business lead handling quietly breaks: no triage, no speed, no record. Owners either drown in low-quality submissions or miss the one that mattered because the reply came a day late. The fix isn't a bigger inbox — it's qualifying and routing the lead the moment it arrives.

What it does
  • AI priority + 0–100 score on every lead
  • Business-type detection and a one-line summary
  • A suggested reply angle so follow-up is faster
  • Red-flag / spam detection (plus a silent honeypot)
  • Files a structured row in the CRM automatically
  • Instant phone alert with the priority up front
  • Server-recomputed ROI estimate stored with calculator leads
Technical implementation
  • Netlify Functions — Node, zero runtime dependencies
  • Anthropic Messages API (claude-haiku-4-5), structured JSON output
  • Hand-rolled schema validation with a safe fallback
  • Swappable CRM (Airtable) + notifier (Telegram/Resend) adapters
  • Honeypot + per-IP rate limiting on intake
  • Server-side recompute so client numbers can't be spoofed
  • 43 automated tests across math, validation, and capture
Design decision

Two rules drive the whole pipeline: never trust the client, and don't drop a lead. The qualifier degrades to a safe, valid result if the model or API misbehaves, and the function only reports success once a real channel has captured the lead — otherwise the page falls back to a prepared email. The AI key lives server-side and never ships to the browser.

Roadmap
  • Live deployment + public capture metrics
  • Email channel (Resend) alongside Telegram
  • Per-source routing and lead-stage automation
What this demonstrates

Real AI in production-shaped code — structured output, graceful degradation, secure key handling, and test coverage — not a single API call wrapped in hope. It's the difference between "calls an AI" and "ships a reliable automation a business can run on."