bolt-on-heroku icon indicating copy to clipboard operation
bolt-on-heroku copied to clipboard

Bolt example app in TypeScript on Heroku

Slack Bolt app on Heroku

Deploy

Slack ⚡️ Bolt

A framework to build Slack apps, fast.

  • https://slack.dev/bolt
  • https://github.com/SlackAPI/bolt

How to build

Create a Slack App

https://api.slack.com/apps

  • Features > OAuth & Permissions:
    • Scopes:
      • "channels:history"
      • "chat:write:bot"
      • "bot"
    • Click "Save Changes"
  • Features > Bot User:
    • Click "Add a Bot User"
    • Click "Add Bot User"
  • Settings > Install App:
    • Complete "Install App"

Run the app on your local machine

export SLACK_SIGNING_SECRET=abcd1234567890123456789012345678
export SLACK_BOT_TOKEN=xoxb-123456789012-123456789012-abcd12345678901234567890
export DEBUG=1
npm run local

Deploy to Heroku

Deploy

  • Set env variables on Heroku
    • (Slack) Settings > Basic Information > App Credentials > Siginging Secret
    • (Slack) Settings > Install App > Bot User OAuth Access Token

Heroku deployment page

Enable Slack Events Subscription

  • Features > Event Subscriptions:
    • Enable Events:
      • Change from "Off" to "On"
    • Request URL:
      • Set "https://{your app name}.herokuapp.com/slack/events"
    • Subscribe to Workspace Events:
      • Add "message.channels"
    • Click "Save Changes"

Try the Slack App

  • Invite your bot to a Slack channel
  • Post "hello" in the channel
  • You'll receive a response from the bot

hello