Work / n8n, RAG
AI customer service
One assistant, built for WhatsApp, Messenger and Instagram, that knows whether it is talking to a consumer or a business and answers from the company's own documents.
The problem
Consumers and business buyers wrote to the same inbox. A consumer wants to know where to buy a product. A restaurant wants a price list and a salesperson. Both got the same treatment.
What I built
A router agent reads the message and decides: consumer or business. Each side has its own agent with its own knowledge base. The knowledge comes from documents the company keeps in a shared drive. A workflow splits them, embeds them and stores them in Postgres.
The business agent sorts the contact into one of three types and collects a lead: four fields, one question per turn. It saves as soon as it has a name and a phone number, so a half-finished chat is still a lead. Sales gets a mail.
Every agent has a hard cap on how many steps it may take. An agent without a cap can keep calling a model all night.
The handover to a human is not in this build. It is in the public version of this bot, which you can read on GitHub.
How it fits together
- ChannelsWhatsApp, Messenger, Instagram
- Gatewayn8n workflow, one format for all three
- Router agentconsumer or business, memory per conversation
- Specialist agentsconsumer agent, business agent with lead capture
- Knowledgepgvector in Postgres, reranker, documents from a shared drive
What came out
| Channels it is built for | 3 | measured |
|---|---|---|
| Knowledge bases | 2 | measured |
| Contact types the business agent recognises | 3 | measured |
I have not counted conversations, so there is no number for that here.