Description
A bot that notifies you on Slack whenever your company/product is mentioned on Hacker News.
npx boilerapp hacker-news-slack-bot文档
Built With
- Vercel Functions for cron processes & event subscriptions via webhooks
- Vercel Cron Jobs for triggering cron processes.
- Hacker News API for pulling data
- Slack API for sending and unfurling messages
- Upstash for key-value storage (Redis).
How It Works
- Set up a Vercel cron job that pings our
/api/cronendpoint once every 60 seconds. - Get the last checked HN post ID (
lastCheckedId) and the list ofkeywordsto check against from Upstash. - Get the
latestPostIdusing HN API'smaxitemendpoint. Then, perform checks against each post betweenlastCheckedIdandlatestPostIdto see if they contain any of the delineatedkeywords. - For each positive post, send its link to Slack using the
chat.postMessagemethod. - Listen to the
link_sharedevent at our/api/eventendpoint. Once an event occurs, send a POST request to Slack to unfurl the link using the chat.unfurl method.
One-Click Install
Here's a 60s video that walks you through the installation process, step-by-step.
You can click the button below to install the bot directly into your desired Slack workspace:
<a href="https://slack.com/oauth/v2/authorize?scope=chat:write,chat:write.public,links:read,links:write,commands,team:read&client_id=12364000946.3845028209600"><img alt="Add to Slack" height="40" width="139" src="https://platform.slack-edge.com/img/add_to_slack@2x.png" /></a>
Once it's installed, create a channel to receive notifications in and start configuring the bot with the /configure command.
Deploy Your Own
You can also deploy your own version of this bot using Vercel and Upstash. Note that while this is in early-access, some of these processes might change.
Prefer a video tutorial instead? Watch this video.
Step 1: Create Slack App + Secure Env Vars
- Navigate to api.slack.com/apps and click on "Create New App".
- Select "From scratch" and input
Hacker News Botas the name of your app. - Voilà! You've just created your Slack app. Here, you'll receive 3 values that will be used for your Vercel deployment in the next step:
- Client ID: This is your App's unique public-facing ID that will be the value for the
NEXT_PUBLIC_SLACK_CLIENT_IDenv var. - Signing Secret: This is the signing secret used to validate that requests are genuinely coming from Slack. It will be the value for the
SLACK_SIGNING_SECRETenv var. - Verification Token: This is the verification token used to validate that requests are genuinely coming from Slack. It will be the value for the
SLACK_VERIFICATION_TOKENenv var.
- Client ID: This is your App's unique public-facing ID that will be the value for the

Step 2: Create Upstash Account
Go to console.upstash.com and create an account. You'll need it for the next step.
Step 3: Deploy to Vercel
You can deploy your bot to Vercel with one-click:
Be sure to include all 5 of the env vars above in your deployment.
When the project finishes deploying, get your project's domain (e.g. https://slacker-eight.vercel.app/). You'll need it for the next step.
Step 4: Configuring Slack app
For your Slack app to be able to send/unfurl messages in your Slack workspace, we will need to configure a few things:
Step 4A: Configuring OAuth Scopes
- From your Slack app home screen, select "OAuth & Permissions" from the sidebar (under "Features").
- Scroll down to "Scopes\
Prix
Gratuit