Hello, tech enthusiasts!
Like many of you, I've been a regular participant of null-meetups in Bengaluru. However, I often found myself missing out on special workshops (Humla/Bachav) due to the limited seat availability. I realized that attendees were registering faster than I could, leaving me out on the opportunity.
As a solution, I decided to leverage my recent learning of GoLang to develop a notification bot. This bot is programmed to monitor the website at regular intervals and notify me via email with an attached screenshot of the events, whenever a Null meetup or workshop is announced.
Sounds intriguing? Let's dive into the details!
The Bot's Mechanism
TL;DR
The GoLang bot is created to monitor the null.community website for Bengaluru Null meetup (especially for Humla/Bachav workshops). Once it detects an event, it sends an email notification along with a screenshot of the event to my inbox. One of the challenges faced during the bot's deployment was the IP/host blocking by null.community firewall. However, I found a way around it, which I'll detail later.
Libraries Used
github.com/gocolly/colly: An elegant scraper and crawler framework for Golang used for monitoring the website.
github.com/mailgun/mailgun-go: A Go library for sending mail with the Mailgun API, used for emailing the results.
github.com/chromedp/chromedp: A faster, simpler way to drive browsers supporting the Chrome DevTools Protocol, used for capturing the event screenshot from the site.
Now, first let's check how the content looks on the website -
We want content from tbody part to parse and check for the content.
Why didn't I choose div?
Well, I only wanted the content related to the event, so that I can easily parse and read data with minimal noise.
A Look at the tool logic
The below UML diagram demonstrates the whole process:
P.S. I won't detail the whole code since the logic is important, the code will follow itself if you have enough practice with the coding language.
Overcoming Deployment Challenges
Initially, the plan was to run this bot using Github Actions or my VPS. However, the null website was blocking my requests from these sources. As a workaround, I decided to schedule the bot on my personal system, which is typically active for 18 hours a day. I used the Windows Task Scheduler to run the binary I built from Go at regular intervals.
Using Task Scheduler
Creating a basic task locally -
Example result:
In conclusion, this GoLang bot was just a play-through in my free time to learn GoLang.
This blog was meant for beginners, if it helped you even a little bit give it a like!
Also, if you feel something can be improved in the above blog please feel free to contact me on LinkedIn, always open to the constructive feedback!
Thanks and see ya in next blog!