Install
togo install togo-framework/bot
togo install togo-framework/bot-slack
The Slack driver for togo's bot
subsystem, built on slack-go in Socket
Mode — no public webhook URL required, so it works from localhost and behind
NAT. It dispatches each message to the bot command/message handlers you register
once with bot.OnCommand / bot.OnMessage.
- Create a Slack app at api.slack.com/apps.
- Enable Socket Mode and generate an App-Level Token (
xapp-…) with the
connections:write scope.
- Add bot scopes (
app_mentions:read, channels:history, chat:write,
im:history) and install the app to your workspace to get the Bot Token
(xoxb-…).
- Subscribe to the
message.channels / message.im events.
- Set env:
BOT_DRIVER=slack
SLACK_APP_TOKEN=xapp-...
SLACK_BOT_TOKEN=xoxb-...
Blank-import the driver next to the base:
import (
_ "github.com/togo-framework/bot"
_ "github.com/togo-framework/bot-slack"
)
m.Channel is the Slack channel ID; Service.Send(ctx, channel, msg) posts to
it. The driver ignores bot messages and edits to avoid loops.
License
MIT © togo-framework