Dmytro Balaban
Offer Dmytro work on your next project.
Rating
Skills and abilities
Design & art
Administration
Writing
Portfolio
-
1353 USD Telegram bot for the international logistics company KTrans
Bot DevelopmentTelegram bot for a logistics company
Developed from scratch a Telegram bot for managing bookings and logistics for a large company. The bot was required to integrate with the corporate CRM, the company's website, and operate reliably 24/7 for 500+ active users (clients + team).
… Architecture and Integrations
CRM Synchronization:
Implemented a two-way connection with the CRM via REST API with 5-minute caching. This balances data relevance (cars can change status) and API load. Without this caching, the bot would make hundreds of requests a day.
Role-based access system:
Divided users into 3 levels: managers (full access), agents (application management), regular clients (catalog only). This way, everyone sees only their own data, and the team does not see others' operations.
Finite State Machine (FSM) Management:
The user goes through a scenario: city selection → district → car class → filling in contacts. The FSM tracks the steps, does not allow skipping, and calculates harmful input errors.
Logging and Monitoring
Logging System:
Records every user action (search, booking, error) in the database. This allows:
- Investigating incidents (what went wrong and when)
- Analyzing behavior (which cars are popular, where more errors occur)
- Fixing bugs with context, not in hindsight
24/7 Monitoring:
The bot runs on a server with a systemd service and a watchdog that automatically restarts the bot in case of failure. Logs are rotated daily (kept for 14 days). I receive notifications for critical errors.
Error Handling and Resilience
3 Types of Repeated Errors:
- Network issues (timeout when requesting CRM) → retry after 2 seconds
- Database issues (locked database) → wait + retry
- Telegram API issues → graceful degradation (try again later)
Without this, the bot would crash on the first error instead of attempting to recover.
Blocking and Security:
Implemented a blacklist (spam, fraud) and a user blocking mechanism with permission for managers to manage it directly from the bot.
Results and Metrics
The bot processes 50-100 applications per day without failures.
Average bot response time — 200-300ms.
Uptime > 99% over the last 3 months.
Managers saved 2-3 hours a day on manual data entry.
Technical Stack
Language: Python 3.11
Framework: aiogram 3.x (asynchronous)
Database: SQLite (simplicity, no server)
CRM: REST API with caching
Deployment: SSH to own server, systemd services, logrotate.