slackcli
A command-line interface for Slack, designed for both humans and AI agents.
Not the Official Slack CLI
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 | slackcli (this project) | Official Slack CLI |
|---|
| Purpose | Direct API access for automation & scripting | Build and deploy Slack apps |
| Use cases | Read messages, search channels, AI agent integration | Workflows, triggers, datastores, app development |
| Authentication | Bot/User OAuth tokens | Slack app credentials |
| Complexity | Simple Python CLI | Full development framework |
When to use slackcli:
- Reading and searching Slack messages
- Sending, editing, and deleting messages
- Sending direct messages to users
- Uploading files to channels
- Adding and removing reactions
- Pinning and unpinning messages
- Scheduling messages for later delivery
- Managing and searching users
- Automating channel exploration
- Integrating Slack into AI agents and scripts
- Quick API interactions from the terminal
Installation
First clone the repository, then:
# Install globally with uv (editable mode)
uv tool install -e .
Editable mode means updates are automatic after git pull - no reinstall needed.
Configuration
Create a configuration file at ~/.config/slackcli/config.toml:
# Default organization (optional)
default_org = "myworkspace"
[orgs.myworkspace]
token = "xoxp-your-user-token-here"
[orgs.another-workspace]
token = "xoxp-another-token"
Token Types
xoxp-* - User token (recommended, full visibility)
xoxb-* - Bot token (limited to channels where bot is invited)
See Creating a Slack API App for detailed setup instructions.
Claude Code Plugin
A Claude Code plugin is bundled with this repository, providing a skill that teaches Claude how to use the slack CLI autonomously.
# Install the slackcli CLI (if not already)
uv tool install -e .
# Add the marketplace and install the plugin
claude plugin marketplace add fprochazka/slackcli
claude plugin install slackcli@fprochazka-slackcli
To upgrade after a new release:
claude plugin marketplace update fprochazka-slackcli
claude plugin update slackcli@fprochazka-slackcli
Once installed, the skill auto-approves read-only commands (conversations list, messages list, search messages, users list, resolve, etc.). Write operations (messages send, messages edit, reactions add, etc.) still require manual approval.
Usage
Global Options
slack --org=myworkspace <command> # Use specific organization
slack --verbose <command> # Enable debug logging
slack --help # Show help
Environment Variables
| Variable | Description |
|---|
SLACK_ORG | Default organization name (alternative to --org) |
SLACK_CONFIG | Path to config file (alternative to --config) |
# Using environment variables
export SLACK_ORG=myworkspace
slack conversations list
# Or inline
SLACK_ORG=myworkspace slack conversations list
Conversations
# List all conversations (cached for 6 hours)
slack conversations list
# Filter by type
slack conversations list --public # Public channels only
slack conversations list --private # Private channels only
slack conversations list --dms # DMs and group DMs only
# Filter by membership
slack conversations list --member # Channels you're a member of
slack conversations list --non-member # Channels you're not a member of
# Force refresh cache
slack conversations list --refresh
Messages
# List messages in a channel (default: last 25 messages, i.e. --tail 25)
slack messages list '#general'
slack messages list C0123456789
# Direction flags
slack messages list '#general' --tail 5 # last 5 messages
slack messages list '#general' --head 5 # first 5 in window
slack messages list '#general' --after 1234567890.123456 # messages after cursor (default 25, override with --head N)
slack messages list '#general' --before 1234567890.123456 # messages before cursor (default 25, override with --tail N)
slack messages list '#general' --after 1234567890.123456 --head 5 # next 5 newer
slack messages list '#general' --before 1234567890.123456 --tail 5 # previous 5 older