Overview
Nexus lets one owner connect several WhatsApp numbers, each with its own configuration, clients and statistics. Every channel runs exactly one of two interchangeable modules: a dispatcher that routes messages to specialist AI agents, or a deterministic decision-tree bot the owner builds themselves.
Problem
Gyms, coaches and service businesses lose clients when WhatsApp goes unanswered, and many of them need a reliable menu rather than a language model billed per message.
What it is
A signed WhatsApp Cloud API webhook receives each inbound message and matches it to a channel by phone number id. The channel's active module produces the reply. Both modules write to the same client and conversation records, so the dashboard's conversation view works identically for either.
AI agents module
A dispatcher classifies intent with structured output and routes to one of four tool-loop agents — sales, support, retention and content — each with its own instructions and tools.
Each exchange is embedded into a per-client memory table in Postgres with pgvector, so an agent does not re-ask what the client already told another one. The support agent searches a knowledge base the same way.
Flow Builder module
For “press 1 for hours, 2 for pricing, 3 for a human”, the owner builds menus with numbered options that reply with text, a media file or a submenu. The engine keeps each client's position in the tree, matches the reply against the current menu's triggers and returns to the main menu after every leaf.
There are no model calls anywhere in this path, so it has no per-message AI cost.
Live dashboard
Agent tool calls publish events through an in-process pub/sub that a Server-Sent Events route forwards to connected dashboards. A panel streams the classify-then-respond pipeline as newline-delimited JSON, so the reply appears token by token from the real model stream.
Architecture
Technical decisions
- A deterministic module next to the AI one
- Not every business needs or can pay for a model per message. A menu bot covers the common case with predictable behavior and no AI cost, and shares the same data so switching is a setting.
- Pluggable model resolution
- One module decides the provider: Gemini directly when its key is set, otherwise the AI Gateway. Agents and embeddings follow the same choice.
- In-process pub/sub for the event feed
- It needs no extra infrastructure and works while instances are reused across concurrent requests. A deployment across many instances would replace it with Redis pub/sub.
- Phone number per channel, not per environment
- Keeping the WhatsApp phone number id in the channel record instead of an environment variable is what allows several numbers under one login.
Limitations
- Early prototype: the Git history spans two days.
- There are no automated tests and no CI.
- The event feed's in-process pub/sub does not scale across multiple instances.
- Connecting a real number requires a Meta app and a WhatsApp Business setup by the owner.
- The public demo is read-only: it shows seeded sample data and cannot send messages or call a model.
