A Slack CLI designed for coding agents (Claude Code, Cursor, etc.) that provides structured JSON access to Slack workspaces via the Web API.
It works by extracting authentication tokens from your existing browser session — no Slack app or bot token required.
npm:
npm install -g @alankyshum/slack-clipip:
pip install slack-cli-agentManual:
git clone https://github.com/alankyshum/slack-cli.git
chmod +x slack-cli/bin/slack-cli
ln -s "$(pwd)/slack-cli/bin/slack-cli" ~/.local/bin/slack-clicurlandjq(for all commands)python3(for URL encoding)- Node.js + Playwright (only for
authcommand)
npm install -g playwright
npx playwright install chromium# 1. Authenticate (opens browser to extract tokens)
slack-cli auth --domain mycompany.slack.com
# 2. Search messages
slack-cli search "from:@alice in:#engineering deployment"
# 3. Read channel history
slack-cli read engineering 10
# 4. Draft a message (saved locally, not sent)
slack-cli draft general "Hey team, the fix for JIRA-123 is ready"| Command | Description |
|---|---|
auth --domain <dom> |
Extract tokens from browser session |
whoami |
Show authenticated user |
config |
Show current configuration |
search <query> |
Search messages (full Slack query syntax) |
read <channel> [count] |
Read channel messages |
unreads |
Show recent activity |
draft <channel> <msg> [--thread <ts>] [--file <path>] |
Save a server-side draft |
draft-delete <draft_id> |
Delete a server-side draft |
drafts |
List saved drafts |
send <draft_id> |
Send a draft (with confirmation prompt) |
post <channel> <msg> [--thread <ts>] [--file <path>] |
Send a message with mrkdwn formatting |
channels |
List your channels |
dms |
List recent DMs |
userinfo <user> |
Look up user by ID, email, or name |
status [emoji] [text] |
Get or set your Slack status (clear to remove) |
| `presence [user_id | username |
Slack's full search syntax is supported:
| Modifier | Example | Description |
|---|---|---|
from: |
from:@alice / from:me |
Messages from a person |
in: |
in:#channel / in:@user |
Messages in channel or DM |
before: |
before:2025-06-01 |
Before a date |
after: |
after:2025-01-01 |
After a date |
on: |
on:2025-03-15 |
On exact date |
during: |
during:january |
During a month or year |
has: |
has::eyes: / has:pin |
Has reaction or pin |
is: |
is:saved / is:thread |
Saved or thread messages |
"..." |
"exact phrase" |
Exact phrase match |
- |
-word |
Exclude word |
* |
deploy* |
Wildcard (min 3 chars) |
| Variable | Default | Description |
|---|---|---|
SLACK_CLI_HOME |
~/.slack-cli |
Config directory |
SLACK_CLI_CHROME_PROFILE |
~/.slack-cli/chrome-profile |
Chrome profile for auth |
SLACK_CLI_COUNT |
20 |
Results per page |
SLACK_CLI_SORT |
timestamp |
Sort: timestamp or score |
SLACK_CLI_SORT_DIR |
desc |
Direction: asc or desc |
-
authopens a Chromium browser using your existing Chrome profile (via Playwright), navigates to your Slack workspace, and intercepts thexoxc-API token andxoxd-session cookie from live API requests. -
All other commands use direct Slack Web API calls via
curl— no browser needed, making them fast and suitable for automation. -
Drafts are saved locally to
~/.slack-cli/drafts.json. Thesendcommand requires interactive confirmation before posting. -
All output is structured JSON, making it easy to parse with
jqor consume from AI agents.
- Credentials are stored at
~/.slack-cli/credentials.jsonwith600permissions - Tokens are
xoxc-client tokens scoped to your user session - The
sendcommand requires explicityconfirmation - No data is sent to any third party
MIT