You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WhatsApp/Telegram order intake for a hardware store, owner-first: the OWNER is
the only chat actor. The owner texts or sends voice notes naming the customer,
agents turn them into quotes, the owner confirms in chat, and confirmed orders
register to Google Sheets while stock deducts. Every inbound message is gated
against the owner sender allowlist before routing; non-owner senders get a
polite rejection. A Gradio backoffice handles catalog, clients, live orders and
supplier-document ingestion. Python 3.12+ · FastAPI · Postgres 16 + pgvector ·
OpenAI · Google Sheets · Gradio.
Quick path
make install — creates .venv and installs the project (editable + dev deps).
make db-up — starts Postgres+pgvector in Docker.
Copy .env.example to .env, set at least POSTGRES_PASSWORD and the owner
sender keys (OWNER_TELEGRAM_CHAT_ID and/or OWNER_WHATSAPP_PHONE).
make migrate — applies the Alembic migration.
make test — runs the suite (unit, integration, E2E) against a disposable
ferreteria_test database rebuilt from the Alembic migrations on every run;
the dev database is never touched by the suite.
make run — boots the intake API; make backoffice — boots the Gradio UI.
Environment setup
Variable
Purpose
Default
POSTGRES_USER/PASSWORD/DB/HOST/PORT
Local database (tests derive a _test database from this URL)
External services (OpenAI, Google Sheets, WhatsApp) are mocked in tests —
no credentials or network needed. In dev, unset tokens make the adapters
no-ops (Telegram/WhatsApp); a missing Sheets configuration makes the approval
flow roll the order back (it stays pending) instead of half-registering it.
Commands
Command
What it does
make install
Create venv + editable install
make db-up / db-down / db-logs
Docker Postgres+pgvector lifecycle
make migrate / migrate-new m=...
Alembic up / new revision
make test
Full pytest suite on a disposable ferreteria_test database rebuilt from the Alembic migrations (the dev database is never touched)