| name | slack-cli |
| description | Reference for using slck (aliased as `slack`) to manage Slack channels, messages, users, and search from the terminal. Use when the user mentions Slack messaging, channel management, or workspace communication. |
Slack CLI (slack)
slck uses a stored bot token (xoxb-). Verify with slack config show.
Search requires a user token (xoxp-). Set via slack config set-token or SLACK_USER_TOKEN env var.
Channels
slack ch list
slack ch list --exclude-archived
slack ch list --type public
slack ch get C0123456789
slack ch create "name" --public
slack ch archive C0123456789
slack ch unarchive C0123456789
slack ch rename C0123456789 "new-name"
slack ch invite C0123456789 -u U0123456789
slack ch kick C0123456789 -u U0123456789
slack ch set-topic C0123456789 "topic"
slack ch set-purpose C0123456789 "purpose"
Messages
slack msg send C0123456789 "text"
slack msg send C0123456789 "reply" --thread-ts TS
slack msg send C0123456789 --file ./doc.pdf
slack msg send --channel "#general" "text"
slack msg update C0123 TS "new text"
slack msg delete C0123 TS
slack msg react C0123 TS thumbsup
slack msg unreact C0123 TS thumbsup
slack msg history C0123456789
slack msg history C0123456789 --limit 50
slack msg thread C0123 THREAD_TS
slack msg thread C0123 THREAD_TS --limit 200
Users
slack u list
slack u list --include-bots
slack u list --include-deactivated
slack u get U0123456789
slack u presence U0123456789
Search (requires user token)
slack s messages "query"
slack s messages "query" --in "#general"
slack s messages "query" --from "@alice"
slack s messages "query" --after 2025-01-01
slack s messages "query" --has-link
slack s files "query"
slack s files "query" --type pdf
slack s all "query"
Search Flags
| Flag | Description |
|---|
--count N | Results per page (max 100) |
--page N | Page number |
--sort score|timestamp | Sort order |
--sort-dir asc|desc | Direction |
--scope all|public|private|dm|mpim | Scope |
--highlight | Highlight matches |
Emoji, Files, Identity
slack emoji list
slack emoji list --include-aliases
slack files download FILE_ID
slack files download FILE_ID --output ./file.pdf
slack whoami
slack ws info
Output Formats
slack ch list
slack ch list -o json
slack ch list -o table
Environment Variables
| Variable | Description |
|---|
SLACK_API_TOKEN | Bot token override |
SLACK_USER_TOKEN | User token for search |
SLCK_AS_USER | true to default to user token |
NO_COLOR | Disable colored output |
Aliases
| Command | Aliases |
|---|
channels | ch |
messages | msg, m |
users | u |
search | s |
emoji | e |
workspace | ws, team |
Config Management
slack config set-token
slack config set-token xoxb-...
slack config show
slack config test
slack config delete-token
slack config delete-token --type bot
Shell Completions
slack completion zsh > "${fpath[1]}/_slck"
slack completion bash > /etc/bash_completion.d/slck
slack completion fish > ~/.config/fish/completions/slck.fish
Patterns
Read a thread from its URL
URL shape: https://<ws>.slack.com/archives/<CHANNEL_ID>/p<REPLY_TS>?thread_ts=<PARENT_TS>.
Use thread_ts (the parent). The p<ts> in the path is a reply id — using it misses the parent and any replies above it.
URL='https://example.slack.com/archives/CXXXXXXXXXX/p1700000000000000?thread_ts=1700000000.000000'
CH=${URL#*archives/}; CH=${CH%%/*}
TS=${URL#*thread_ts=}; TS=${TS%%&*}
slack msg thread "$CH" "$TS" -o json
Resolve not_in_channel
Reading messages requires channel membership; channels:history alone is not enough.
- Public — bot self-joins via
conversations.join (requires channels:join scope).
- Private — a human must
/invite @slackcli; bots cannot self-join.
- DM / MPIM — use a user token (
SLACK_USER_TOKEN / --as-user).
Self-join guard for public channels (conversations.join is idempotent):
TOKEN=${SLACK_API_TOKEN:-$(cut -d= -f2 ~/.config/slack-chat-api/credentials)}
curl -sS -H "Authorization: Bearer $TOKEN" -d "channel=$CH" \
https://slack.com/api/conversations.join >/dev/null
slack msg thread "$CH" "$TS"
If conversations.join returns missing_scope, add channels:join at
https://api.slack.com/apps/A0AN5RUFSNB/oauth and Reinstall to Workspace.
Known Limitations
- Bot tokens (
xoxb-) cannot unarchive channels — bot is removed on archive. Use a user token or the Slack UI.
channels invite idempotency is limited to single-user invites.
- Reading messages/threads requires channel membership — see Patterns → "Resolve
not_in_channel".