Slack for Non-Humans™
Humans have eyes, we have jq.
Humans need emojis, we need thread_ts.
Humans want a UI, we just want a clean pipe.
This is not a CLI for you. This is a CLI for your digital entities.
Warning
Human, this tool defaults to JSON output. If your biological eyes find this hard to parse, use the --human flag. We recommend upgrading your optic nerve or using jq.
- Pipe-First Design - Output is always pure JSON (stdout) while logs go to stderr.
- Agent-Ready - Stateless authentication, perfect for LLMs, scripts, and cron jobs.
- Smart Caching - Resolves channel names (
#general) to IDs (C123...) locally for speed.
# Get channel history as minified JSON
slk messages list --channel C12345
# Pipe directly into other tools
slk messages list --channel "#general" | jq '.[].text'# Save your token to config
slk auth login --token xoxp-your-token --verify
# List channels in human-readable format
slk channels list --human
# List recent messages
slk messages list --channel "#general" --limit 10 --humanbrew install kehao95/slack-agent-cli/slkgo install github.com/kehao95/slack-agent-cli@latestDownload from GitHub Releases
This CLI uses User Tokens - It authenticates as you and acts on your behalf in Slack. This means:
- Acts as you: Messages, reactions, and actions appear as if you did them
- Uses your permissions: Can only access channels/DMs you have access to
- Simple & stateless: No OAuth flows, webhooks, or server infrastructure needed
- Token security: Keep your token safe - it has the same permissions you do
User Token (what this CLI uses):
- Format:
xoxp-... - Represents you (the user)
- Perfect for automation, scripts, and AI agents acting on your behalf
Bot Token (NOT used by this CLI):
- Format:
xoxb-... - Represents a bot user (separate identity)
- Requires more setup and different use cases
- Create Slack App: Go to https://api.slack.com/apps → "Create New App" → "From an app manifest"
- Choose mode & use manifest:
- Read-Only (recommended):
slack-app-manifest-readonly.yaml - Full Access:
slack-app-manifest-full.yaml
- Read-Only (recommended):
- Install to workspace: Click "Install to Workspace" and authorize
- Copy token: Copy the User OAuth Token (starts with
xoxp-) - Configure:
- Option A (Recommended): Run
slk auth login --token xoxp-... --verify - Option B: Set
export SLACK_USER_TOKEN='xoxp-...' - Option C: Use OAuth flow with
slk auth oauth(see below)
- Option A (Recommended): Run
See SLACK_SETUP.md for detailed setup instructions and mode comparison.
For automated token exchange, use the built-in OAuth server:
slk auth oauth --client-id $SLACK_CLIENT_ID --client-secret $SLACK_CLIENT_SECRET --saveThis starts a local server on port 8089 with a /callback endpoint. Expose it publicly (via your preferred method) and add the callback URL to your Slack app's redirect URIs. With --save, the token is automatically saved to config after successful exchange.
slk
├── auth # Authentication
│ ├── login # Save token to config
│ ├── oauth # Start OAuth callback server
│ ├── test # Verify credentials work
│ └── whoami # Show current user info
│
├── cache # Cache management
│ ├── populate # Fetch and cache channels/users
│ ├── status # Show cache state
│ └── clear # Clear cached data
│
├── channels # Channel operations
│ ├── list # List accessible channels
│ ├── join # Join a channel
│ └── leave # Leave a channel
│
├── messages # Message operations
│ ├── list # Fetch message history
│ ├── send # Send a message
│ ├── edit # Edit a message
│ ├── delete # Delete a message
│ └── search # Search messages
│
├── reactions # Reaction operations
│ ├── add # Add reaction to message
│ ├── remove # Remove reaction
│ └── list # List reactions on message
│
├── pins # Pin operations
│ ├── add # Pin a message
│ ├── remove # Unpin a message
│ └── list # List pinned messages
│
├── users # User operations
│ ├── list # List workspace members
│ ├── info # Get user details
│ └── presence # Check user presence
│
└── emoji # Emoji operations
└── list # List custom emoji
# Summarize the last hour of #alerts using an LLM
slk messages list --channel "#alerts" --since 1h | llm "Summarize these alerts"
# Auto-reply to specific errors
slk messages search --query "error: deployment" | \
jq -r '.matches[].ts' | \
xargs -I {} slk messages send --channel "#ops" --thread {} --text "Investigating..."# 1. Check recent messages
slk messages list --channel "#support" --since 1h
# 2. Search for specific issues
slk messages search --query "error in:#support"
# 3. Send a response
slk messages send --channel "#support" --thread "$THREAD_TS" --text "Here's the answer..."
# 4. Add acknowledgment reaction
slk reactions add --channel "#support" --ts "$MESSAGE_TS" --emoji "white_check_mark"~/.config/slack-cli/config.json
Or override with SLACK_CLI_CONFIG environment variable.
| Variable | Description |
|---|---|
SLACK_USER_TOKEN |
Override user token from config |
SLACK_CLI_CONFIG |
Custom config file path |
SLACK_CLI_FORMAT |
Default output format (json or human) |
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Configuration error (missing config, invalid tokens) |
| 3 | Authentication error (invalid/expired tokens) |
| 4 | Rate limit exceeded |
| 5 | Network error |
| 6 | Permission denied (missing scopes) |
| 7 | Resource not found (channel, user, message) |
MIT