A lightweight command-line interface for interacting with the Slack Web API.
This project is not affiliated with Slack or Salesforce. If you're looking to build Slack apps with workflows, triggers, and datastores, check out the official Slack CLI.
What's the difference?
| Feature | slck (this project) | Official Slack CLI |
|---|---|---|
| Purpose | Direct API access for automation & scripting | Build and deploy Slack apps |
| Use cases | Send messages, manage channels, search, CI/CD integration | Workflows, triggers, datastores, app development |
| Authentication | Bot/User OAuth tokens | Slack app credentials |
| Complexity | Simple, single binary | Full development framework |
When to use slck:
- Sending notifications from CI/CD pipelines
- Automating channel management
- Scripting message operations
- Quick API interactions from the terminal
- Integrating Slack into shell scripts or automation tools
Homebrew (recommended)
brew install open-cli-collective/tap/slack-chat-cliNote: This installs from our third-party tap.
Chocolatey
choco install slack-chat-cliWinget
winget install OpenCLICollective.slack-chat-cliSnap
sudo snap install ocli-slackNote: After installation, the command is available as
slck.
APT (Debian/Ubuntu)
# Add the GPG key
curl -fsSL https://open-cli-collective.github.io/linux-packages/keys/gpg.asc | sudo gpg --dearmor -o /usr/share/keyrings/open-cli-collective.gpg
# Add the repository
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/open-cli-collective.gpg] https://open-cli-collective.github.io/linux-packages/apt stable main" | sudo tee /etc/apt/sources.list.d/open-cli-collective.list
# Install
sudo apt update
sudo apt install slckNote: This is our third-party APT repository, not official Debian/Ubuntu repos.
DNF/YUM (Fedora/RHEL/CentOS)
# Add the repository
sudo tee /etc/yum.repos.d/open-cli-collective.repo << 'EOF'
[open-cli-collective]
name=Open CLI Collective
baseurl=https://open-cli-collective.github.io/linux-packages/rpm
enabled=1
gpgcheck=1
gpgkey=https://open-cli-collective.github.io/linux-packages/keys/gpg.asc
EOF
# Install
sudo dnf install slckNote: This is our third-party RPM repository, not official Fedora/RHEL repos.
Binary download
Download .deb, .rpm, or .tar.gz from the Releases page - available for x64 and ARM64.
# Direct .deb install
curl -LO https://github.com/open-cli-collective/slack-chat-api/releases/latest/download/slck_VERSION_linux_amd64.deb
sudo dpkg -i slck_VERSION_linux_amd64.deb
# Direct .rpm install
curl -LO https://github.com/open-cli-collective/slack-chat-api/releases/latest/download/slck-VERSION.x86_64.rpm
sudo rpm -i slck-VERSION.x86_64.rpmgo install github.com/open-cli-collective/slack-chat-api/cmd/slck@latestgit clone https://github.com/open-cli-collective/slack-chat-api.git
cd slack-chat-api
make build| Platform | Credential Storage |
|---|---|
| macOS | Secure (Keychain) |
| Linux | Config file (~/.config/slack-chat-api/credentials) |
| Windows | Config file (%USERPROFILE%\.config\slack-chat-api\credentials) |
Note: On Linux and Windows, credentials are stored in a file with restricted permissions (0600). While not as secure as macOS Keychain, this is standard practice for CLI tools.
-
Go to api.slack.com/apps → Create New App → From an app manifest
-
Select your workspace
-
Paste this manifest (JSON tab recommended):
{ "display_information": { "name": "Slack Chat API" }, "features": { "bot_user": { "display_name": "Slack Chat API", "always_online": false } }, "oauth_config": { "scopes": { "bot": [ "channels:history", "channels:manage", "channels:read", "chat:write", "groups:history", "groups:read", "reactions:write", "team:read", "users:read" ], "user": [ "search:read" ] } }, "settings": { "org_deploy_enabled": false, "socket_mode_enabled": false } }YAML alternative (if you prefer)
display_information: name: Slack Chat API features: bot_user: display_name: Slack Chat API always_online: false oauth_config: scopes: bot: - "channels:history" - "channels:manage" - "channels:read" - "chat:write" - "groups:history" - "groups:read" - "reactions:write" - "team:read" - "users:read" user: - "search:read" settings: org_deploy_enabled: false socket_mode_enabled: false
-
Click Create → Install to Workspace → Allow
-
Copy the Bot User OAuth Token (starts with
xoxb-) -
Run:
slck config set-token # Paste your token when prompted
Your token is stored securely in macOS Keychain, or in a config file on Linux and Windows.
export SLACK_API_TOKEN=xoxb-your-token-hereUse a shell function to lazy-load your token from 1Password on first use:
# Add to ~/.zshrc or ~/.bashrc
slack-chat() {
if [[ -z "$SLACK_API_TOKEN" ]]; then
export SLACK_API_TOKEN="$(op read 'op://Personal/slck/api_token')"
fi
command slck "$@"
}Or create an alias that always fetches fresh:
alias slack-chat='SLACK_API_TOKEN="$(op read '\''op://Personal/slck/api_token'\'')" slck'Replace op://Personal/slck/api_token with your 1Password secret reference.
The manifest above includes these scopes:
| Scope | Purpose |
|---|---|
channels:read |
List public channels, get channel info |
channels:history |
Read message history from public channels |
channels:manage |
Create, archive, set topic/purpose, invite users |
chat:write |
Send, update, delete messages |
groups:read |
List private channels |
groups:history |
Read message history from private channels |
reactions:write |
Add/remove reactions |
team:read |
Get workspace info |
users:read |
List users, get user info |
search:read |
Search messages and files (user token only) |
This CLI supports two types of Slack tokens:
| Token Type | Prefix | Commands | How to Get |
|---|---|---|---|
| Bot token | xoxb- |
channels, users, messages, workspace | OAuth & Permissions → Bot User OAuth Token |
| User token | xoxp- |
search | OAuth & Permissions → User OAuth Token |
Most commands use the bot token. Search commands require a user token.
Setting up both tokens:
# Set bot token (for channels, users, messages, workspace)
slck config set-token xoxb-your-bot-token
# Set user token (for search)
slck config set-token xoxp-your-user-tokenThe set-token command automatically detects the token type and stores it appropriately.
Getting a user token:
- Go to api.slack.com/apps → Your app
- OAuth & Permissions → User Token Scopes → Add
search:read - Reinstall app to workspace (if already installed)
- Copy the User OAuth Token (starts with
xoxp-)
Environment variables:
| Variable | Token Type | Description |
|---|---|---|
SLACK_API_TOKEN |
Bot | Bot token for most commands |
SLACK_USER_TOKEN |
User | User token for search commands |
These flags are available on all commands:
| Flag | Short | Default | Description |
|---|---|---|---|
--output |
-o |
text |
Output format: text, json, or table |
--no-color |
false |
Disable colored output | |
--version |
-v |
Show version information | |
--help |
-h |
Show help for any command |
# List all channels
slck channels list
# List with options
slck channels list --types public_channel,private_channel # Include private channels
slck channels list --limit 50 # Limit results
slck channels list --exclude-archived=false # Include archived channels
# Get channel info
slck channels get C1234567890
# Create a channel
slck channels create my-new-channel
slck channels create private-channel --private
# Archive/unarchive
slck channels archive C1234567890
slck channels unarchive C1234567890
# Set topic/purpose
slck channels set-topic C1234567890 "New topic"
slck channels set-purpose C1234567890 "Channel purpose"
# Invite users
slck channels invite C1234567890 U1111111111 U2222222222| Command | Flags | Description |
|---|---|---|
list |
--types, --limit, --exclude-archived |
List channels |
get <id> |
Get channel details | |
create <name> |
--private |
Create a channel |
archive <id> |
--force |
Archive a channel (prompts for confirmation) |
unarchive <id> |
Unarchive a channel | |
set-topic <id> <topic> |
Set channel topic | |
set-purpose <id> <purpose> |
Set channel purpose | |
invite <id> <user>... |
Invite users to channel |
# List all users
slck users list
slck users list --limit 50
# Get user info
slck users get U1234567890
# Search users
slck users search "john"
slck users search "john@company.com" --field email
slck users search "John Smith" --field display_name
slck users search "bot" --include-bots| Command | Flags | Description |
|---|---|---|
list |
--limit |
List all users |
get <id> |
Get user details | |
search <query> |
--limit, --field, --include-bots |
Search users by name, email, or display name |
| Flag | Default | Description |
|---|---|---|
--limit |
1000 |
Maximum users to search through |
--field |
all |
Search field: all, name, email, display_name |
--include-bots |
false |
Include bot users in results |
# Send a message (uses Block Kit formatting by default)
slck messages send C1234567890 "Hello, *world*!"
# Send from stdin (use "-" as text argument)
echo "Hello from stdin" | slck messages send C1234567890 -
cat message.txt | slck messages send C1234567890 -
# Send plain text (no formatting)
slck messages send C1234567890 "Plain text" --simple
# Send with custom Block Kit blocks
slck messages send C1234567890 "Fallback" --blocks '[{"type":"section","text":{"type":"mrkdwn","text":"*Bold*"}}]'
# Reply in a thread
slck messages send C1234567890 "Thread reply" --thread 1234567890.123456
# Update a message
slck messages update C1234567890 1234567890.123456 "Updated text"
slck messages update C1234567890 1234567890.123456 "Plain update" --simple
# Delete a message
slck messages delete C1234567890 1234567890.123456
# Get channel history
slck messages history C1234567890
slck messages history C1234567890 --limit 50
slck messages history C1234567890 --oldest 1234567890.000000 # After this time
slck messages history C1234567890 --latest 1234567890.000000 # Before this time
# Get thread replies
slck messages thread C1234567890 1234567890.123456
slck messages thread C1234567890 1234567890.123456 --limit 50
# Add/remove reactions
slck messages react C1234567890 1234567890.123456 thumbsup
slck messages unreact C1234567890 1234567890.123456 thumbsup| Command | Flags | Description |
|---|---|---|
send <channel> <text> |
--thread, --blocks, --simple |
Send a message (use - for stdin) |
update <channel> <ts> <text> |
--blocks, --simple |
Update a message |
delete <channel> <ts> |
--force |
Delete a message (prompts for confirmation) |
history <channel> |
--limit, --oldest, --latest |
Get channel history |
thread <channel> <ts> |
--limit |
Get thread replies |
react <channel> <ts> <emoji> |
Add reaction | |
unreact <channel> <ts> <emoji> |
Remove reaction |
Note: Search requires a user token (
xoxp-*). See Token Types.
# Search messages
slck search messages "quarterly report"
slck search messages "in:#general bug fix"
slck search messages "from:@alice project update"
# Search files
slck search files "budget spreadsheet"
slck search files "type:pdf report"
# Search all (messages + files)
slck search all "project proposal"
slck search all "quarterly" --sort timestamp
# With pagination
slck search messages "error" --count 50 --page 2
# Using query builder flags (alternative to modifiers in query string)
slck search messages "meeting" --in "#general"
slck search messages "update" --from "@alice"
slck search messages "report" --scope public
slck search messages "project" --after 2025-01-01 --before 2025-12-31
slck search messages "link" --has-link
slck search files "document" --type pdf| Modifier | Example | Description |
|---|---|---|
in: |
in:#channel or in:@user |
Search in specific channel or DM |
from: |
from:@username |
Content from specific user |
before: |
before:2025-01-01 |
Before date |
after: |
after:2025-01-01 |
After date |
has:link |
Messages containing links | |
has:reaction |
Messages with reactions | |
type: |
type:pdf |
Files of specific type |
| Command | Flags | Description |
|---|---|---|
messages <query> |
--count, --page, --sort, --sort-dir, --highlight, --scope, --in, --from, --after, --before, --has-link, --has-reaction |
Search messages |
files <query> |
--count, --page, --sort, --sort-dir, --highlight, --scope, --in, --from, --after, --before, --type, --has-pin |
Search files |
all <query> |
--count, --page, --sort, --sort-dir, --highlight, --scope, --in, --from, --after, --before, --has-link, --has-reaction |
Search messages and files |
| Flag | Short | Default | Description |
|---|---|---|---|
--count |
-c |
20 |
Results per page (max 100) |
--page |
-p |
1 |
Page number (max 100) |
--sort |
-s |
score |
Sort by: score or timestamp |
--sort-dir |
desc |
Sort direction: asc or desc |
|
--highlight |
false |
Highlight matching terms |
These flags provide an alternative to using modifiers in the query string:
| Flag | Description |
|---|---|
--scope |
Search scope: all, public, private, dm, mpim |
--in |
Filter by channel (e.g., #general or general) |
--from |
Filter by user (e.g., @alice or alice) |
--after |
Content after date (YYYY-MM-DD) |
--before |
Content before date (YYYY-MM-DD) |
--has-link |
Messages containing links |
--has-reaction |
Messages with reactions |
--type |
File type filter (files only, e.g., pdf, image) |
--has-pin |
Files that are pinned (files only) |
# Get workspace info
slck workspace info# Set API token (interactive prompt)
slck config set-token
# Set API token directly
slck config set-token xoxb-your-token-here
# Show current config status
slck config show
# Delete stored token
slck config delete-token| Command | Flags | Description |
|---|---|---|
set-token [token] |
Set API token (auto-detects bot/user type) | |
show |
Show current configuration status | |
delete-token |
--force, --type |
Delete stored token(s) |
test |
Test authentication for configured tokens |
The delete-token command accepts a --type flag:
--type bot- Delete only the bot token--type user- Delete only the user token--type all- Delete both tokens (default)
All commands support multiple output formats via the --output (or -o) flag:
# Default text output
slck channels list
# JSON output (for scripting)
slck channels list --output json
slck users get U1234567890 -o json
# Table output (aligned columns)
slck channels list --output table# Bash
slck completion bash > /etc/bash_completion.d/slck
# Zsh
slck completion zsh > "${fpath[1]}/_slck"
# Fish
slck completion fish > ~/.config/fish/completions/slck.fish
# PowerShell
slck completion powershell > slck.ps1Commands have convenient aliases:
| Command | Aliases |
|---|---|
channels |
ch |
users |
u |
messages |
msg, m |
search |
s |
workspace |
ws, team |
| Variable | Description |
|---|---|
SLACK_API_TOKEN |
Bot token (overrides stored bot token) |
SLACK_USER_TOKEN |
User token for search (overrides stored user token) |
NO_COLOR |
Disable colored output when set |
XDG_CONFIG_HOME |
Custom config directory (default: ~/.config) |
Bot tokens (xoxb-) cannot unarchive channels due to a Slack API limitation. When a channel is archived, the bot is automatically removed from it, and bot tokens require membership to unarchive.
Workarounds:
- Unarchive channels via the Slack UI
- Use a user token (
xoxp-) instead of a bot token
MIT