SlackBot is a framework for building Slack Bots utilizing the Slack APIso
go get
$ go get github.com/tarkalabs/slackbot
There is a slackbot server example in examples/add_new_entry
.
Slash commands appear to flow to the handler, messages are not being sent back out properly (look at server logs for response details)
In the interest of time, the developer translated a slack.SlashCommand
to a slackevents.MessageEvent
to re-use the defined Command
. A lot more work is needed to realign everything with the fact that slash commands coming through a separate endpoint/payload.
- Run ngrok to expose slackbot server (later, when everything is configured) to the internet
- Setup an account on https://ngrok.com, keep track of generated auth token, install ngrok locally and use the auth token
ngrok http 63800
- Take note of the URL created for accessing your local server
- Create a new app on https://api.slack.com/
- (TODO: not sure about this step) Enable Slash Commands, Event Subscriptions, Interactivity (don't need Shortcuts), and configure their endpoints using the base URL generated by ngrok
- Notice how the slackbot server will expose the following endpoints:
/slashcmd
for slash commands/event
for slack events/interaction
for "interactive_message", "dialog_submission", shortcuts, etc.
- Notice how the slackbot server will expose the following endpoints:
- Set environment variables based on information
SLACK_BOT_ID="..."
(Settings -> Basic Information -> App Credentials -> App ID)SLACK_API_TOKEN="..."
(generated token under Features -> OAuth & Permissions -> OAuth Tokens for Your Workspace -> Bot User OAuth Token)SLACK_VERIFICATION_TOKEN="..."
(Settings -> Basic Information -> App Credentials -> Verification Token)
- Run the example slackbot server
go run main.go
- The example has port 63800 configured and can be changed if needed