These days getting a vaccination slot is such a pain. every time we see slots not available. In this blog, I will help you to solve this problem using Azure Logic Apps. The logic app sends me an email every time a slot is available in my area, all I have to do is log in to cowin portal and book my slot as fast as possible. Also, even if you are not able to book the slot on the same day, you still have the timings now when the slots are open and you can prepare yourself for the next day.
Now let us see how logic apps can be used for this. Also, the logic app isn’t the only solution for this as there are many other ways as well. But for the scope of this blog, we will only see the implementation with logic apps.
Go to https://portal.azure.com/ and search for logic apps in resources.
Create a logic app with a consumption plan and fill in the required information of region and subscription. Give appropriate tags while creating a resource as this helps other people in the organization to get information about these resources.
Select recurrence as a trigger for the logic app and set the recurrence time for every 10 seconds.
Now select HTTP block and set method to post. Now the URL for this block you will find in API Setu. We need the get API of appointment availability. This request URL has two parameters first is pin code and the second is a date.
Now we will hardcode the Pin code of the area from where we want the alerts and for the date parameter will set a formula of today’s date that will automatically change every day.
Next, you will have to add a parse JSON block. The content of this block will have the body of the HTTP block and Schema can be taken from the body of the HTTP block when you run it once. Once you copy the schema again come to this block and click on use sample payload to generate schema and paste your content. You can remove the required fields array but make sure you don’t miss any coma or brackets.
The next block is For each. The API output is such that it gives one object array element for every center also the center array remains empty if no slots available in any center. That means we will get only those centers whose slots are available.
Now inside For each, I have added sessions array which has all available centers information and condition of min age of 18 and availability of dose 1 greater than 0 as I am aiming for the first dose only.
Now when both my conditions are true I want an email to be sent to me so that I get notified. For this, we will add an outlook connector for and add all necessary fields from our API body that we parsed in the parse JSON block.
The email looks like this:
In this way, you can get vaccination slot alerts which might help you to get vaccinated using azure logic apps.