Venezuela Tasas Bot
Overview
An automated Telegram bot that provides real-time and scheduled Central Bank of Venezuela (BCV) exchange rates (USD, EUR, TRY, RUB). Features daily push notifications at 8:00 AM, on-demand interactive currency menus, and async PostgreSQL subscriber persistence.
An automated, asynchronous Telegram bot designed to keep individuals, merchants, and finance teams instantly informed with verified Central Bank of Venezuela (BCV) exchange rates. By consuming the public Venezuela Tasas API, the bot provides instant currency conversions and reliable daily push notifications.
THE PROBLEM
In Venezuela’s fast-moving economic landscape, official foreign exchange rates published by the Banco Central de Venezuela (BCV) dictate commercial pricing, payroll conversions, and invoicing across both private and corporate sectors.
However, consumers and merchants face persistent friction:
- Manual Portal Lookups: The official central bank portal can experience slow loading times or outages during peak traffic hours when new rates are announced.
- Notification Gaps: Small business owners, accountants, and freelancers must remember to manually check daily rate updates before issuing morning invoices or processing point-of-sale transactions.
- Workflow Friction: Switching between messaging apps and web browsers creates unnecessary overhead during rapid trade operations.
THE SOLUTION
I engineered Venezuela Tasas Bot, a lightweight yet resilient Telegram bot that acts as an automated financial assistant directly within the chat app:
- On-Demand Exchange Rates: Users can trigger
/ratesor/startto immediately retrieve live official values for US Dollars (USD), Euros (EUR), Russian Rubles (RUB), and Turkish Liras (TRY). - Scheduled Daily Subscriptions: A background job queue automatically broadcasts fresh rate updates to all subscribed channels and users every morning at 8:00 AM (Venezuela Time).
- Persistent Subscriber Registry: Subscriptions and user preferences are persisted in a relational database so scheduled jobs and user notification queues survive server restarts without interruption.
- Resilient Error Recovery: Asynchronous polling with exponential backoff ensures that temporary network glitches or upstream API slowdowns do not drop pending messages.
TECHNICAL CHALLENGES
- Asynchronous Concurrency & Job Queues: Built on
python-telegram-botwithasyncio, ensuring non-blocking execution when concurrently broadcasting rate updates to thousands of registered chat IDs simultaneously without hitting Telegram API rate limits. - Async Database Persistence: Implemented an async database layer using
SQLAlchemy 2.0andasyncpgconnected to PostgreSQL, managed withAlembicmigrations for zero-downtime schema evolution. - Type-Safe Data Modeling: Leveraged
Pydanticandhttpxto strictly validate API payloads received from upstream endpoints before delivering formatted markdown cards to end-users. - Production Containerization: Multi-stage
Dockerconfiguration for consistent local development, staging tests, and production deployment with minimal memory footprint.