This Python script(vfs-appointment-bot) automates checking for appointments at VFS Global portal in a specified country.
The vfs-appointment-bot
script can be installed using two methods:
It is the preferred method for installing vfs-appointment-bot
. Here's how to do it:
-
Create a virtual environment (Recommended):
python3 -m venv venv
This creates a virtual environment named
venv
to isolate project dependencies from your system-wide Python installation (recommended). -
Activate the virtual environment:
Linux/macOS:
source venv/bin/activate
Windows:
venv\Scripts\activate
-
Install using pip:
pip install vfs-appointment-bot
This will download and install the
vfs-appointment-bot
package and its dependencies into your Python environment.
For an alternative installation method, clone the source code from the project repository and install it manually.
-
Clone the repository:
git clone https://github.com/ranjan-mohanty/vfs-appointment-bot
-
Navigate to the project directory:
cd vfs-appointment-bot
-
Create a virtual environment (Recommended):
python3 -m venv venv
This creates a virtual environment named
venv
to isolate project dependencies from your system-wide Python installation (recommended). -
Activate the virtual environment:
Linux/macOS:
source venv/bin/activate
Windows:
venv\Scripts\activate
-
Install dependencies:
pip install poetry poetry install
-
Install playwright dependencies:
playwright install
-
Download the
config/config.ini
template.curl -L https://raw.githubusercontent.com/ranjan-mohanty/vfs-appointment-bot/main/config/config.ini -o config.ini
-
Update the vfs credentials and notification channel preferences. See the Notification Channels section for details on configuring email, Twilio, and Telegram notifications.
-
Export the path of the config file to the environment variable
VFS_BOT_CONFIG_PATH
export VFS_BOT_CONFIG_PATH=<your-config-path>/config.ini
If you installed the script by cloning the repository (manual installation), you can directly edit the values in config/config.ini
.
-
Command-Line Argument:
The script requires the source and destination country code (as per ISO 3166-1 alpha-2) to be provided as a command-line argument using the
-sc
or--source-country-code
and-dc
or--destination-country-code
option. -
Running the Script:
There are two ways to provide required appointment details:
-
Responding to User Prompts (recommended):
vfs-appointment-bot -sc IN -dc DE
The script will prompt you to enter the required apponitment parameters for the specified country.
-
Using
-ap
or--appointment-params
:Specify appointment details in a comma-separated (not space-separated) key-value format:
vfs-appointment-bot -sc IN -dc DE -ap visa_center=X,visa_category=Y,visa_sub_category=Z
The script will then connect to the VFS Global website for the specified country, search for available appointments using the provided or entered parameters, and potentially send notifications (depending on your configuration).
-
It currently supports three notification channels to keep you informed about appointment availability:
- Email: Sends notifications via a Gmail account.
- Twilio (SMS & Voice Call): Enables alerts through text messages and phone calls using Twilio's services.
- Telegram: Sends notifications directly to your Telegram account through a bot.
Configuring Notifications:
Email:
-
Email Account: You'll need a Gmail account for sending notifications.
-
App Password: Generate an app password for your Gmail account instead of your regular password. Refer to Google's guide for generating app passwords: https://support.google.com/accounts/answer/185833?hl=en.
-
Configuration File: Update your application's configuration file (
config.ini
) with the following details:email
(Required): Your Gmail address.password
(Required): Your generated Gmail app password.
Twilio:
-
Create a Twilio Account (if needed): Sign up for a free Twilio account at https://www.twilio.com/en-us to obtain account credentials and phone numbers.
-
Retrieve Credentials: Locate your account SID, auth token, and phone numbers within your Twilio account dashboard.
-
Configuration File: Update your application's configuration file (
config.ini
) with:auth_token
(Required): Your Twilio auth tokenaccount_sid
(Required): Your Twilio account SIDsms_enabled
(Optional): Enables SMS notifications (default: True)call_enabled
(Optional): Enables voice call notifications (default: False)url
(Optional): Twilio API URL (Only needed if call is enabled)to_num
(Required): Recipient phone number for notificationsfrom_num
(Required): Twilio phone number you'll use for sending messages
Telegram:
-
Create a Telegram Bot: Visit https://telegram.me/BotFather to create a Telegram bot. Follow the on-screen instructions to obtain your bot's token.
-
Configuration File: Update your application's configuration file (
config.ini
) with:bot_token
(Required): Your Telegram bot token obtained from BotFather.chat_id
(Optional): The specific Telegram chat ID where you want to receive notifications. If omitted, the bot will send notifications to the chat where it was messaged from. To find your chat ID, you can create a group chat with just yourself and then use the/my_id
command within the bot.
The following table lists currently supported countries and their corresponding appointment parameters:
Country | Appointment Parameters |
---|---|
India(IN) - Germany(DE) | visa_category, visa_sub_category, visa_center |
Iraq(IQ) - Germany(DE) | visa_category, visa_sub_category, visa_center |
Morocco(MA) - Italy(IT) | visa_category, visa_sub_category, visa_center, payment_mode |
Azerbaijan(AZ) - Italy(IT) | visa_category, visa_sub_category, visa_center |
Notes:
- Appointment parameters might vary depending on the specific country and visa type. Always consult VFS Global's website for the latest information.
1. Login Failures After Frequent Requests:
If the bot makes login requests to the VFS website too frequently, the VFS system might temporarily block your access due to suspected automation. This can lead to login failures.
- Workaround:
- Reduce request frequency: Consider increasing the delay between bot runs to avoid triggering VFS's blocking mechanisms. You can adjust the interval in the configuration or code.
- Retry after 2 hours: If you encounter a login failure, wait for at least 2 hours before retrying. The VFS block should expire within this timeframe.
2. Occasional Captcha Verification:
The VFS website requires a CAPTCHA verification step during login. Currently, the bot does not have a built-in CAPTCHA solver.
- Workaround:
- Wait and Retry: Sometimes, CAPTCHAs appear due to temporary website issues. Wait for a while and try again later.
- Retry in another browser: CAPTCHAs are often solved automatically in the Firefox browser. If it still fails, retry the login process in another browser by setting
browser_type
to"chromium" or "webkit"
in yourconfig.ini
file.
Note: We are constantly working to improve the bot's functionality. Future updates might include integrated CAPTCHA solving capabilities.
This script is currently designed to work with the VFS Global website for Germany. It might be possible to extend support for other countries by modifying the script to handle potential variations in website structure and parameter requirements across different VFS Global country pages.
We welcome contributions from the community to improve this project! Here's how you can get involved:
- Report issues: If you encounter any bugs or problems with the script, please create an issue on the project's repository.
- Suggest improvements: Do you have ideas for making the script more user-friendly or feature-rich? Feel free to create an issue or pull request on the repository.
- Submit pull requests: If you've made code changes that you think would benefit the project, create a pull request on the repository. Please follow any contribution guidelines outlined in a CONTRIBUTING.md file.
This script is provided as-is and is not affiliated with VFS Global. It's your responsibility to ensure you're complying with VFS Global's terms and conditions when using this script. Be aware that website structures and appointment availability mechanisms might change over time.