2026-01-05 22:13:21 +01:00
---
2026-01-18 15:01:04 +00:00
summary: "Slack setup for socket or HTTP webhook mode"
read_when: "Setting up Slack or debugging Slack socket/HTTP mode"
2026-01-05 22:13:21 +01:00
---
2026-01-18 15:01:04 +00:00
# Slack
2026-01-03 23:12:11 -06:00
2026-01-18 15:01:04 +00:00
## Socket mode (default)
### Quick setup (beginner)
2026-01-11 02:40:28 +01:00
1) Create a Slack app and enable **Socket Mode** .
2) Create an **App Token** (`xapp-...` ) and **Bot Token** (`xoxb-...` ).
3) Set tokens for Clawdbot and start the gateway.
Minimal config:
```json5
{
2026-01-13 06:16:43 +00:00
channels: {
slack: {
enabled: true,
appToken: "xapp-...",
botToken: "xoxb-..."
}
2026-01-11 02:40:28 +01:00
}
}
```
2026-01-18 15:01:04 +00:00
### Setup
2026-01-13 06:16:43 +00:00
1) Create a Slack app (From scratch) in https://api.channels.slack.com/apps.
2026-01-06 23:32:12 +00:00
2) **Socket Mode** → toggle on. Then go to **Basic Information** → **App-Level Tokens** → **Generate Token and Scopes** with scope `connections:write` . Copy the **App Token** (`xapp-...` ).
3) **OAuth & Permissions** → add bot token scopes (use the manifest below). Click **Install to Workspace** . Copy the **Bot User OAuth Token** (`xoxb-...` ).
feat(slack): add userToken for read-only access to DMs and private channels (#981)
- Add userToken and userTokenReadOnly (default: true) config fields
- Implement token routing: reads prefer user token, writes use bot token
- Add tests for token routing logic
- Update documentation with required OAuth scopes
User tokens enable reading DMs and private channels without requiring
bot membership. The userTokenReadOnly flag (true by default) ensures
the user token can only be used for reads, preventing accidental
sends as the user.
Required user token scopes:
- channels:history, channels:read
- groups:history, groups:read
- im:history, im:read
- mpim:history, mpim:read
- users:read, reactions:read, pins:read, emoji:read, search:read
2026-01-15 16:11:33 -08:00
4) Optional: **OAuth & Permissions** → add **User Token Scopes** (see the read-only list below). Reinstall the app and copy the **User OAuth Token** (`xoxp-...` ).
5) **Event Subscriptions** → enable events and subscribe to:
2026-01-06 23:32:12 +00:00
- `message.*` (includes edits/deletes/thread broadcasts)
- `app_mention`
- `reaction_added` , `reaction_removed`
- `member_joined_channel` , `member_left_channel`
- `channel_rename`
- `pin_added` , `pin_removed`
feat(slack): add userToken for read-only access to DMs and private channels (#981)
- Add userToken and userTokenReadOnly (default: true) config fields
- Implement token routing: reads prefer user token, writes use bot token
- Add tests for token routing logic
- Update documentation with required OAuth scopes
User tokens enable reading DMs and private channels without requiring
bot membership. The userTokenReadOnly flag (true by default) ensures
the user token can only be used for reads, preventing accidental
sends as the user.
Required user token scopes:
- channels:history, channels:read
- groups:history, groups:read
- im:history, im:read
- mpim:history, mpim:read
- users:read, reactions:read, pins:read, emoji:read, search:read
2026-01-15 16:11:33 -08:00
6) Invite the bot to channels you want it to read.
7) Slash Commands → create `/clawd` if you use `channels.slack.slashCommand` . If you enable native commands, add one slash command per built-in command (same names as `/help` ). Native defaults to off for Slack unless you set `channels.slack.commands.native: true` (global `commands.native` is `"auto"` which leaves Slack off).
8) App Home → enable the **Messages Tab** so users can DM the bot.
2026-01-03 23:12:11 -06:00
2026-01-06 23:32:12 +00:00
Use the manifest below so scopes and events stay in sync.
2026-01-03 23:12:11 -06:00
2026-01-13 06:16:43 +00:00
Multi-account support: use `channels.slack.accounts` with per-account tokens and optional `name` . See [`gateway/configuration` ](/gateway/configuration#telegramaccounts--discordaccounts--slackaccounts--signalaccounts--imessageaccounts ) for the shared pattern.
2026-01-08 01:18:37 +01:00
2026-01-18 15:01:04 +00:00
### Clawdbot config (minimal)
2026-01-11 02:40:28 +01:00
Set tokens via env vars (recommended):
- `SLACK_APP_TOKEN=xapp-...`
- `SLACK_BOT_TOKEN=xoxb-...`
Or via config:
```json5
{
2026-01-13 06:16:43 +00:00
channels: {
slack: {
enabled: true,
appToken: "xapp-...",
botToken: "xoxb-..."
}
2026-01-11 02:40:28 +01:00
}
}
```
2026-01-18 15:01:04 +00:00
### User token (optional)
feat(slack): add userToken for read-only access to DMs and private channels (#981)
- Add userToken and userTokenReadOnly (default: true) config fields
- Implement token routing: reads prefer user token, writes use bot token
- Add tests for token routing logic
- Update documentation with required OAuth scopes
User tokens enable reading DMs and private channels without requiring
bot membership. The userTokenReadOnly flag (true by default) ensures
the user token can only be used for reads, preventing accidental
sends as the user.
Required user token scopes:
- channels:history, channels:read
- groups:history, groups:read
- im:history, im:read
- mpim:history, mpim:read
- users:read, reactions:read, pins:read, emoji:read, search:read
2026-01-15 16:11:33 -08:00
Clawdbot can use a Slack user token (`xoxp-...` ) for read operations (history,
pins, reactions, emoji, member info). By default this stays read-only: reads
prefer the user token when present, and writes still use the bot token unless
you explicitly opt in. Even with `userTokenReadOnly: false` , the bot token stays
preferred for writes when it is available.
2026-01-10 18:53:38 +01:00
feat(slack): add userToken for read-only access to DMs and private channels (#981)
- Add userToken and userTokenReadOnly (default: true) config fields
- Implement token routing: reads prefer user token, writes use bot token
- Add tests for token routing logic
- Update documentation with required OAuth scopes
User tokens enable reading DMs and private channels without requiring
bot membership. The userTokenReadOnly flag (true by default) ensures
the user token can only be used for reads, preventing accidental
sends as the user.
Required user token scopes:
- channels:history, channels:read
- groups:history, groups:read
- im:history, im:read
- mpim:history, mpim:read
- users:read, reactions:read, pins:read, emoji:read, search:read
2026-01-15 16:11:33 -08:00
User tokens are configured in the config file (no env var support). For
multi-account, set `channels.slack.accounts.<id>.userToken` .
2026-01-15 01:41:11 +00:00
feat(slack): add userToken for read-only access to DMs and private channels (#981)
- Add userToken and userTokenReadOnly (default: true) config fields
- Implement token routing: reads prefer user token, writes use bot token
- Add tests for token routing logic
- Update documentation with required OAuth scopes
User tokens enable reading DMs and private channels without requiring
bot membership. The userTokenReadOnly flag (true by default) ensures
the user token can only be used for reads, preventing accidental
sends as the user.
Required user token scopes:
- channels:history, channels:read
- groups:history, groups:read
- im:history, im:read
- mpim:history, mpim:read
- users:read, reactions:read, pins:read, emoji:read, search:read
2026-01-15 16:11:33 -08:00
Example with bot + app + user tokens:
```json5
{
channels: {
slack: {
enabled: true,
appToken: "xapp-...",
botToken: "xoxb-...",
userToken: "xoxp-..."
}
}
}
```
2026-01-15 01:41:11 +00:00
feat(slack): add userToken for read-only access to DMs and private channels (#981)
- Add userToken and userTokenReadOnly (default: true) config fields
- Implement token routing: reads prefer user token, writes use bot token
- Add tests for token routing logic
- Update documentation with required OAuth scopes
User tokens enable reading DMs and private channels without requiring
bot membership. The userTokenReadOnly flag (true by default) ensures
the user token can only be used for reads, preventing accidental
sends as the user.
Required user token scopes:
- channels:history, channels:read
- groups:history, groups:read
- im:history, im:read
- mpim:history, mpim:read
- users:read, reactions:read, pins:read, emoji:read, search:read
2026-01-15 16:11:33 -08:00
Example with userTokenReadOnly explicitly set (allow user token writes):
2026-01-15 01:41:11 +00:00
```json5
{
feat(slack): add userToken for read-only access to DMs and private channels (#981)
- Add userToken and userTokenReadOnly (default: true) config fields
- Implement token routing: reads prefer user token, writes use bot token
- Add tests for token routing logic
- Update documentation with required OAuth scopes
User tokens enable reading DMs and private channels without requiring
bot membership. The userTokenReadOnly flag (true by default) ensures
the user token can only be used for reads, preventing accidental
sends as the user.
Required user token scopes:
- channels:history, channels:read
- groups:history, groups:read
- im:history, im:read
- mpim:history, mpim:read
- users:read, reactions:read, pins:read, emoji:read, search:read
2026-01-15 16:11:33 -08:00
channels: {
slack: {
enabled: true,
appToken: "xapp-...",
botToken: "xoxb-...",
userToken: "xoxp-...",
userTokenReadOnly: false
}
}
2026-01-15 01:41:11 +00:00
}
```
2026-01-18 15:01:04 +00:00
#### Token usage
feat(slack): add userToken for read-only access to DMs and private channels (#981)
- Add userToken and userTokenReadOnly (default: true) config fields
- Implement token routing: reads prefer user token, writes use bot token
- Add tests for token routing logic
- Update documentation with required OAuth scopes
User tokens enable reading DMs and private channels without requiring
bot membership. The userTokenReadOnly flag (true by default) ensures
the user token can only be used for reads, preventing accidental
sends as the user.
Required user token scopes:
- channels:history, channels:read
- groups:history, groups:read
- im:history, im:read
- mpim:history, mpim:read
- users:read, reactions:read, pins:read, emoji:read, search:read
2026-01-15 16:11:33 -08:00
- Read operations (history, reactions list, pins list, emoji list, member info,
search) prefer the user token when configured, otherwise the bot token.
- Write operations (send/edit/delete messages, add/remove reactions, pin/unpin,
file uploads) use the bot token by default. If `userTokenReadOnly: false` and
no bot token is available, Clawdbot falls back to the user token.
2026-01-18 15:01:04 +00:00
### History context
feat(slack): add userToken for read-only access to DMs and private channels (#981)
- Add userToken and userTokenReadOnly (default: true) config fields
- Implement token routing: reads prefer user token, writes use bot token
- Add tests for token routing logic
- Update documentation with required OAuth scopes
User tokens enable reading DMs and private channels without requiring
bot membership. The userTokenReadOnly flag (true by default) ensures
the user token can only be used for reads, preventing accidental
sends as the user.
Required user token scopes:
- channels:history, channels:read
- groups:history, groups:read
- im:history, im:read
- mpim:history, mpim:read
- users:read, reactions:read, pins:read, emoji:read, search:read
2026-01-15 16:11:33 -08:00
- `channels.slack.historyLimit` (or `channels.slack.accounts.*.historyLimit` ) controls how many recent channel/group messages are wrapped into the prompt.
- Falls back to `messages.groupChat.historyLimit` . Set `0` to disable (default 50).
2026-01-18 15:01:04 +00:00
## HTTP mode (Events API)
Use HTTP webhook mode when your Gateway is reachable by Slack over HTTPS (typical for server deployments).
HTTP mode uses the Events API + Interactivity + Slash Commands with a shared request URL.
### Setup
1) Create a Slack app and **disable Socket Mode** (optional if you only use HTTP).
2) **Basic Information** → copy the **Signing Secret** .
3) **OAuth & Permissions** → install the app and copy the **Bot User OAuth Token** (`xoxb-...` ).
4) **Event Subscriptions** → enable events and set the **Request URL** to your gateway webhook path (default `/slack/events` ).
5) **Interactivity & Shortcuts** → enable and set the same **Request URL** .
6) **Slash Commands** → set the same **Request URL** for your command(s).
Example request URL:
`https://gateway-host/slack/events`
### Clawdbot config (minimal)
```json5
{
channels: {
slack: {
enabled: true,
mode: "http",
botToken: "xoxb-...",
signingSecret: "your-signing-secret",
webhookPath: "/slack/events"
}
}
}
```
Multi-account HTTP mode: set `channels.slack.accounts.<id>.mode = "http"` and provide a unique
`webhookPath` per account so each Slack app can point to its own URL.
### Manifest (optional)
feat(slack): add userToken for read-only access to DMs and private channels (#981)
- Add userToken and userTokenReadOnly (default: true) config fields
- Implement token routing: reads prefer user token, writes use bot token
- Add tests for token routing logic
- Update documentation with required OAuth scopes
User tokens enable reading DMs and private channels without requiring
bot membership. The userTokenReadOnly flag (true by default) ensures
the user token can only be used for reads, preventing accidental
sends as the user.
Required user token scopes:
- channels:history, channels:read
- groups:history, groups:read
- im:history, im:read
- mpim:history, mpim:read
- users:read, reactions:read, pins:read, emoji:read, search:read
2026-01-15 16:11:33 -08:00
Use this Slack app manifest to create the app quickly (adjust the name/command if you want). Include the
user scopes if you plan to configure a user token.
2026-01-03 23:12:11 -06:00
2026-01-06 23:32:12 +00:00
```json
{
"display_information": {
"name": "Clawdbot",
"description": "Slack connector for Clawdbot"
},
"features": {
"bot_user": {
"display_name": "Clawdbot",
"always_online": false
},
"app_home": {
"messages_tab_enabled": true,
"messages_tab_read_only_enabled": false
},
"slash_commands": [
{
"command": "/clawd",
"description": "Send a message to Clawdbot",
"should_escape": false
}
]
},
"oauth_config": {
"scopes": {
"bot": [
"chat:write",
"channels:history",
"channels:read",
"groups:history",
"groups:read",
"groups:write",
"im:history",
"im:read",
"im:write",
"mpim:history",
"mpim:read",
"mpim:write",
"users:read",
"app_mentions:read",
"reactions:read",
"reactions:write",
"pins:read",
"pins:write",
"emoji:read",
"commands",
"files:read",
"files:write"
feat(slack): add userToken for read-only access to DMs and private channels (#981)
- Add userToken and userTokenReadOnly (default: true) config fields
- Implement token routing: reads prefer user token, writes use bot token
- Add tests for token routing logic
- Update documentation with required OAuth scopes
User tokens enable reading DMs and private channels without requiring
bot membership. The userTokenReadOnly flag (true by default) ensures
the user token can only be used for reads, preventing accidental
sends as the user.
Required user token scopes:
- channels:history, channels:read
- groups:history, groups:read
- im:history, im:read
- mpim:history, mpim:read
- users:read, reactions:read, pins:read, emoji:read, search:read
2026-01-15 16:11:33 -08:00
],
"user": [
"channels:history",
"channels:read",
"groups:history",
"groups:read",
"im:history",
"im:read",
"mpim:history",
"mpim:read",
"users:read",
"reactions:read",
"pins:read",
"emoji:read",
"search:read"
2026-01-06 23:32:12 +00:00
]
}
},
"settings": {
"socket_mode_enabled": true,
"event_subscriptions": {
"bot_events": [
"app_mention",
"message.channels",
"message.groups",
"message.im",
"message.mpim",
"reaction_added",
"reaction_removed",
"member_joined_channel",
"member_left_channel",
"channel_rename",
"pin_added",
"pin_removed"
]
}
}
}
```
2026-01-13 06:16:43 +00:00
If you enable native commands, add one `slash_commands` entry per command you want to expose (matching the `/help` list). Override with `channels.slack.commands.native` .
2026-01-06 23:32:12 +00:00
## Scopes (current vs optional)
Slack's Conversations API is type-scoped: you only need the scopes for the
conversation types you actually touch (channels, groups, im, mpim). See
2026-01-13 06:16:43 +00:00
https://api.channels.slack.com/docs/conversations-api for the overview.
2026-01-06 23:32:12 +00:00
feat(slack): add userToken for read-only access to DMs and private channels (#981)
- Add userToken and userTokenReadOnly (default: true) config fields
- Implement token routing: reads prefer user token, writes use bot token
- Add tests for token routing logic
- Update documentation with required OAuth scopes
User tokens enable reading DMs and private channels without requiring
bot membership. The userTokenReadOnly flag (true by default) ensures
the user token can only be used for reads, preventing accidental
sends as the user.
Required user token scopes:
- channels:history, channels:read
- groups:history, groups:read
- im:history, im:read
- mpim:history, mpim:read
- users:read, reactions:read, pins:read, emoji:read, search:read
2026-01-15 16:11:33 -08:00
### Bot token scopes (required)
2026-01-06 23:32:12 +00:00
- `chat:write` (send/update/delete messages via `chat.postMessage` )
2026-01-13 06:16:43 +00:00
https://api.channels.slack.com/methods/chat.postMessage
2026-01-06 23:32:12 +00:00
- `im:write` (open DMs via `conversations.open` for user DMs)
2026-01-13 06:16:43 +00:00
https://api.channels.slack.com/methods/conversations.open
2026-01-06 23:32:12 +00:00
- `channels:history` , `groups:history` , `im:history` , `mpim:history`
2026-01-13 06:16:43 +00:00
https://api.channels.slack.com/methods/conversations.history
2026-01-06 23:32:12 +00:00
- `channels:read` , `groups:read` , `im:read` , `mpim:read`
2026-01-13 06:16:43 +00:00
https://api.channels.slack.com/methods/conversations.info
2026-01-08 23:06:56 +01:00
- `users:read` (user lookup)
2026-01-13 06:16:43 +00:00
https://api.channels.slack.com/methods/users.info
2026-01-06 23:32:12 +00:00
- `reactions:read` , `reactions:write` (`reactions.get` / `reactions.add` )
2026-01-13 06:16:43 +00:00
https://api.channels.slack.com/methods/reactions.get
https://api.channels.slack.com/methods/reactions.add
2026-01-06 23:32:12 +00:00
- `pins:read` , `pins:write` (`pins.list` / `pins.add` / `pins.remove` )
2026-01-13 06:16:43 +00:00
https://api.channels.slack.com/scopes/pins:read
https://api.channels.slack.com/scopes/pins:write
2026-01-06 23:32:12 +00:00
- `emoji:read` (`emoji.list` )
2026-01-13 06:16:43 +00:00
https://api.channels.slack.com/scopes/emoji:read
2026-01-06 23:32:12 +00:00
- `files:write` (uploads via `files.uploadV2` )
2026-01-13 06:16:43 +00:00
https://api.channels.slack.com/messaging/files/uploading
2026-01-06 23:32:12 +00:00
feat(slack): add userToken for read-only access to DMs and private channels (#981)
- Add userToken and userTokenReadOnly (default: true) config fields
- Implement token routing: reads prefer user token, writes use bot token
- Add tests for token routing logic
- Update documentation with required OAuth scopes
User tokens enable reading DMs and private channels without requiring
bot membership. The userTokenReadOnly flag (true by default) ensures
the user token can only be used for reads, preventing accidental
sends as the user.
Required user token scopes:
- channels:history, channels:read
- groups:history, groups:read
- im:history, im:read
- mpim:history, mpim:read
- users:read, reactions:read, pins:read, emoji:read, search:read
2026-01-15 16:11:33 -08:00
### User token scopes (optional, read-only by default)
Add these under **User Token Scopes** if you configure `channels.slack.userToken` .
- `channels:history` , `groups:history` , `im:history` , `mpim:history`
- `channels:read` , `groups:read` , `im:read` , `mpim:read`
- `users:read`
- `reactions:read`
- `pins:read`
- `emoji:read`
- `search:read`
2026-01-06 23:32:12 +00:00
### Not needed today (but likely future)
- `mpim:write` (only if we add group-DM open/DM start via `conversations.open` )
- `groups:write` (only if we add private-channel management: create/rename/invite/archive)
- `chat:write.public` (only if we want to post to channels the bot isn't in)
2026-01-13 06:16:43 +00:00
https://api.channels.slack.com/scopes/chat:write.public
2026-01-06 23:32:12 +00:00
- `users:read.email` (only if we need email fields from `users.info` )
2026-01-13 06:16:43 +00:00
https://api.channels.slack.com/changelog/2017-04-narrowing-email-access
2026-01-06 23:32:12 +00:00
- `files:read` (only if we start listing/reading file metadata)
## Config
Slack uses Socket Mode only (no HTTP webhook server). Provide both tokens:
2026-01-03 23:12:11 -06:00
2026-01-06 23:32:12 +00:00
```json
2026-01-03 23:12:11 -06:00
{
2026-01-06 23:32:12 +00:00
"slack": {
"enabled": true,
"botToken": "xoxb-...",
"appToken": "xapp-...",
2026-01-12 08:21:50 +00:00
"groupPolicy": "allowlist",
2026-01-06 23:32:12 +00:00
"dm": {
"enabled": true,
"policy": "pairing",
"allowFrom": ["U123", "U456", "*"],
"groupEnabled": false,
2026-01-23 07:13:23 +02:00
"groupChannels": ["G123"],
"replyToMode": "all"
2026-01-06 23:32:12 +00:00
},
"channels": {
"C123": { "allow": true, "requireMention": true },
2026-01-07 11:23:09 +01:00
"#general ": {
"allow": true,
2026-01-07 11:59:48 +01:00
"requireMention": true,
2026-01-07 11:23:09 +01:00
"users": ["U123"],
"skills": ["search", "docs"],
"systemPrompt": "Keep answers short."
}
2026-01-06 23:32:12 +00:00
},
"reactionNotifications": "own",
"reactionAllowlist": ["U123"],
2026-01-08 00:50:29 +00:00
"replyToMode": "off",
2026-01-06 23:32:12 +00:00
"actions": {
"reactions": true,
"messages": true,
"pins": true,
"memberInfo": true,
"emojiList": true
},
"slashCommand": {
"enabled": true,
"name": "clawd",
"sessionPrefix": "slack:slash",
"ephemeral": true
},
"textChunkLimit": 4000,
"mediaMaxMb": 20
2026-01-03 23:12:11 -06:00
}
}
```
2026-01-06 23:32:12 +00:00
Tokens can also be supplied via env vars:
- `SLACK_BOT_TOKEN`
- `SLACK_APP_TOKEN`
Ack reactions are controlled globally via `messages.ackReaction` +
2026-01-10 02:11:51 +01:00
`messages.ackReactionScope` . Use `messages.removeAckAfterReply` to clear the
ack reaction after the bot replies.
2026-01-06 23:32:12 +00:00
2026-01-08 04:02:04 +01:00
## Limits
2026-01-13 06:16:43 +00:00
- Outbound text is chunked to `channels.slack.textChunkLimit` (default 4000).
- Media uploads are capped by `channels.slack.mediaMaxMb` (default 20).
2026-01-08 04:02:04 +01:00
2026-01-08 00:50:29 +00:00
## Reply threading
2026-01-13 06:16:43 +00:00
By default, Clawdbot replies in the main channel. Use `channels.slack.replyToMode` to control automatic threading:
2026-01-08 16:04:52 -08:00
| Mode | Behavior |
| --- | --- |
| `off` | **Default.** Reply in main channel. Only thread if the triggering message was already in a thread. |
| `first` | First reply goes to thread (under the triggering message), subsequent replies go to main channel. Useful for keeping context visible while avoiding thread clutter. |
| `all` | All replies go to thread. Keeps conversations contained but may reduce visibility. |
2026-01-08 00:50:29 +00:00
2026-01-08 16:04:52 -08:00
The mode applies to both auto-replies and agent tool calls (`slack sendMessage` ).
2026-01-23 05:24:18 +00:00
### Per-chat-type threading
You can configure different threading behavior per chat type by setting `channels.slack.replyToModeByChatType` :
2026-01-23 07:13:23 +02:00
```json5
{
channels: {
slack: {
replyToMode: "off", // default for channels
2026-01-23 05:24:18 +00:00
replyToModeByChatType: {
direct: "all", // DMs always thread
group: "first" // group DMs/MPIM thread first reply
},
2026-01-23 07:13:23 +02:00
}
}
}
```
2026-01-23 05:27:50 +00:00
Supported chat types:
- `direct` : 1:1 DMs (Slack `im` )
- `group` : group DMs / MPIMs (Slack `mpim` )
- `channel` : standard channels (public/private)
Precedence:
1) `replyToModeByChatType.<chatType>`
2) `replyToMode`
3) Provider default (`off` )
Legacy `channels.slack.dm.replyToMode` is still accepted as a fallback for `direct` when no chat-type override is set.
Examples:
Thread DMs only:
```json5
{
channels: {
slack: {
replyToMode: "off",
replyToModeByChatType: { direct: "all" }
}
}
}
```
Thread group DMs but keep channels in the root:
```json5
{
channels: {
slack: {
replyToMode: "off",
replyToModeByChatType: { group: "first" }
}
}
}
```
Make channels thread, keep DMs in the root:
```json5
{
channels: {
slack: {
replyToMode: "first",
replyToModeByChatType: { direct: "off", group: "off" }
}
}
}
```
2026-01-23 07:13:23 +02:00
2026-01-08 16:04:52 -08:00
### Manual threading tags
For fine-grained control, use these tags in agent responses:
- `[[reply_to_current]]` — reply to the triggering message (start/continue thread).
- `[[reply_to:<id>]]` — reply to a specific message id.
2026-01-08 00:50:29 +00:00
2026-01-06 23:32:12 +00:00
## Sessions + routing
- DMs share the `main` session (like WhatsApp/Telegram).
2026-01-11 02:44:32 +00:00
- Channels map to `agent:<agentId>:slack:channel:<channelId>` sessions.
2026-01-13 06:16:43 +00:00
- Slash commands use `agent:<agentId>:slack:slash:<userId>` sessions (prefix configurable via `channels.slack.slashCommand.sessionPrefix` ).
2026-01-17 17:16:20 +00:00
- If Slack doesn’ t provide `channel_type` , Clawdbot infers it from the channel ID prefix (`D` , `C` , `G` ) and defaults to `channel` to keep session keys stable.
2026-01-13 06:16:43 +00:00
- Native command registration uses `commands.native` (global default `"auto"` → Slack off) and can be overridden per-workspace with `channels.slack.commands.native` . Text commands require standalone `/...` messages and can be disabled with `commands.text: false` . Slack slash commands are managed in the Slack app and are not removed automatically. Use `commands.useAccessGroups: false` to bypass access-group checks for commands.
2026-01-07 02:04:02 +01:00
- Full command list + config: [Slash commands ](/tools/slash-commands )
2026-01-06 23:32:12 +00:00
## DM security (pairing)
2026-01-13 06:16:43 +00:00
- Default: `channels.slack.dm.policy="pairing"` — unknown DM senders get a pairing code (expires after 1 hour).
2026-01-10 16:36:43 +01:00
- Approve via: `clawdbot pairing approve slack <code>` .
2026-01-13 06:16:43 +00:00
- To allow anyone: set `channels.slack.dm.policy="open"` and `channels.slack.dm.allowFrom=["*"]` .
2026-01-18 22:51:09 +00:00
- `channels.slack.dm.allowFrom` accepts user IDs, @handles , or emails (resolved at startup when tokens allow). The wizard accepts usernames and resolves them to ids during setup when tokens allow.
2026-01-06 23:32:12 +00:00
## Group policy
2026-01-13 06:16:43 +00:00
- `channels.slack.groupPolicy` controls channel handling (`open|disabled|allowlist` ).
- `allowlist` requires channels to be listed in `channels.slack.channels` .
2026-01-18 00:41:57 +00:00
- If you only set `SLACK_BOT_TOKEN` /`SLACK_APP_TOKEN` and never create a `channels.slack` section,
the runtime defaults `groupPolicy` to `open` . Add `channels.slack.groupPolicy` ,
`channels.defaults.groupPolicy` , or a channel allowlist to lock it down.
- The configure wizard accepts `#channel` names and resolves them to IDs when possible
(public + private); if multiple matches exist, it prefers the active channel.
- On startup, Clawdbot resolves channel/user names in allowlists to IDs (when tokens allow)
and logs the mapping; unresolved entries are kept as typed.
- To allow **no channels** , set `channels.slack.groupPolicy: "disabled"` (or keep an empty allowlist).
2026-01-06 23:32:12 +00:00
2026-01-13 06:16:43 +00:00
Channel options (`channels.slack.channels.<id>` or `channels.slack.channels.<name>` ):
2026-01-07 11:23:09 +01:00
- `allow` : allow/deny the channel when `groupPolicy="allowlist"` .
- `requireMention` : mention gating for the channel.
2026-01-08 08:49:16 +01:00
- `allowBots` : allow bot-authored messages in this channel (default: false).
2026-01-07 11:23:09 +01:00
- `users` : optional per-channel user allowlist.
- `skills` : skill filter (omit = all skills, empty = none).
- `systemPrompt` : extra system prompt for the channel (combined with topic/purpose).
- `enabled` : set `false` to disable the channel.
2026-01-06 23:32:12 +00:00
## Delivery targets
Use these with cron/CLI sends:
- `user:<id>` for DMs
- `channel:<id>` for channels
## Tool actions
2026-01-13 06:16:43 +00:00
Slack tool actions can be gated with `channels.slack.actions.*` :
2026-01-06 23:32:12 +00:00
| Action group | Default | Notes |
| --- | --- | --- |
| reactions | enabled | React + list reactions |
| messages | enabled | Read/send/edit/delete |
| pins | enabled | Pin/unpin/list |
| memberInfo | enabled | Member info |
| emojiList | enabled | Custom emoji list |
feat(slack): add userToken for read-only access to DMs and private channels (#981)
- Add userToken and userTokenReadOnly (default: true) config fields
- Implement token routing: reads prefer user token, writes use bot token
- Add tests for token routing logic
- Update documentation with required OAuth scopes
User tokens enable reading DMs and private channels without requiring
bot membership. The userTokenReadOnly flag (true by default) ensures
the user token can only be used for reads, preventing accidental
sends as the user.
Required user token scopes:
- channels:history, channels:read
- groups:history, groups:read
- im:history, im:read
- mpim:history, mpim:read
- users:read, reactions:read, pins:read, emoji:read, search:read
2026-01-15 16:11:33 -08:00
## Security notes
- Writes default to the bot token so state-changing actions stay scoped to the
app's bot permissions and identity.
- Setting `userTokenReadOnly: false` allows the user token to be used for write
operations when a bot token is unavailable, which means actions run with the
installing user's access. Treat the user token as highly privileged and keep
action gates and allowlists tight.
- If you enable user-token writes, make sure the user token includes the write
scopes you expect (`chat:write` , `reactions:write` , `pins:write` ,
`files:write` ) or those operations will fail.
2026-01-06 23:32:12 +00:00
## Notes
2026-01-13 06:16:43 +00:00
- Mention gating is controlled via `channels.slack.channels` (set `requireMention` to `true` ); `agents.list[].groupChat.mentionPatterns` (or `messages.groupChat.mentionPatterns` ) also count as mentions.
2026-01-09 12:44:23 +00:00
- Multi-agent override: set per-agent patterns on `agents.list[].groupChat.mentionPatterns` .
2026-01-13 06:16:43 +00:00
- Reaction notifications follow `channels.slack.reactionNotifications` (use `reactionAllowlist` with mode `allowlist` ).
- Bot-authored messages are ignored by default; enable via `channels.slack.allowBots` or `channels.slack.channels.<id>.allowBots` .
- Warning: If you allow replies to other bots (`channels.slack.allowBots=true` or `channels.slack.channels.<id>.allowBots=true` ), prevent bot-to-bot reply loops with `requireMention` , `channels.slack.channels.<id>.users` allowlists, and/or clear guardrails in `AGENTS.md` and `SOUL.md` .
2026-01-07 04:24:11 +01:00
- For the Slack tool, reaction removal semantics are in [/tools/reactions ](/tools/reactions ).
2026-01-06 23:32:12 +00:00
- Attachments are downloaded to the media store when permitted and under the size limit.