# Automating website monitor alerts with Go Lang!

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](http://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](http://null.community) firewall. However, I found a way around it, which I'll detail later.

## Libraries Used

1. **github.com/gocolly/colly**: An elegant scraper and crawler framework for Golang used for monitoring the website.
    
2. **github.com/mailgun/mailgun-go**: A Go library for sending mail with the Mailgun API, used for emailing the results.
    
3. **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 -

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1708329175407/95907f73-a6c7-41b3-b6d4-e8bce10b40e3.png align="center")

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.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1708329310781/32a64b3d-216d-4657-8894-1d74ae0f4055.png align="center")

## 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.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1708424669139/84f75d18-3c17-4d8b-8686-3c29de368c03.png align="center")

## 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 -

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1708339023726/4e4413c2-9b0c-4160-85b2-97470a31558c.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1708339048960/ae31fb95-7df7-4103-9cfc-c84828a3b741.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1708339061431/0dff39e8-f4c4-4844-9d50-c75c53ddcdb7.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1708339083313/a88459b9-cf75-40c5-9fd2-ac3f840ca2d9.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1708339092150/1f128c0d-e65e-4a70-bdf6-b31c490096ff.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1708339165008/2ffe0fae-057c-4972-9fe3-c67679583b19.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1708339177493/241b855a-b8a9-49ac-8604-6babb0c9188d.png align="center")

Example result:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1708339484449/ca033e6a-9525-4728-a555-1bb50b06780b.png align="center")

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](https://www.linkedin.com/in/abhinandan-khurana/), always open to the constructive feedback!

Thanks and see ya in next blog!
