Skip to content

Commit aed5f77

Browse files
isaacrowntreeclaude
andcommitted
fix: clarify token defaults, add missing users.profile:read scope
The CLI automatically selects the correct token (bot vs user) for each command. Docs, skill, and auth status now reflect this clearly so agents don't need to think about --as-bot. Added missing users.profile:read scope needed for `slackbuzz status`. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 6fa7f76 commit aed5f77

6 files changed

Lines changed: 82 additions & 19 deletions

File tree

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,23 @@ slackbuzz digest
149149

150150
## Token types
151151

152-
SlackBuzz uses two types of Slack tokens:
152+
SlackBuzz uses two types of Slack tokens. **The CLI automatically selects the correct token for each command** — you don't need to specify which to use.
153153

154-
| Token | Prefix | Used for |
155-
|-------|--------|----------|
156-
| **Bot token** | `xoxb-` | Sending messages, reading channels, reactions, emoji list |
157-
| **User token** | `xoxp-` | Search, activity inbox, saved items, status management |
154+
| Token | Prefix | Automatic usage |
155+
|-------|--------|-----------------|
156+
| **Bot token** | `xoxb-` | Reading channels/users, reactions, system notifications (`notify`) |
157+
| **User token** | `xoxp-` | Sending messages (as you), search, DMs, saved items, status |
158+
159+
Messages post as the authenticated user by default. Pass `--as-bot` on `message send`, `edit`, or `delete` to post as the bot app instead.
158160

159161
The `slackbuzz app create` command creates a Slack app pre-configured with all required scopes for both token types. After installing the app to your workspace, paste both tokens when prompted.
160162

163+
### Required scopes
164+
165+
**Bot token (`xoxb-`):** `chat:write`, `channels:history`, `channels:read`, `emoji:read`, `groups:history`, `groups:read`, `im:history`, `im:read`, `mpim:history`, `mpim:read`, `reactions:read`, `reactions:write`, `users:read`
166+
167+
**User token (`xoxp-`):** `chat:write`, `im:write`, `search:read`, `stars:read`, `stars:write`, `users.profile:read`, `users.profile:write`
168+
161169
## Cross-tool integration
162170

163171
The `digest` command combines activity from Slack, ClickUp, and GitHub in a single view:

docs/src/content/docs/commands.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,27 @@ description: Complete reference for all slackbuzz CLI commands and flags.
77

88
All commands are invoked as subcommands of `slackbuzz`. Run `slackbuzz --help` for a summary, or `slackbuzz <command> --help` for details on any command.
99

10+
## Token selection
11+
12+
The CLI automatically picks the correct token (bot or user) for each command. You don't need to think about it — just run the command.
13+
14+
| Command | Token | Why |
15+
|---------|-------|-----|
16+
| `message send`, `edit`, `delete` | **User** | Posts as the authenticated user |
17+
| `message list` | **Bot** | Reads channel history |
18+
| `channel list`, `channel info` | **Bot** | Reads channel metadata |
19+
| `user list`, `user info` | **Bot** | Reads user profiles |
20+
| `react`, `react remove` | **Bot** | Reactions |
21+
| `notify` | **Bot** | System/automated notifications |
22+
| `thread link` | **Bot** | Generates permalinks |
23+
| `activity`, `threads`, `digest` | **User** | Search API (user-only) |
24+
| `dm list` | **User** | Search API (user-only) |
25+
| `message search`, `file search` | **User** | Search API (user-only) |
26+
| `later list`, `add`, `remove` | **User** | Stars API (user-only) |
27+
| `status`, `status set`, `clear` | **User** | Profile API (user-only) |
28+
29+
**Override:** Pass `--as-bot` on `message send`, `edit`, or `delete` to post as the bot app instead of the user.
30+
1031
---
1132

1233
## activity

docs/src/content/docs/security.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,21 @@ Tokens are never logged to stdout or stored in the config file.
1919

2020
## Token types
2121

22-
SlackBuzz uses two types of Slack tokens:
22+
SlackBuzz uses two types of Slack tokens. The CLI automatically selects the correct token for each command.
2323

24-
| Token | Prefix | Used for |
25-
|-------|--------|----------|
26-
| **Bot token** | `xoxb-` | Sending messages, reading channels, reactions, emoji list |
27-
| **User token** | `xoxp-` | Search, activity inbox, saved items, status management |
24+
| Token | Prefix | Automatic usage |
25+
|-------|--------|-----------------|
26+
| **Bot token** | `xoxb-` | Reading channels/users, reactions, system notifications |
27+
| **User token** | `xoxp-` | Sending messages (as you), search, DMs, saved items, status |
2828

2929
Both tokens are stored separately in the keyring. The `slackbuzz app create` command creates a Slack app pre-configured with all required scopes for both token types.
3030

31+
### Required scopes
32+
33+
**Bot (`xoxb-`):** `chat:write`, `channels:history`, `channels:read`, `emoji:read`, `groups:history`, `groups:read`, `im:history`, `im:read`, `mpim:history`, `mpim:read`, `reactions:read`, `reactions:write`, `users:read`
34+
35+
**User (`xoxp-`):** `chat:write`, `im:write`, `search:read`, `stars:read`, `stars:write`, `users.profile:read`, `users.profile:write`
36+
3137
## Best practices
3238

3339
1. **Use the system keyring**: The default storage method. Avoid overriding it unless necessary.

pkg/cmd/app/create.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ var appManifest = map[string]interface{}{
9090
"search:read",
9191
"stars:read",
9292
"stars:write",
93+
"users.profile:read",
9394
"users.profile:write",
9495
},
9596
},

pkg/cmd/auth/status.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,16 @@ func statusRun(f *cmdutil.Factory) error {
9898
userValid := userErr == nil && userToken != ""
9999

100100
if botValid {
101-
fmt.Fprintf(ios.Out, " Bot: read channels, post messages, reactions, list users\n")
101+
fmt.Fprintf(ios.Out, " Bot: read channels, list users, reactions, system notifications\n")
102102
}
103103
if userValid {
104-
fmt.Fprintf(ios.Out, " User: search, DMs, stars, profile, send messages\n")
104+
fmt.Fprintf(ios.Out, " User: send messages (default), search, DMs, stars, profile\n")
105105
}
106106
if !userValid {
107-
fmt.Fprintf(ios.Out, " %s User token not set — search, DMs, and stars unavailable\n", cs.Yellow("!"))
107+
fmt.Fprintf(ios.Out, " %s User token not set — sending, search, DMs, and stars unavailable\n", cs.Yellow("!"))
108108
fmt.Fprintf(ios.Out, " %s Add with: slackbuzz auth login\n", cs.Gray(" "))
109109
} else {
110-
fmt.Fprintf(ios.Out, " %s DM sending requires im:write and chat:write user scopes\n", cs.Gray("Hint:"))
110+
fmt.Fprintf(ios.Out, " %s Messages post as you by default. Use --as-bot to post as the app.\n", cs.Gray("Hint:"))
111111
}
112112

113113
return nil

skills/slackbuzz-cli/SKILL.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ slackbuzz auth login # Log in with bot and/or user token
2424
slackbuzz auth status # Check auth status and capabilities
2525
```
2626

27-
Two token types:
28-
- **Bot token** (`xoxb-`): Channels, reactions, user lists, posting messages
29-
- **User token** (`xoxp-`): Search, DMs, stars, status, profile
27+
Two token types are required. **The CLI automatically selects the right token for each command — you do not need to specify which to use.**
28+
29+
- **Bot token** (`xoxb-`): Used automatically for reading channels, listing users, reactions, and system notifications
30+
- **User token** (`xoxp-`): Used automatically for sending messages (as the user), search, DMs, saved items, status, and profile
31+
32+
Messages always post as the authenticated user by default. Only use `--as-bot` if you specifically want a message to come from the bot app rather than the user.
3033

3134
## Messaging
3235

@@ -189,14 +192,37 @@ slackbuzz user list
189192
slackbuzz user info @alice
190193
```
191194

195+
## Token Defaults
196+
197+
The CLI automatically selects the correct token for each command. You do not need to think about bot vs user mode — just run the command.
198+
199+
| Command | Token | Rationale |
200+
|---------|-------|-----------|
201+
| `message send`, `edit`, `delete` | **User** | Posts as the authenticated user |
202+
| `message list` | **Bot** | Reads channel history |
203+
| `channel list`, `channel info` | **Bot** | Reads channel metadata |
204+
| `user list`, `user info` | **Bot** | Reads user profiles |
205+
| `react`, `react remove` | **Bot** | Reactions via bot |
206+
| `notify` | **Bot** | System/automated notifications |
207+
| `thread link` | **Bot** | Generates permalinks |
208+
| `activity`, `threads`, `digest` | **User** | Slack search API (user-only) |
209+
| `dm list` | **User** | Slack search API (user-only) |
210+
| `message search`, `file search` | **User** | Slack search API (user-only) |
211+
| `later list`, `add`, `remove` | **User** | Stars API (user-only) |
212+
| `status`, `status set`, `clear` | **User** | Profile API (user-only) |
213+
214+
**Override:** Pass `--as-bot` on `message send`, `edit`, or `delete` to post as the bot app instead of the user. Only do this when explicitly requested.
215+
216+
**Missing permissions:** If a command fails due to a missing token or scope, the error message will indicate what's needed. Run `slackbuzz auth status` to check available capabilities.
217+
192218
## Common Flags
193219

194220
| Flag | Description |
195221
|------|-------------|
196222
| `--json` | Output as JSON |
197223
| `--jq <expr>` | Filter JSON with jq expression |
198224
| `--template <tmpl>` | Format with Go template |
199-
| `--as-bot` | Use bot token instead of user token (message send) |
225+
| `--as-bot` | Post as the bot app instead of the user (send/edit/delete only) |
200226
| `--since <duration>` | Time filter (2h, 1d, 7d, 2w, or YYYY-MM-DD) |
201227
| `--limit <n>` | Max results |
202228

@@ -233,11 +259,12 @@ The CLI automatically strips common shell escape artifacts from message text bef
233259

234260
## Key Behaviors
235261

262+
- **Automatic token selection**: The CLI picks the right token (bot or user) for each command. No need to specify — just run the command. Use `--as-bot` only when explicitly asked to post as the bot.
236263
- **DM auto-detection**: `@user`, `U...` IDs, and bare names auto-resolve to DM channels (for the channel/target argument)
237264
- **@mentions in message body**: Auto-resolved from `@name` to Slack's `<@USERID>` format before posting
238265
- **First-name shorthand**: `@herman` resolves to `herman.gorbatovskii` or `Herman Gorbatovskii` when unambiguous
239266
- **Shell unescape**: Common shell artifacts like `\!` are cleaned before sending
240267
- **Case-insensitive resolution**: User lookup matches display names and usernames regardless of case
241-
- **Dual tokens**: Bot token for channel ops, user token for search/DMs/status
268+
- **Permission feedback**: Missing tokens or scopes produce clear error messages. Use `slackbuzz auth status` to check capabilities.
242269
- **Deeplinks**: Output includes clickable Slack deeplinks
243270
- **Cross-tool**: Digest combines Slack, ClickUp, and GitHub activity

0 commit comments

Comments
 (0)