It was quite frustrating to check the Embassy website every Tuesday and Friday for my VISA result. Here I would like to share how I developed a tool to obtain the results posted by the Embassy of Ireland, New Delhi directly on my WhatsApp.
Things that went into building the tool:
1. AWS Lambda + API Gateway
4. Spare time on a Sunday afternoon.
AWS Lambda + API Gateway
I prefer using Node.js and didn’t want to spend a lot on cloud services and AWS was my preferred provider. There is nothing better than lambda to run your script at a low cost in the cloud.
To speedup things, I used the serverless framework which helps in creating the stack and other required resources on AWS quickly. Check out the demo project if you have never tried the framework.Twilio
I wanted to keep this open and decided to save the incoming WhatsApp number to a database and for that, I had to create a webhook and this was done with API Gateway + Lambda. So when Twilio receives a WhatsApp message it can publish it to the API Gateway and the logic was written to decide whether to “SUBSCRIBE”, “UNSUBSCRIBE” or inform the user about possible scenarios available.
To store the WhatsApp numbers, MongoDB was the quick solution came to my mind. I used MongoDB Atlas for this.
MongoDB also stores if the decision for the given date was announced or not this would help in identifying if we must be notifying the users or not.
Combining all the above tools, Node script was written to visit the website and check if the decision PDF is available. With AWS Event rule I was able to automate the script to run between 4 PM — 6 PM IST with a frequency of 15minutes. There are some gotchas like public holidays were not considered and hence the results were not fetched a few times.
In the above image, you can see that multiple messages for the same date were sent and this was fixed by saving the decision result for the date.
PS: I’ve got the VISA :)