Vaccine Bots By Independent Programmers During The COVID-19 Pandemic

2 min read

In this technology-driven world, almost everything is automated now. The robots and bots that we built have outsmarted us, humans, in nearly everything. The main advantage of using these bots is the amount of time and manpower we can save. And as these bots don’t get tired, they can provide us service round the clock. During this pandemic, where people are waiting to be vaccinated, this bot has become a huge relief for many. Millions of people are now waiting for the vaccine, but the problem is that we don’t have that many slots open in the Co-Win or Arogya Setu App. It is like finding a needle in the haystack. However, necessity is the mother of invention, and when frustrated by the inability to book a slot, many programmers across the country started making “vaccine-booking” bots themselves. Some of us probably must have used it as well. So let’s dig a bit deeper and figure out how this works. 

How does this bot help you? 

It is nearly impossible to be on alert 24*7 waiting for the slots to open in Co-Win or Arogya Setu, and hence, the need for bots arises. Can you stay up all night? Do you have any credible information as to when the slot will open tomorrow? Well, most of us do not. 

Now, imagine a day when you get an alert on your device as soon as the slots open. Do you know that many among us booked their vaccination slot using these bots? It is no doubt that using these Vaccine Bots give you an edge over the millions of people who aren’t making use of these bots. The Telegram bots instantly notify the user whenever a slot or multiple slots are opened. Thus, the vaccination centre, the pin code, the vaccine name, and the number of doses available are shown to the users immediately. 

How does the Bot work?

Before we get into the technical side of the bot, let me explain the term API. API or Application Program Interface is the intermediary that allows two applications to communicate. APIs are the essential backbone of all the digital and web services that we use daily. The same applies to the Co-WIN website and Setu app as well. 

How do we make use of API?

Python is the preferred language to create a bot due to its simplicity and a wide range of in-built libraries. The user is asked to input the Pincode of the preferred location. After the bot is up and running, the API call is made to the Co-WIN or Setu app in a fixed time interval. The bot automatically sends a request to the API. The “get request” returns the data in the JSON format, and the bot filters out only the necessary keywords. Using a scheduler module, the alerts are sent to the users. The bot automatically sends a request to the API. Whenever the required results are obtained, it notifies you the same via a notification. Ping! Voila, you have the details of the slots instantly

The slot is known, now what? | Automatic Booking

Now that you have read about how the notification process works, you might be thinking, why not automate the whole process of booking as well? Again, the techies have got you covered there as well. The mobile number and Pincode of the location are stored as variables in the script. The script monitors the slots in the district approximately every 15 seconds( we can choose this interval). After fetching the slot details mentioned above, the text message containing the OTP is accessed using the IFTTT service. If “This Then That” or IFTTT is a service that enables various apps to work together to do specific things. In this case, it is used to identify the OTP message and send that over to the server. The retrieved OTP, a key-value, is stored in the KVDB bucket. Now another question that arises in our minds would be, ‘ But, how does the script enter the OTP, select the slot, and do everything?!’ That’s where Web scraping comes to use. This method is the process used by the bots to extract data from the website. Selenium WebDriver, an open-source library, helps in web scraping and performing the desired actions. When a centre with more than the preferred minimum number of slots opens up, the bot books the slot for you using this Web scraping method. So, now you don’t have to go through all the trouble of refreshing the site every 10 minutes. The bot is going to do that immediately for you. 

Whew, that sure was lots of information to process. But totally worth it, right? Now that you know how to make a bot, go ahead and make one of your own and see how it works.

Requesting Ideas for CodeChef Open Source Project

Carrot Cakes, Our primary goal at CodeChef has always been to help students and professionals become better programmers.  While algorithmic problem solving certainly helps,...
1 min read

Leave a Reply