Saturday, August 22, 2026

Clinic-AI Receptionist (Part 2): Upgrading to Multi-Lingual (English & Hindi) and Multi-Tenant SaaS


In Part 1 of this series, we built a basic proof-of-concept for the Clinic-AI Receptionist. It demonstrated how to capture patient WhatsApp messages in Hindi and process them into Google Calendar bookings using Google Cloud Run, Gemini, and Firestore.

Since publishing that post, the platform has undergone a major engineering upgrade. What started as a single-clinic proof-of-concept has now evolved into a production-ready, multi-tenant SaaS platform featuring a Next.js 15 Admin Dashboard and dynamic multi-lingual support (English, Hindi, and Hinglish).

Here is a breakdown of how the architecture evolved to support dynamic multi-tenancy alongside secure, scalable clinic management.

What’s New in Part 2?

Here is how the platform evolved from a single-use concept into a production SaaS product:

FeaturePart 1 (Proof-of-Concept)Part 2 (Production SaaS)
Language SupportHindi OnlyDynamic Multi-Lingual (English, Hindi & Hinglish)
Tenant ModelSingle Hardcoded ClinicMulti-Tenant (Dynamic Tenant Resolution via Firestore)
Management PortalCLI / Database LogsNext.js 15 Web Dashboard + Google OAuth (NextAuth)
SecurityLocal .env VariablesGoogle Cloud Secret Manager (Zero-Trust Security)
ArchitectureWebhook MicroserviceUnified Express + Next.js Server on Cloud Run

System Architecture Evolution

To support dynamic multi-tenancy alongside a modern web management experience, the underlying container architecture was unified:



A single Express server (server.ts) handles incoming webhooks from Twilio while delegating administrative UI routes to Next.js 15 inside the same Cloud Run instance. This approach reduces cold-start latency and simplifies platform operations while directly interacting with Firestore for multi-tenant data and Google Calendar for bookings.

Solving the Multi-Lingual Challenge (English, Hindi & Hinglish)

In real-world healthcare settings, patients rarely stick to formal, single-language speech. They message in English, Hindi, or code-switch between both (Hinglish, e.g., "Doctor Deepak ke saath kal 11 am appointment book kar do").

Instead of building complex translation pipelines or routing logic, the platform leverages Google Gemini’s native NLU capabilities:

  • Automatic Language Detection: Gemini detects the patient’s primary language per message and responds in the same language naturally.

  • Context Preservation Across Language Switch: If a user starts in English ("I want an appointment") and switches to Hindi ("कल सुबह 11 बजे"), Gemini maintains session context stored in Firestore without losing key booking entities.

  • Standardized JSON Schema Output: Regardless of whether the user speaks English, Hindi (Devanagari script), or Hinglish (Roman script), Gemini strictly outputs a standardized JSON payload (name, date, time, doctor) for calendar verification.

Multi-Turn Conversation Example

Here is a look at how the bot processes a real-world multi-lingual conversation:

  • Patient (English): Hi, I'd like to book an appointment with Dr. Deepak.

  • Bot (English): Hello! I can help you with that. Could you please share your name and preferred date/time?

  • Patient (Hinglish): Mera naam Deepak hai, kal morning 11 baje ka slot khali hai kya?

  • Bot (Hindi): जी दीपक जी! कल सुबह 11:00 बजे का स्लॉट उपलब्ध है। क्या मैं इसे कन्फर्म कर दूं?

  • Patient (English): Yes, please confirm.

  • Bot (English): Great news! Your appointment with Dr. Deepak is confirmed for tomorrow at 11:00 AM.


Multi-Tenancy & Secure Admin Dashboard

Beyond WhatsApp, clinic administrators and front-desk staff require a secure portal to manage bookings, track bot status, and onboard new clinics.

1. Secure Authentication Gateway

Staff authenticate via Google OAuth (NextAuth) through the gateway portal.




2. Super Admin Dashboard & Multi-Tenancy Management

Super admins can view all active clinics, monitor bot statuses, and inspect Google Calendar permissions directly from the central dashboard.



  • Role-Based Access Control (RBAC): User roles (SUPER_ADMIN vs. CLINIC_USER) enforce strict data isolation so staff only see bookings for their specific clinicId.

  • Zero-Trust Secret Handling: Production secrets—including TWILIO_AUTH_TOKEN, GEMINI_API_KEY, and Service Account keys—are dynamically mounted at runtime via Google Cloud Secret Manager.

3. Seamless Clinic Onboarding

Onboarding a new clinic takes seconds through the dedicated onboarding view:




Simply enter a unique Clinic ID (slug), target WhatsApp receiver number, and Google Calendar ID to instantly deploy an AI receptionist for that clinic.

Live Demo & Links


  • Interactive WhatsApp Bot: Send a WhatsApp message to +1 415 523 8886 to test the assistant in English, Hindi, or Hinglish!

Key Takeaway

Upgrading from a single-purpose script to a serverless, multi-tenant SaaS architecture demonstrates how modern tools like Google Cloud Run, Firestore, Gemini, and Next.js 15 enable engineers to launch scalable, multi-lingual AI applications with low operational overhead.