slack

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 9 Imported by: 0

README

togo

togo-framework/bot-slack

marketplace pkg.go.dev MIT

Slack driver for the togo bot subsystem.

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.

Configure

  1. Create a Slack app at api.slack.com/apps.
  2. Enable Socket Mode and generate an App-Level Token (xapp-…) with the connections:write scope.
  3. 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-…).
  4. Subscribe to the message.channels / message.im events.
  5. 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


Premium sponsors

ID8 Media  ·  One Studio

Support togo — become a sponsor.

Documentation

Overview

Package slack is the Slack driver for togo's bot subsystem, using Socket Mode (no public webhook URL required). Blank-import it alongside github.com/togo-framework/bot and set BOT_DRIVER=slack plus SLACK_APP_TOKEN (xapp-…) and SLACK_BOT_TOKEN (xoxb-…).

import _ "github.com/togo-framework/bot"
import _ "github.com/togo-framework/bot-slack"

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL