Project
AgendaBot Pro
Multi-tenant SaaS that lets patients book, reschedule, and cancel appointments entirely from WhatsApp — no extra app — for the Mexican/LATAM market. Powered by an AI agent (GPT function calling) with deterministic guardrails, WhatsApp Cloud API, Stripe billing, and Mexican e-invoicing (CFDI).
Founder & Engineer (Full Stack — Product, AI, Backend, Infrastructure) Personal project Public summary
Personal product, live in production and operated solo. Multi-tenant SaaS handling client and patient data; implementation details are summarized at a high level.
Stack
Angular 17TypeScriptTailwind CSSNode.jsExpressFirebase HostingFirestoreFirebase AuthCloud FunctionsGPT (function calling)WhatsApp Cloud APIStripeFacturapi (CFDI)ResendGCPGitHub Actions
Impact
- Patients book, reschedule, and cancel 24/7 entirely inside WhatsApp — no app install — cutting the reception/phone load for clinics and independent professionals.
- AI agent built on GPT function calling where the model NEVER writes to the database: it only invokes server-defined tools, keeping every booking correct, auditable, and safe.
- Deterministic confirmation layer outside the LLM: 1-hour reminders bind appointment IDs so a reply or button tap confirms the exact appointment — eliminating false 'confirmed' states.
- Usage-based monetization with Stripe metered billing, charging only for completed appointments per subscription cycle.
- Native Mexican e-invoicing (CFDI): patients self-invoice from WhatsApp or a public portal, with per-organization encrypted credentials.
- Multi-tenant from day one — a single data model serves solo professionals and multi-doctor clinics, with tenant isolation enforced server-side.
What I did
- Designed an AI agent on GPT function calling: the model only calls typed tools, executed server-side against Firestore — the LLM never touches the database.
- Built WhatsApp interactive flows — service/professional/date/time pickers and quick-reply template buttons with dynamic per-message payloads.
- Implemented a truncation-proof slot-filling state and bounded conversation history so the bot stops re-asking and survives long chats.
- Hardened webhooks: Meta and Stripe signature verification on the raw body, plus messageId deduplication via atomic Firestore writes.
- Automated WhatsApp template sync to Meta via the Graph API with non-destructive edits (avoiding Meta's name-deletion cooldown).
- Multi-tenant auth via Firebase custom claims + tenant middleware scoping every query; feature flags updated only from Stripe webhooks.
- Scheduled jobs for reminders inside Meta's free 24h window, no-show detection, and daily reports.
- Super-admin panel with per-organization cost/margin analytics and live conversation monitoring; CI/CD via GitHub Actions with a test gate that blocks deploys.
Architecture
- Two-tier monorepo: Angular 17 SPA (Firebase Hosting) + Node/Express on Cloud Functions v2; the frontend neveraccesses Firestore directly — all traffic goes through the backend.
- WhatsApp Cloud API webhook → auth + tenant middleware → AI agent (GPT function calling), or a hardcoded Flow Engine when AI is disabled.
- GPT calls typed tools; the backend executes them against Firestore and returns the result — the model never writes.
- Stripe webhooks drive plan and feature flags; metered billing on completed appointments per subscription cycle.
- Facturapi for CFDI issuance with per-organization encrypted keys; public invoice portal + in-WhatsApp flow.
- Scheduled jobs (Cloud Scheduler / onSchedule): reminders, no-show detection, reports, and data compression.
Tags
SaaSWhatsAppAI AgentsLLMsMulti-tenantStripeFirebaseLATAMFull Stack
