VFS Global is a company that manages administrative tasks related to visa applications. To apply for a visa for most European countries, applicants must book an appointment to submit their documents.
However, in many countries, the availability of appointments is a significant challenge. Slots are often distributed at a very low rate, leading to frustration among applicants. As a result, securing an appointment often requires constant monitoring of the VFS website to catch cancellations or newly released slots.
VFSBot is an open-source Python script that automates the process of checking VFS appointment availability and notifies users via Telegram when the earliest appointment becomes available. The script uses Selenium framework to interact with the VFS website and integrates with a Telegram bot for sending notifications to a configured channel.
## Motivation
When I decided to study in Belgium, securing an appointment with VFS for my student visa was one of the most stressful steps. From April to August, most time slots were consistently unavailable. The only way one could get an appointment was if someone else canceled theirs, freeing a time slot. However, this required constantly checking the website for a free slot.
As a result of this issue, a fellow student facing the same struggle with booking an appointment, created the VFSBot and made a Telegram channel so that people in urgency would be notified of appointment slots the moment they became available. Since this project had a direct and positive impact on my experience, I decided to see if I could contribute to it.
## Contribution
Upon exploring the repository on GitHub, two potentiel further improvements were listed in the TODO section of the readme:
1. Check multiple countries at the same time.
2. Feature to update the config via Telegram input.
Since I was unsure which task to prioritize, I reached out to the repository owner and asked for guidance. He suggested to first try to update the python-telegram-bot library to its latest version as the project was only compatible with an old version. Once this was resolved, I could proceed to implement the online configuration feature.
The new versions of python-telegram-bot introduced significant changes, including the replacement of callback-based asynchronous functions with coroutine-based methods. Additionally, the library now operates fully within the asyncio framework, requiring an event loop to manage all asynchronous tasks. As a result, parts of the existing code needed to be refactored to align with the library's updated design principles. It took me some time to understand the code, but the project owner was very helpful and answered all my questions. Furthermore, I referred to the official python-telegram-bot documentation to understand the updated features and their examples.
I updated the project to use the latest version of python-telegram-bot and made the following key adjustments:
- Replaced legacy handlers and polling mechanisms with the updated Application class and CommandHandler from the asyncio-compatible API.
- Modified synchronous Telegram bot calls (e.g., send_message) to their asynchronous counterparts (e.g., await bot.send_message).
- Replaced the threading method with an asyncio event loop to manage all asynchronous operations, ensuring smooth handling of notifications and interactions.
After resolving the library compatibility issue, I focused on implementing the requested configuration feature. By adding a new /settings command to the Telegram bot, users can now dynamically modify the configuration parameters at runtime. These parameters include the email, password, channel_id, admin_ids, and the interval (in seconds) of appointment checks. These changes are reflected both in memory for immediate use and persistently in the config.ini file for future sessions. To ensure security, the auth_token (used for authenticating the bot with Telegram) remains immutable via this feature.
Before this, for each change the user had to edit the config.ini file and re-run the python file again, causing inconvinence especially that the bot could be running in some external server.
## Conclusion
Even though the VFSBot is a relatively small project, I am happy that it was my first open-source project to contribute to. It helped me and numerous other students in the process of applying for a student visa, and this was a very rewarding experience for me because I know it can help others who might experience the anxiety of booking an appointment like me.