Slack automation with agent-slack
Quick start (auth)
Authentication is automatic on macOS (Slack Desktop first, then Chrome fallback).
If credentials aren’t available, run one of:
- •Slack Desktop (default):
agent-slack auth import-desktop agent-slack auth test
- •Chrome fallback:
agent-slack auth import-chrome agent-slack auth test
- •Or set env vars (browser tokens; avoid pasting these into chat logs):
export SLACK_TOKEN="xoxc-..." export SLACK_COOKIE_D="xoxd-..." agent-slack auth test
- •Or set a standard token:
export SLACK_TOKEN="xoxb-..." # or xoxp-... agent-slack auth test
Check configured workspaces:
agent-slack auth whoami
Canonical workflow (given a Slack message URL)
- •Fetch a single message (plus thread summary, if any):
agent-slack message get "https://workspace.slack.com/archives/C123/p1700000000000000"
- •If you need the full thread:
agent-slack message list "https://workspace.slack.com/archives/C123/p1700000000000000"
Attachments (snippets/images/files)
message get/list and search auto-download attachments and include absolute paths in JSON output (typically under message.files[].path / files[].path).
Reply or react (does the right thing)
agent-slack message send "https://workspace.slack.com/archives/C123/p1700000000000000" "I can take this." agent-slack message react add "https://workspace.slack.com/archives/C123/p1700000000000000" "eyes" agent-slack message react remove "https://workspace.slack.com/archives/C123/p1700000000000000" "eyes"
Search (messages + files)
Prefer channel-scoped search for reliability:
agent-slack search all "smoke tests failed" --channel "#alerts" --after 2026-01-01 --before 2026-02-01 agent-slack search messages "stably test" --user "@alice" --channel general agent-slack search files "testing" --content-type snippet --limit 10
Multi-workspace guardrail (important)
If you have multiple workspaces configured and you use a channel name (#general / general), pass --workspace (or set SLACK_WORKSPACE_URL) to avoid ambiguity:
agent-slack message get "#general" --workspace "https://myteam.slack.com" --ts "1770165109.628379"
Canvas + Users
agent-slack canvas get "https://workspace.slack.com/docs/T123/F456" agent-slack user list --workspace "https://workspace.slack.com" --limit 100 agent-slack user get "@alice" --workspace "https://workspace.slack.com"
References
- •references/commands.md: full command map + all flags
- •references/targets.md: URL vs
#channeltargeting rules - •references/output.md: JSON output shapes + download paths