nadun.me

Case study

Sellora

WhatsApp AI commerce platform for Sri Lankan businesses

A multi-tenant SaaS that gives every store its own AI sales assistant on WhatsApp. It understands Sinhala, Tamil, English and Singlish over text, voice notes and photos, finds the right product, takes the order, and hands over to a human when it should.

Role
Product design, architecture, full-stack engineering, deployment
Timeline
July 2026 - present
Status
Live - onboarding merchants
Type
Multi-tenant SaaS
Sellora marketing site hero showing a live WhatsApp conversation being turned into a confirmed order
Marketing site - a live WhatsApp conversation becoming order #SL-2048

5

Deployed apps in one monorepo

4

Languages understood per message

30+

Data models scoped by tenant

45+

Automated test suites

01 · Problem

What was broken

Most small and mid-sized businesses in Sri Lanka already sell on WhatsApp. Customers message a shop after seeing a Facebook or Instagram ad, ask about a product, and expect an answer in Sinhala, Tamil, English or a mix of all three - often as a voice note or a photo of what they want.

Behind the scenes that means a person typing replies all day, orders written down by hand, stock tracked in a separate spreadsheet, and sales lost every time the team is asleep, busy, or slow. Off-the-shelf chatbots reply in stiff English, invent products and prices, and cannot take a real order.

02 · Solution

What I built

Sellora gives each store a WhatsApp sales assistant that behaves like their best salesperson. It is grounded in that store's own catalogue and FAQs, so it can only state facts that exist there, and it answers with an honest "I'll check with the team" and an optional human handoff for anything else.

The assistant drafts and confirms orders inside the chat, deducts stock when an order ships, records payment method and courier tracking, and attributes each order back to the ad that started the conversation. Staff can step into any chat from the tenant dashboard, which pauses the bot until they hand it back.

For the platform owner there is a super-admin panel to create tenants, bind WhatsApp numbers, set per-tenant AI keys, manage plans and billing, and read an immutable audit trail of every change across the system.

03 · Architecture

How it fits together

Sellora is a monorepo of five deployable apps that all talk to one backend API. Every record is scoped by tenant, and a single WhatsApp webhook routes each incoming message to the right store.

Backend API

Node 20 · TypeScript · Express · MongoDB (Mongoose)

Everything talks to this: auth, tenants, catalogue, orders, conversations, webhook, billing, audit

Tenant platform

Next.js

Products, stock, orders, customers, conversations inbox, FAQs, broadcasts, analytics, team, billing

Super-admin panel

Next.js

Tenants, AI keys, WhatsApp binding, plans, billing, platform settings, audit logs

Storefront

Next.js · Cloudflare Turnstile

Public merchant catalogues, carts, direct checkout and WhatsApp product handoff

Marketing site

Next.js (static)

Product story, pricing, FAQ, demo request - in English and Sinhala

Request flow

  1. Meta posts a message to the single /webhook/whatsapp endpoint. The HMAC signature is verified with the app secret, then the payload's phone_number_id selects the tenant.

  2. Voice notes are transcribed with the tenant's own AI key using Sinhala and English language hints, with fallbacks across OpenAI and Gemini models. Photos go to a vision model for product matching. Text passes straight through.

  3. The language of the message is detected - Sinhala script, Tamil script, romanised Singlish or English - and the reply mirrors it, honouring the tenant's language toggles. Unclear messages fall back to Sinhala.

  4. The sales agent runs tool-calling rounds against the tenant's catalogue, FAQs and order tools. Orders are drafted server-side and created only after one explicit customer confirmation; fake confirmations are detected and blocked.

  5. When staff mark an order as shipped, stock is deducted atomically per product and restored if the order is later cancelled or returned. Status updates go back to the customer in their own language.

  6. Every mutation is written to an immutable audit trail, usage is metered per tenant per month, and a rejected token, exhausted model or signature mismatch emails the platform owner instead of silently taking a store offline.

04 · Technologies

Stack

Frontend

Next.jsReactTypeScript

Backend

Node.js 20ExpressMongoDBMongooseZodPino

AI & messaging

OpenAI SDKOpenRouterGeminiMeta WhatsApp Cloud APITool calling

Security

JWT + rotating refresh tokensAES-256-GCM secrets at restWebAuthn passkeysbcryptHelmetRate limiting

Infrastructure

VercelGitHub ActionsCloudinaryNodemailerCloudflare Turnstile

05 · Screenshots

In the product

Sellora tenant dashboard for Zeylonia Marketplace showing revenue, orders, products and conversations
Tenant platform dashboard - store performance, order status and sales attribution in one workspace
Zeylonia Marketplace storefront powered by Sellora, with product search, category filters and a shopping cart
Hosted storefront - a branded merchant catalogue with product search, filters and cart
Sellora feature grid describing what the WhatsApp assistant does automatically
What the assistant does - voice notes, photo matching, safe order taking, stock, ad attribution
Sellora demo request page with a business details form and package selection
Demo request flow - a personalised demo is prepared around the merchant's own catalogue

06 · Key features

What it does

Sinhala first, four languages

Detects Sinhala, Tamil, English and Singlish per message and replies in kind. A greeting or one-word message is never mistaken for English.

Voice notes and photos

Transcribes voice notes with provider-specific fallbacks and matches customer photos to catalogue products with a vision model.

Grounded answers only

The bot may only state product facts that exist in the catalogue or FAQs. Anything else becomes an honest handoff, never an invented price.

Orders taken in chat

Name, phone and address collected once, confirmed once, and created server-side. Stock moves when the order ships.

Ad attribution

Chats opened from a Facebook or Instagram ad carry the ad headline, so the first reply is about that product and the order is credited to the ad.

Human in the loop

Staff reply from the inbox to pause the bot for that chat. The 24-hour WhatsApp window is tracked and approved templates reach customers outside it.

Multi-tenant by design

Every query is scoped by tenant in middleware. Per-tenant AI keys and WhatsApp tokens are encrypted at rest and never returned by any API.

Plans, usage and billing

Messages, AI tokens and orders are metered monthly. Plans cap products, team members and messages; suspended tenants drop to billing-only access.

Hosted storefront

Each merchant gets a branded catalogue with cart and direct checkout. Prices and availability are always re-resolved server-side.

07 · Challenges

Hard parts and how I solved them

Challenge

Language detection for short, code-switched messages. "Hi" or a single Sinhala word written in Latin letters must not flip the conversation into English.

Solution

Built deterministic routing rules that treat Sinhala as the default, classify romanised Singlish separately, and keep the customer's script style in replies. The rules are covered by dedicated language and transliteration test suites.

Challenge

Stopping the model from inventing products, prices or delivery promises, which is the fastest way to lose a merchant's trust.

Solution

The agent is restricted to tool results from the tenant's catalogue and FAQs, with a system prompt that is versioned and evaluated against deterministic cases. Knowledge gaps are recorded so merchants can fill them.

Challenge

Taking real orders safely. Customers confirm in many ways, and a model can be tricked into a "confirmation" that never happened.

Solution

Orders are drafted server-side with a fresh pending state, require one explicit customer confirmation, and are idempotent. Cancellations need their own separate confirmation. Fake confirmations are detected and blocked.

Challenge

Voice transcription across providers. Some models support Sinhala, some do not, and OpenRouter tenants cannot transcribe at all.

Solution

Transcription is configured per tenant with language hints sent only when every enabled language is supported, and a fallback chain from dedicated transcription models to native audio understanding on the chat model.

Challenge

Stock that stays correct when orders ship, cancel and return concurrently across chat and the dashboard.

Solution

Inventory moves through an append-only ledger with atomic per-product operations, plus reconciliation scripts to backfill and verify balances.

Challenge

Shipping five apps safely without leaking secrets from fork pull requests.

Solution

Vercel auto-deploys are disabled. Path-filtered GitHub Actions run CI first, deploy previews for pull requests, deploy production on merge, and skip deployment for forks.

08 · Live demo

See Sellora for yourself

A multi-tenant SaaS that gives every store its own AI sales assistant on WhatsApp. It understands Sinhala, Tamil, English and Singlish over text, voice notes and photos, finds the right product, takes the order, and hands over to a human when it should.