This tutorial explains how to get Hacker News alerts for top stories in Slack. Just like we use Google Alerts for monitoring web, in the same way, we can use some similar service to do the same for Hacker News. Pipedream is an online platform where developers create and share some simple applications. Recently a project was published there which monitors Hacker News after 5 min intervals and send alerts for new story in Slack. Here you just have to fork this project and supply a Slack web hook URL and then you are good to go.
Here in Pipedream, you don’t have to write any code as it is already given there. You just need to place some variables and keys in order to make it work. By default, the workflow will run automatically after 5 minutes but you are free to change that. Usually a story reaches top on HN in around 15-20 minutes so you just adjust the interval accordingly. Also, not only Slack, but if you know Node.js then you can write a code to send alerts on an email address or to a Discord channel.
How to Get Hacker News Alerts for top Stories in Slack?
In order to get top story alert in a Slack channel, you will need three things. A KVdb key, an incoming webhook URL to a Slack channel, and a Pipedream account. So first create a Pipedream account and then and then find this workflow to fork it. After forking it, it will now appear in your account and then simply move on to the next step.
Now, open a prompt or terminal on your PC and then run the following command. It will help you generate a KVdb key that we will need later. In this command, you will have to specify your email address in order to get the key. And after you get the key, simply create an environment variable in your workflow and give it a name, KVDB_API_KEY. Corresponding to this, you will have to paste the key that you have generated.
curl -d '[email protected]' https://kvdb.io
Now, next things you have to create an incoming web hook for a Slack channel. Make sure that are signed in to your account and go to this URL. To create a Webhook URL, you will have to create a Slack application there. Also, you will have to enable the web hooks and then it will show you the wen hook URLs then you can simply scroll down to the page. And during the process, it will ask you to select a Slack workspace and channel in which the web hook will work.
Comeback to the Pipedream interface and then simply paste the webhook URL that you got above in the “Send a message to Slack section”. You can see this in the screenshot below and if you have some technical knowledge then you can customize the look and feel of the final message. Save your workflow and it will start running according to the time interval you have specified. If it will find any new top story then it will simply push that in Slack. You can see in this the first screenshot I have added in this post.
This way, you can create Slack alerts for top stories on Hacker News. Pipedream is a very nice website to find cool workflows like the one I have mentioned here. You can browse the website and see some other workflows listed there which you will like.
Closing thoughts
If you want to get notified about new top stories on Hacker News then this tutorial will help you. Just fork the workflow I have mentioned above and then set it up for your Slack account. Also, not only Slack but if your coding then you can make this work on email as well. So, if you’ve been looking for ways to get notifications for new top story on HN then you will like this tutorial.