AI CRM Automation System

02/2025 — 03/2025
Low-code orchestrationRealtime monitoring

The Problem

Manual lead triage, enrichment, and follow-up drafting slow down high-velocity sales pipelines.

The Solution

Built an AI CRM automation pipeline using n8n for orchestration, Claude 3 Haiku for qualification and scoring, Supabase for persistence, and a realtime Next.js dashboard. Automated lead summaries, email drafts, and next-action suggestions end-to-end.

Impact

Reduced time-to-first-action with a low-code, scalable lead automation workflow.

Architecture

Incoming leads from web forms trigger an n8n webhook workflow. The lead data is enriched with company context via a web search node, then sent to Claude 3 Haiku via OpenRouter for qualification scoring and email draft generation. Results are persisted to Supabase with real-time subscriptions that push updates to a Next.js dashboard. The entire pipeline runs without human intervention from lead capture to qualified summary delivery, typically completing in under 8 seconds.

Key Challenges

  • n8n's error handling for external API failures was opaque — a failed OpenRouter call would silently drop the lead. Built a dead-letter queue pattern using a Supabase table that logs all failed workflow runs with full payloads, enabling manual retry without data loss.
  • Claude 3 Haiku produced inconsistent qualification scores when lead data was sparse. Solved by adding a data completeness check before the LLM node — sparse leads get a different prompt template that asks Haiku to flag missing fields rather than force a score.
  • Supabase real-time subscriptions on the Next.js dashboard caused unnecessary re-renders on every database write. Implemented row-level subscription filtering so the dashboard only receives updates for leads in the active pipeline stage being viewed.

Key Learnings

Low-code orchestration tools like n8n are powerful but hide failure modes behind visual abstractions. Building robust error handling required treating n8n as an unreliable message bus and designing for failure from the start. I also learned that LLM qualification works best when you constrain the output format tightly — open-ended scoring produces inconsistent results that are hard to act on downstream.

Technologies

n8nClaude 3 HaikuOpenRouterNext.jsSupabaseTailwind CSSTypeScript