Learn how to create a bot that monitors HackerNews and sends notifications to Slack. This guide shows you how to use scheduled deployments and external APIs.

What you’ll learn

Web Scraping

Fetch data from HackerNews

Slack Integration

Send notifications to Slack channels

Scheduling

Configure automated deployments

API Usage

Work with external services

Create your bot

1

Fork the template

Sign in to Replit and fork the HackerNews webscraper template. Select + Use Template and follow the prompts to create your Replit App.

2

Create a Slack app

  1. Go to Slack Apps and select Create an App
  2. Choose From an app manifest
  3. Select your workspace
  4. Replace the manifest with this JSON
  5. Review and select Create
  6. Select Install the App

You may need administrator approval based on your organization’s policies.

3

Configure tokens

Add these secrets to your Replit App’s Secrets tab:

  1. SLACK_BOT_TOKEN

    • Go to Settings > Install App
    • Copy the Bot User OAuth Token
  2. SLACK_SIGNING_SECRET

    • Go to Settings > Basic Information
    • Copy the Signing Secret from App Credentials
  3. SLACK_APP_TOKEN

    • Go to Settings > Basic Information
    • Under App-Level Tokens, select Generate Token and Scopes
    • Add permissions and generate token
4

Customize your bot

Update app.py with your preferences:

KEYWORDS = ["h"]  # Terms to search for
ALERT_UIDS = ["U06C34217C5"]  # Your Slack member ID
NUM_TOP_STORIES = 25  # Number of stories to check

Get your Slack member ID from your profile settings under the ellipsis menu.

Deploy with scheduling

1

Start deployment

Select Deploy in the workspace header.

2

Configure schedule

  1. Choose Scheduled Deployments
  2. Set your preferred schedule
  3. Select Deploy
3

Monitor

Your bot will now run automatically according to your schedule.

Customization options

Enhance filtering

  • Add more keywords
  • Refine matching criteria
  • Customize scoring

Improve notifications

  • Format messages
  • Add rich previews
  • Include metadata

Next steps

Want to learn more about deployments? Check out our deployment documentation.