This blog will introduce you to the realm of using a VPS to create a cronjob and monitor changes on API. For this blog, we will focus on using the GreenHouse API to monitor changes in companies' jobs and then send ourselves an alert on it.
Getting a VPS - Linode
First, for us to create an alert we need to setup a VPS (virtual private server) that will have no downtime and be active 24/7. At OSS, we use Linode, so this article will focus on Linode setup. To signup, go to https://login.linode.com/signup and provide the required information. Make sure to verify your email. Once the email verification is complete, you will need to provide more details such as billing address, payment information, etc.
Once you have completed the required information and have a verified Linode account, go to cloud.linode.com. Usually, Linode will auto log you into that instance. Once at the cloud manager application, click on Create and select Linode. For your distribution, chose Ubuntu 16.04 LTS.
Once you have selected an instance and the region, for Linode plan, choose Nanode. This server will run on a 1gb memory because we do not need to perform any high memory consuming services. Provide a secure root password that you will use when performing an initial login. Once that is done, click on Create to finalize your Linode creation.
Setting up your server
Once your Linode is up and running, SSH into it and secure it at least to the basics. First, create a new user with adduser USERNAME. Provide the user password and make sure it is not guessable. We will not need a sudo permission for this user because it just uses a simple script and the script itself does not require any setup.
Install the required module
For this script to work, make sure that you have requests installed. Requests allows you to call a website/domain and display its content. In this case, we will use requests to pull the website information and compare it. To install requests use pip install requests --user. If pip is not installed, you can install it with apt-get install python3-pip. This will download and install pip which can be used to download the requests module.
Setup Slack instance
The provided script requires a Slack webhook link to send messages to on creation of new jobs. To create a Slack app, take note of the following step by step guide: