Skip to content

whale9490/slack-kotlin-heroku-example

Repository files navigation

slack-kotlin-heroku-example

Slack app example for Heroku deployment, written in Kotlin, using Bolt framework.

You need to configure your Slack app to run this as backend. Follow the official guide for that.

This example hosts two commands. /hello command is from this guide, and /meeting command is from this guide.

Run locally

To run this locally, create .env file on the project root, with following content.

PORT=3000
SLACK_BOT_TOKEN=<your_bot_token>
SLACK_SIGNING_SECRET=<your_signing_secret>

Replace <your_bot_token> and <your_signing_secret> with yours.

Then run.

gradlew run # Or from IntelliJ IDEA "Run" button.

Note that to actually trigger this from your Slack workspace, you need to expose this on the Internet. You can use ngrok or something for that.

Heroku deployment

Follow this guide to set up.

Once you've created your Heroku app with heroku create, you can deploy

git push heroku master

and configure environment variables.

heroku config:set SLACK_BOT_TOKEN="<your_bot_token>"
heroku config:set SLACK_SIGNING_SECRET="<your_signing_secret>"

Using the Heroku hosting URL (shown as the output of git push heroku master), you need to replace the following settings on your Slack app configuration.

  • Features > Interactivity & Shortcuts > Request URL
  • Features > Slash Commands > /hello > Request URL
  • Features > Slash Commands > /meeting > Request URL

All of them should be set to https://<your_heroku_app_id>.herokuapp.com/slack/events.

Once reinstalled, you can run those commands from your Slack workspace!

About

Slack app example for Heroku deployment, written in Kotlin, using Bolt framework.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages