Case study 01 Full Stack
AI BeeOmnichannel AI Sales & Support Agent
- Type
- Full Stack
- Core stack
- Next.js 16, React 19, TypeScript
AI Bee is a full-stack SaaS that puts one AI agent behind every Meta conversation a business has. It connects Facebook Pages, Messenger, Instagram and WhatsApp (plus Telegram and a website chat widget) into one unified inbox, answers customer DMs and comments 24/7 in the customer's own language, qualifies leads, books meetings and hands off to a human when needed.
01Overview
It is a Turborepo monorepo: a Next.js 16 / React 19 dashboard and marketing site, an Express + MongoDB API, a React Native companion app for the team, and a Shopify extension.
How one inbound message is handled:
- Meta sends a webhook; the API verifies its `X-Hub-Signature-256` signature and deduplicates it by message id.
- The turn is queued on BullMQ + Redis, and rapid-fire messages from the same person are buffered into a single turn.
- Voice notes are transcribed and images described with Gemini; the conversation language is detected.
- A RAG step retrieves the workspace's own knowledge base (Gemini embeddings, optional cross-encoder reranking) and a semantic cache can serve a known answer without an LLM call.
- The LLM agent (@openai/agents over DeepSeek) writes the reply with tool calls for meeting scheduling; persona, lookup and groundedness guards check it before it is sent.
- An action router creates meetings, notifies the team or hands the thread to a human, and emits events into a rules-based automation engine.
Around that pipeline the product includes:
- Lead CRM with AI lead scoring, AI conversation summaries and bulk actions.
- Comment moderation and per-post comment controls.
- Human takeover: a teammate can pause the AI on one thread and hand it back.
- Built-in video meetings (Agora) with booking from the chat.
- Post scheduling, AI content and blog generation.
- Stripe subscriptions metered by token usage, a partner programme, and a super-admin console.
- Role-based access per workspace, an audit trail, and access tokens encrypted at rest.
- Push notifications to the mobile app via Firebase.
02The hard parts
- Replies that stay grounded in the business's own facts: A sales agent that invents prices or delivery times is worse than no agent. I built a RAG pipeline over each workspace's knowledge base and put guards after the LLM (persona, lookup and groundedness checks, plus a final sanitiser) so a reply that isn't supported by the knowledge base is retried or rewritten before the customer sees it.
- Never promising what the team won't deliver: When the AI tells a customer "our team will call you", that has to be true. Replies that commit the team are gated on a push alert actually reaching a teammate first; if the alert fails, the reply is rewritten so it doesn't make the promise.
- Webhooks at real-world volume: Meta retries deliveries and customers send five short messages in a row. Signature verification, idempotent event claims, a BullMQ job queue, per-conversation turn locks and a message-fragment buffer keep each customer turn answered once, in order, with full context.
- Handing a conversation between AI and humans cleanly: Teams need to jump into a thread without the bot talking over them. I implemented human takeover across the messaging channels, so the AI stays quiet while a teammate is in the thread and every message shows whether the AI or a person sent it.
- Keeping LLM cost and latency down: A semantic reply cache, optional reranking with a tight timeout, and model experiments behind flags keep replies fast while subscriptions stay metered by token usage.
03Built with
- Next.js 16
- React 19
- TypeScript
- Redux Toolkit
- Tailwind CSS 4
- Node.js
- Express
- MongoDB with Mongoose
- Redis + BullMQ
- OpenAI Agents SDK
- DeepSeek
- Google Gemini (RAG embeddings)
- Meta Graph API & Webhooks
- WhatsApp Business API
- Stripe
- Agora (video meetings)
- Firebase (push notifications)
- React Native
- Shopify
- Turborepo