Context
The business needed a low-friction referral program: ambassadors sign up in Telegram, receive a unique code and link, while the sales team sees the number of purchases per code in a familiar Google Sheet.
Solution
/start creates an ambassador, generates a unique promo code and referral link, and appends a record to the first Google Sheet (append-only). A daily cron pulls the number of sales from the second sheet (where managers keep their records) and updates ambassador statistics in MongoDB. The bot returns an ambassador's current sales count on request.
Stack and architecture
- Runtime: Java 17, Spring Boot 3.4.2.
- Storage: MongoDB 7 (persistent ambassador state).
- Integrations: Google Sheets API (one service account, two sheets), pengrad Telegram Bot API 8.3.0.
- Deployment: Docker + docker-compose.
Role and outcome
A fully standalone backend project that we delivered turnkey: the domain model, bot logic, two independent Google Sheets integrations, and the cron import. Marketing got a turnkey program with no separate admin UI — everything is managed through the spreadsheets.