BizBot SA — WhatsApp Business OS for South African micro-businesses
# BizBot SA — Backend (Week 1 scaffold)
WhatsApp Business Operating System for South African micro-businesses.
This is the Week 1 slice of the 30-day MVP plan: **infrastructure +
onboarding** — a working Express/TypeScript backend, the full Supabase
schema, a WhatsApp Cloud API webhook handler, signature verification, an
AI intent classifier, and a guided WhatsApp onboarding flow for new
businesses.
## What's implemented
- **Database** — `supabase/migrations/0001_init.sql`: `businesses`,
`services`, `customers`, `bookings`, `invoices`, `conversation_state`,
`messages_log`. Enums, indexes (incl. partial indexes for the reminder
and overdue-invoice crons), `updated_at` triggers, and tenant-isolation
RLS policies for future dashboard/customer-facing access.
- **WhatsApp webhook** — `GET /webhooks/whatsapp` (Meta verification
challenge) and `POST /webhooks/whatsapp` (inbound messages), with
`X-Hub-Signature-256` verification.
- **Onboarding flow** — a brand-new WhatsApp number messaging the bot
triggers a guided setup: business name → business type → first service
(name, price, duration) → done. Creates the `businesses` row and seeds
`services`.
- **Message router** — every message from an onboarded business owner is
logged and classified by Claude Haiku into one of the 8 product intents
(`booking_request`, `quote_command`, `invoice_command`, `payment_record`,
`expense_log`, `marketing_request`, `report_request`, `general_query`).
The owner gets an immediate acknowledgement.
- **Message logging** — every inbound/outbound message is written to
`messages_log` for debugging and future AI context.
## What's intentionally stubbed (Weeks 2-4)
The intent classifier routes correctly, but the actual feature handlers —
booking engine + reminders, quote/invoice PDF generation + Yoco payment
links, automated payment follow-up, marketing writer, weekly business
report — aren't built yet. `handleOwnerMessage` in
`src/flows/router.ts` is the plug-in point for each of those, keyed …