/go-slack-interactive

Sample slack bot which uses slack interactive message (button & menue) written in Golang

Primary LanguageGo

Slack interactive message in Golang

This is sample slack bot which uses slack interactive message written in Golang. To run this bot, you need to create a bot as slack app. To create slack app only for your team, you can use internal integrations (No OAuth required. This code does not implement it, so if you want to distribute it, you need to write it by yourself). Create a new app from here. The following is how this bot works. Feel free to fork this repository and write your own! Cheers 🍺

(NOTE: Order is fake...)

Usage

To run this bot, you need to set the following env vars,

export BOT_ID="U***"             // you can get this after create a bot user (via slack app management console)
export BOT_TOKEN="xoxb-***"      // you can get this after create a bot user (via slack app management console)
export VERIFICATION_TOKEN="***"  // you can get this after enable interactive message (via slack app management console)
export CHANNEL_ID="C***"         // bot reacts only this channel

To run this,

$ dep ensure
$ go build -o bot && ./bot

To run this local, use ngrok (See more about it here) and set it for interactive message requests endpoint.

References