This is a minimal example of a Go Slackbot that uses the Coder chat API's dynamic tools feature to let an LLM interact with Slack. It is intended as a starting point — fork it, customize the system prompt, and add your own tools.
- Bot is @mentioned in Slack
- Creates a new Coder chat with dynamic tools (
slack_send_message,slack_react_to_message, etc.) - When the LLM calls a dynamic tool → executes it against the Slack API → submits results back
- Chat resumes until complete
Follow-up mentions in the same thread reuse the same Coder chat.
| Tool | Description |
|---|---|
slack_send_message |
Post a message |
slack_edit_message |
Edit a previously sent message |
slack_react_to_message |
Add or remove an emoji reaction |
slack_get_thread_replies |
Read thread context |
slack_get_user_info |
Look up a Slack user |
slack_report_status |
Update the typing indicator |
export SLACK_BOT_TOKEN="xoxb-..." # Bot User OAuth Token
export SLACK_APP_TOKEN="xapp-..." # App-Level Token (socket mode)
export CODER_URL="https://your-coder.example.com"
export CODER_SESSION_TOKEN="..." # coder tokens create
go build -o slackbot .
./slackbot- Create a Slack app at https://api.slack.com/apps (or use the manifest in
slack-app-manifest.yaml) - Enable Socket Mode (generates the
xapp-token) - Subscribe to bot events:
app_mention - Add bot scopes:
app_mentions:read,chat:write,reactions:write,channels:history,groups:history,users:read,users:read.email,assistant:write - Install to workspace
- Coder: commit
76d89f59af42or later (the first commit with theWatchChats,UnsafeDynamicTools, and experimental chat APIs this example depends on) - Go 1.24+