# 🇰🇪 BizBot Kenya — WhatsApp Commerce Platform
> AI-powered WhatsApp bot for Kenyan small businesses. Customers chat → AI replies → Orders booked → M-Pesa confirmed → Dashboard updated.
---
## 🏗️ Architecture
```
Customer (WhatsApp)
│ text message
▼
Meta Cloud API ──► Railway (Express) ──► OpenAI GPT-4o-mini
│ │ AI reply
│◄─────────────────────┘
│
Supabase DB
(Postgres + Realtime)
│
Vercel (React)
(Live Dashboard)
│
M-Pesa STK Push (Daraja)
```
---
## 🚀 Setup Guide
### Prerequisites
- Node.js 18+
- Supabase project (already created ✅)
- OpenAI API key (already have ✅)
- Railway account (already have ✅)
- Vercel account (already have ✅)
- Meta Developer account + WhatsApp Business app
---
### Step 1 — Clone & Install
```bash
git clone
github.com
cd bizbot-kenya
cp .env.example backend/.env
cp .env.example frontend/.env.local # rename VITE_ vars
npm run install:all
```
---
### Step 2 — Supabase Setup
1. Go to your Supabase Dashboard
2. Open **SQL Editor**
3. Run migrations **in order**:
```sql
-- Paste and run each file:
supabase/migrations/001_schema.sql
supabase/migrations/002_rls.sql
supabase/migrations/003_functions.sql
```
4. Run seed data (optional demo data):
```sql
supabase/seed.sql
```
5. Enable **Realtime** for the `bizbot_realtime` publication:
- Go to Database → Replication → enable `bizbot_realtime`
6. Copy your credentials from Project Settings → API:
```
SUPABASE_URL=
xxx.supabase.co
SUPABASE_SERVICE_KEY=eyJ... (service_role key)
VITE_SUPABASE_ANON_KEY=eyJ... (anon/public key)
```
---
### Step 3 — Meta WhatsApp Cloud API Setup
1. Go to developers.facebook.com
2. Create a new App → Business → Add WhatsApp product
3. From **WhatsApp → API Setup**:
- Copy **Phone Number ID** → `WHATSAPP_PHONE_NUMBER_ID`
- Copy **WhatsApp Business Account ID** → `WHATSAPP_BUSINESS_ACCOUNT_ID`
- Generate a **Temporary/Permanent Token** → `WHATSAPP_TOKEN`
4. From **App Settings → Basic**:
- …