Challenge
An Estonian hospitality group’s maintenance team coordinated repair requests through informal messaging and verbal handoffs — with no traceability, no SLA enforcement, and no KPI visibility for management. Department heads (housekeeping, reception, café, pool) had no reliable way to tell whether a submitted issue had been seen, accepted, or resolved. The team needed structure across the whole job lifecycle, without leaving the tool they already used every day — Telegram.
Solution
- Built a fully async Python Telegram bot (python-telegram-bot) as the single interface for every role: requesters, technicians, and managers.
- Integrated Claude (Anthropic) as an AI triage agent — it validates request completeness through a short clarifying dialogue, then classifies urgency on a three-level scale (critical / same-day / planned) with structured output.
- Designed a 9-state ticket lifecycle (new → accepted → in progress → done → closed, plus attention / needs-purchase / needs-contractor / waiting branches), with mandatory technician comments and photo confirmation for critical tickets.
- Implemented role-based notification routing so each actor sees only relevant events; critical tickets escalate to the manager if unacknowledged within 15 minutes (APScheduler SLA watchdog).
- Delivered daily / weekly / monthly KPI reports on demand — creation rate, closure rate, average response time, and average resolution time — plus per-technician monthly reports and a shift dashboard for managers that separates today’s work from items left over from earlier shifts.
- Vehicle mileage log: technicians record odometer readings with a photo, with a guard against readings lower than the last one, a daily reminder and CSV reports.
- Food-delivery integration. Added an HTTP API (FastAPI) through which the
venue’s online ordering platform hands paid orders — to an address in town or
to a hotel room — to technicians acting as couriers:
- the contract is published as an OpenAPI schema, with tests that keep code and documentation from drifting apart;
- idempotent order creation, and every status change is a conditional write on status and revision number, so simultaneous button taps produce exactly one transition and one event;
- status events go back to the ordering platform as signed webhooks with a persistent queue, retries and deduplication;
- an order nobody accepts within 3 minutes escalates to a backup courier, and pickup is possible only once the kitchen has marked the food ready;
- customer contact details are shown only to the assigned courier and the manager, and are collapsed once the order is complete;
- a separate sandbox with its own key (production keys are rejected there) and drill orders that never disturb live work.
- Runs as a systemd service on a VPS under an unprivileged service account; production and sandbox are separated by host name behind nginx with TLS, and the database is copied nightly with 30 days of history.
- Data layer built on async SQLAlchemy over SQLite (WAL), with the PostgreSQL driver and Alembic migrations prepared for the move; 740+ automated tests cover every module, including race conditions and the API contract.
Result
The MVP was delivered and running in production within 48 hours of starting development. Every maintenance request is now logged, assigned, tracked, and closed with a full audit trail, and KPI, per-technician and mileage reports are available to management on demand. The AI triage layer reduces dispatcher load and catches under-specified requests before they reach technicians. The delivery integration has passed a joint sandbox run and drills with the ordering side and goes live once their receiver is switched on; a web wall board and the PostgreSQL migration are next.