Skip to content
Bryan Silva
01ai-sales-agentAll case studies

AI Agent · WhatsApp · RAG

WhatsApp prospecting with an AI agent

Finds businesses on Google Maps, makes first contact, and an AI agent answers, qualifies and hands the ready lead over to the team.

Status
In production
Role
End-to-end design and development
Stack
  • n8n
  • Evolution API
  • Supabase
  • pgvector
  • Redis
  • Postgres
  • Serper
  • OpenAI
  • Whisper
  • Gemini
  • Google Sheets

Results

contacts/month
2,000+
manual work
−60%
lead sources
3

Problem

Prospecting by hand (finding businesses, getting their phone number, reaching out and answering each one) takes hours from the sales team and doesn't scale.

Solution

Three chained flows sharing one database: sourcing on Google Maps with a tool-calling agent, first contact on WhatsApp by niche during business hours, and a conversational agent that answers, qualifies and hands off the lead with a summary.

How it works

  1. 01Trigger

    Lead sources

    Google Maps through a tool-calling agent, a CRM or Clay, never repeating a search.

  2. 02Process

    Shared database

    Supabase stores leads, search history and the agent's memory.

  3. 03Process

    First contact

    A niche-specific WhatsApp message, in business hours and at random intervals.

  4. 04Process

    Message buffer

    Redis groups split messages in a ~22 s window.

  5. 05AI

    RAG agent

    Text, audio, image and document; answers only from what it found in pgvector.

  6. 06Output

    Human handoff

    The qualified lead goes to the team with a summary; the AI pauses if a teammate joins.

Inside the system

ai-sales-agent/sourcing
n8n sourcing workflow: generated search, duplicate check in Supabase, AI agent with Serper and lead storage

Sourcing flow on Google Maps

ai-sales-agent/first-contact
n8n first-contact workflow: list reading, number validation, message by niche and send log

First-contact flow

ai-sales-agent/agent
n8n conversational agent workflow: message control, Redis buffer, RAG agent and lead summary

Conversational agent with RAG

Technical decisions

  • Decoupled chain. Sourcing, sending and support are separate flows sharing the database: each stage changes or scales on its own.
  • Real continuity. The first message is stored in the agent's memory, so the AI knows what the lead was told.
  • Debounce. Split messages are grouped in Redis (~22 s window) before replying.
  • Multimodal. Text, audio (Whisper), image and document.
  • RAG with a rule. A pgvector knowledge base and one fixed rule: it only answers from what it found.
  • Human-in-the-loop. If someone from the team writes in the chat, the AI pauses itself.
  • Number validation with a fallback for Brazil's ninth mobile digit.
  • Natural replies. The answer is split into several short messages.

Result

End-to-end prospecting with no manual work: the system finds, contacts and qualifies, and the team steps in only when the lead is ready, with full context.