Notification system for websites

Scenario:

I started to play beach volleyball tournaments at Manly beach in Sydney and the tournament accepts only 24 teams based on points collected from previous tournaments. This being one of the first tournaments of the season, lot of teams had the same points and who ever registered first were getting shortlisted. To register first, I needed to know when the form to register on the website is going live.

Task:

I wanted to design and implement a system which would send me a mobile notification to notify me that the form is live on the website before the admins post on Facebook group page, asking people to register. Since it’s a personal hobby project, I wanted to implement it quick and with hopefully zero operational cost.

Action:

Design for notifying when NBVA registrations open

The diagram above shows the design of how the solution is implemented. A lambda function is triggered every 1 minute which would get the ‘NBVA registration page html’ and check if the registration form is present in the html. Instead of building a custom app to notify me, I used the IFTTT(If This Then That) ‘applet’ service where in my scenarios ‘This’ or the event is a webhooks request, i.e., a trigger is fired whenever Lambda function does a POST call on the webhook endpoint and the Then or the trigger is sending a rich notification to IFTTT app. You can follow the mathworks blog if you want to create your own IFTTT applet with webhooks.

I built the lambda function using Node.js and the serverless framework. You can have a look at the code in my github repository http://github.com/gaurav-narra/nbva-registration/. Don’t forget to leave a star in github if you like it or want to use the same design for your project. I used ‘jsdom’ node library to parse the html and check if the form is present. I also did some error handling around the scenarios in which NBVA changed their website and should ‘jsdom’ fails to parse the website, it would notify me using the same IFTTT webhook. Refer https://github.com/gaurav-narra/nbva-registration/blob/main/src/handler.js#L12 for the same.

Result:

Since AWS has up to 1 million free lambda invocations and the code size in s3 was also quite small, I was not getting charged anything for running the above solution. The solution was also quick to implement. It took approximately 4 to 6 hours from start to end, which included researching about how the IFTTT webhooks works. So I was able to achieve my initial goal of quick implementation, zero operational cost and the timely notification on IFTTTT app.

It was a fun little project and I thought it would be great to share this with others because the use case of getting notified of new information on a website is common. The same code or design can be applied with minimal modifications based on use case.

Thank you for reading the article and good luck with trying the solution out.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store