A serverless workflow that posts any new #1 articles on Hacker News to Slack
Google Alerts let you "monitor the web for interesting new content" and I like to do the same for Hacker News. This workflow runs a free, hosted cron job that sends me a new Slack message each time a story on HN gets matches a given keyword.
Click on the Workflow tab on the left to see the code associated with this workflow.
Click the green Fork button in the top-right to create a copy of this workflow in your own account (if you haven't signed up for Pipedream, you'll be prompted to).
In the Run Node.js code step, modify the KEYWORDS
to the keywords you'd like to receive alerts for.
This workflow uses KVdb, a free KV store with an HTTP API. This helps us maintain state on the most recent top story so we only send one notification each time a new top story hits HN. Create a free KVdb "bucket" (API key) by running:
> curl -d 'email=user@example.com' https://kvdb.io
Fd55uogXyxYdnXJvnyN8Xo
Then, create a new Pipedream environment variable named KVDB_API_KEY
with the API key you created in KVdb. The Node code in the workflow will use this API key to get and set data in KVdb (for example, to store the newest top story, and later to check if we've seen this top story before).
Finally, create a Slack incoming webhook URL tied to the Slack channel you want to send messages to, and create a new SLACK_WEBHOOK_URL
environment variable with that URL. The code in the workflow also reads from this environment variable to send the stories to Slack.
You can modify that incoming webhook configuration to have whatever logo and title you'd like.
Once you fork the workflow, that copy is yours to run and modify. You can replace the Slack action with an action that sends a message to Discord, or email. You can change the frequency of the cron job that checks for new stories, or modify the Node.js code to fetch a different set of stories from the HN API.