WhatsApp Account Manager for ElectroSun (Nigeria solar supplier). Node.js + Express + SQLite + Claude API + Meta WhatsApp Cloud API.
# Sunny, WhatsApp Account Manager for ElectroSun
Sunny is an AI-powered WhatsApp Account Manager for **ElectroSun**, a solar energy supply agency in Nigeria. It answers every inbound WhatsApp message in the customer's own language, explains ElectroSun's products and services, qualifies and categorizes leads, escalates the ones that matter to the right sales desk, and stores everything behind a clean REST API and an admin web UI.
> This is a private operational repository. The authoritative, always-current reference is `CLAUDE.md`; the chronological changelog is `docs/session-history.md`. Read those before changing anything.
## What it does
- Replies to WhatsApp text, image (vision), and voice notes (transcribed), plus debounced message bursts.
- Classifies each contact (HOT / SERIOUS / COLD / DISQUALIFIED / REPEAT_CLIENT) and captures lead data.
- Routes escalations by region and deal size: big projects to the owners, everything else to the Abuja or Lagos sales desk.
- Quotes prices only when explicitly asked, only from the live Warehouse Stock table, with a stack of code-level reply guards.
- Sends per-item datasheets and product photos on request.
- Owner Q&A over WhatsApp, owner escalation alerts, and a self-improvement nightly audit.
## Tech stack
- **Runtime:** Node.js 20+ (Railway Linux container in production, macOS for local dev)
- **Framework:** Express.js
- **Database:** SQLite via `better-sqlite3` (single file)
- **WhatsApp:** Meta WhatsApp Cloud API (Graph API v21.0)
- **LLM:** Anthropic Claude API (classifier on Haiku 4.5; replies, owner Q&A, teacher, audit, and image descriptions on Sonnet 4.6)
- **Voice transcription:** OpenAI Whisper
- **Scheduler:** `node-cron`
The tech stack is locked. Do not add a dependency outside this list without approval (see `CLAUDE.md`).
## Repository layout
```
server.js Express app, cron registration, startup checks
db/ schema.sql, idempotent init/migrations, SQLite file (gitignored)
src/ …