Your AI agent can read your repo, run your tests, and open a pull request. Then it hits a wall. The context it needs is in Slack: the incident thread, the decision nobody wrote down, the "we changed the deploy order last week" message.
Getting an agent into Slack normally means building a Slack app, picking OAuth scopes, and waiting for an admin to approve it. That is a lot of work before the first useful message.
** SlackCLI** is a different path. It is a single open source binary that talks to Slack from your terminal, and every read command speaks JSON. If your agent can run a shell command, it can use Slack.
SlackCLI is an unofficial project. It is not affiliated with or supported by Slack Technologies.
brew tap shaharia-lab/tap
brew install slackcli
slackcli auth login-auto
login-auto
opens a browser, you sign in to Slack the way you always do, and SlackCLI captures the session tokens for every workspace on that account. Nothing leaves your machine. Credentials land in ~/.config/slackcli/workspaces.json
with file mode 0600
.
Prefer a real bot token for a server or a CI job? That works too:
slackcli auth login --token=xoxb-your-token --workspace-name="My Team"
Now try something:
slackcli conversations unread
Demo: https://github.com/shaharia-lab/slackcli#-see-it-in-action
Sign in, browse conversations, search the workspace, read a thread from a permalink, reply, react, read a Canvas as Markdown, and pipe --json
into jq
. All from the terminal.
Most agent frameworks are happiest when a tool is a plain command with plain output. SlackCLI is built exactly that way.
--json
, so the agent gets structured data instead of screen scraping.0
on success, 1
on failure. An empty search result is still a success, so check the data, not the exit code.--workspace=automation-bot
to any command to pick an identity on purpose.
slackcli conversations unread --json | jq '[.unread_channels[] | {name, unread_count}]'
Feed that to a model and you have a morning digest.
slackcli conversations read --permalink="$LINK" --json | jq -r '.messages[].text'
The JSON also carries a resolved users
array, so user IDs are not opaque.
slackcli search messages "deploy failed" --in=engineering --limit=50 --json
All of Slack's own search operators work: in:
, from:
, before:
, after:
, has:
, is:
.
slackcli search channels incident --json
slackcli search people "ada@example.com" --json
slackcli messages send --permalink="$LINK" --message="Root cause found, fix is in #4821"
Passing a permalink replies in that thread, so no ID juggling is needed.
slackcli messages send \
--recipient-id=C1234567890 \
--message="Nightly build report" \
--blocks='[{"type":"markdown","text":"# Nightly build\n\n- [x] Build\n- [x] Tests\n- [ ] Deploy"}]'
Native Block Kit markdown
and table
blocks mean headings, task lists, code fences, and real tables instead of a wall of text.
slackcli canvas read F1234567890 --json | jq -r '.markdown'
Team runbooks and specs often live in a Canvas. Now they are just Markdown your agent can read.
You do not need an SDK or an MCP server. Give the agent shell access and one short instruction block:
You can use the `slackcli` command to work with Slack.
Read commands (always add --json):
slackcli conversations unread --json
slackcli conversations read <channel-id|--permalink=URL> --json
slackcli search messages "<query>" --in=<channel> --json
slackcli canvas read <file-id> --json
Write commands (ask me first):
slackcli messages send --permalink=<url> --message="<text>"
slackcli messages react --permalink=<url> --emoji=<name>
Run `slackcli <group> --help` if you need the exact options.
That is the whole integration. A useful first prompt:
Read the last 50 messages in #incidents, find any unresolved issue from today, and draft a summary for me. Do not post it yet.
Because slackcli <group> --help
prints the authoritative options for the installed version, an agent can discover the rest on its own.
Slack access is real access, so a few rules are worth setting up front.
~/.config/slackcli/workspaces.json
and the browser profile hold live credentials. Do not commit them, sync them, or copy them around. slackcli auth logout
clears both.slackcli auth login-auto --headless
renews them in an unattended job once the profile has signed in once.
brew tap shaharia-lab/tap
brew install slackcli
slackcli auth login-auto
slackcli conversations unread
SlackCLI is MIT licensed, built with Bun, and ships prebuilt binaries for macOS, Linux, and Windows. It has over 400 tests and a full user guide.
** ⭐ Star it on GitHub** if it saves you a trip to the Slack tab, and tell me in the comments what you would want your agent to do in Slack. Feature requests start as