Multi-Tenant SaaSWhatsApp Cloud APIGemini AISalla Integration

Rafad AI: Conversational Commerce Platform

Sole product and engineering owner. Designed and built a multi-tenant WhatsApp commerce platform that lets merchants automate customer conversations with AI, escalate unresolved issues to their team, and keep customers updated on orders — end to end, backend only, with Figma used to guide the design.

01

Overview & Context

The Problem

Merchants selling through WhatsApp had to manually monitor and reply to every customer message. There was no way to answer common product questions automatically, track conversations across a team, or notify customers about order status — this didn't scale as their customer base grew.

The Goal

Let a merchant connect their WhatsApp number, configure an AI to answer customer questions using their own product catalog, hand off to a human when needed, and keep customers informed automatically as their order moves through fulfillment.

02

Product Requirements

Users

Merchant — configures channel & AICustomer — messages on WhatsAppSupport Employee — handles escalations

Core Features

  • • WhatsApp channel integration via Meta Cloud API — merchants manage all customer messages from the app, without opening WhatsApp directly
  • • Configurable AI auto-reply powered by Gemini, using merchant-defined instructions for tone and behavior
  • • Automatic escalation to a human employee when the AI cannot answer a customer
  • • A support ticketing system with priority levels for escalated conversations
  • • Salla store integration — real-time product search so the AI can answer catalog questions and share purchase links
  • • Automated order-status notifications via WhatsApp message templates, processed through a background job queue

Out of Scope

Payment processing (handled by Salla) and channels beyond WhatsApp. An analytics dashboard was designed in Figma but not built as part of the backend work — see the design reference below.

03

System Architecture & Data Flow

A customer message on WhatsApp triggers a webhook that checks tenant isolation and AI settings, searches the merchant's Salla catalog if relevant, and generates a response through Gemini — all in real time:

Rafad AI Sequence Diagram
Click to expand

Figure 3.1: Customer message → webhook → tenant check → Salla product search → Gemini response → WhatsApp reply → order status notification.

Escalation & Support Ticket Flow

When the AI can't resolve a customer's question, the conversation is reassigned to a support employee and a ticket is created with a priority level, so the merchant's team can track and resolve outstanding issues instead of losing them in the chat history.

04

Database Schema & Relational Design

A multi-tenant schema isolating each merchant's channel settings, conversations, and support tickets, while linking messages to their originating customer and order.

Rafad AI Database Schema
Click to expand

Figure 4.1: Schema coupling channels, conversations, messages, ai_settings, tickets, and orders.

05

API Endpoints & Integration Sample

POST   /webhooks/whatsapp              → receives incoming customer messages
POST   /webhooks/salla/order-created   → receives order status updates
POST   /channels/{id}/ai-settings      → merchant sets AI instructions & enable/disable
GET    /conversations/{id}             → fetch conversation + message history
POST   /conversations/{id}/assign      → escalate conversation to an employee
POST   /tickets                        → create support ticket with priority
06

Design Reference (Figma)

This project was backend-only — the screen below is a Figma mockup used to define what success would look like, not a built or shipped product screen.

Rafad AI Analytics Dashboard MockupFigma mockup — illustrative data
Click to expand

Analytics Dashboard Concept

Design reference for tracking conversation volume, AI vs. human resolution rate, and response times — the metrics I planned to use to measure whether the AI was actually resolving customer questions.

Let's build your next system →