agent-slack
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSlack automation with agent-slack
agent-slack基于agent-slack
的Slack自动化
agent-slackagent-slack$PATHagent-slack user listagent-slack$PATHagent-slack user listQuick start (auth)
快速开始(认证)
Authentication is automatic on macOS (Slack Desktop first, then Chrome fallback).
If credentials aren’t available, run one of:
- Slack Desktop (default):
bash
agent-slack auth import-desktop
agent-slack auth test- Chrome fallback:
bash
agent-slack auth import-chrome
agent-slack auth test- Or set env vars (browser tokens; avoid pasting these into chat logs):
bash
export SLACK_TOKEN="xoxc-..."
export SLACK_COOKIE_D="xoxd-..."
agent-slack auth test- Or set a standard token:
bash
export SLACK_TOKEN="xoxb-..." # or xoxp-...
agent-slack auth testCheck configured workspaces:
bash
agent-slack auth whoami在macOS系统上认证是自动完成的(优先使用Slack桌面客户端,其次是Chrome浏览器作为备选)。
如果无法获取凭证,请运行以下命令之一:
- Slack桌面客户端(默认方式):
bash
agent-slack auth import-desktop
agent-slack auth test- Chrome浏览器备选方案:
bash
agent-slack auth import-chrome
agent-slack auth test- 或者设置环境变量(浏览器令牌;请勿将这些内容粘贴到聊天记录中):
bash
export SLACK_TOKEN="xoxc-..."
export SLACK_COOKIE_D="xoxd-..."
agent-slack auth test- 或者设置标准令牌:
bash
export SLACK_TOKEN="xoxb-..." # 或xoxp-...
agent-slack auth test查看已配置的工作区:
bash
agent-slack auth whoamiCanonical workflow (given a Slack message URL)
标准工作流(给定Slack消息URL)
- Fetch a single message (plus thread summary, if any):
bash
agent-slack message get "https://workspace.slack.com/archives/C123/p1700000000000000"- If you need the full thread:
bash
agent-slack message list "https://workspace.slack.com/archives/C123/p1700000000000000"- 获取单条消息(如有线程则包含线程摘要):
bash
agent-slack message get "https://workspace.slack.com/archives/C123/p1700000000000000"- 如果需要完整线程内容:
bash
agent-slack message list "https://workspace.slack.com/archives/C123/p1700000000000000"Attachments (snippets/images/files)
附件(代码片段/图片/文件)
message get/listsearchmessage.files[].pathfiles[].pathmessage get/listsearchmessage.files[].pathfiles[].pathReply or react (does the right thing)
回复或添加反应(智能适配场景)
bash
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"bash
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:
bash
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建议使用频道范围的搜索以确保可靠性:
bash
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 10Multi-workspace guardrail (important)
多工作区防护机制(重要)
If you have multiple workspaces configured and you use a channel name ( / ), pass (or set ) to avoid ambiguity:
#generalgeneral--workspaceSLACK_WORKSPACE_URLbash
agent-slack message get "#general" --workspace "https://myteam.slack.com" --ts "1770165109.628379"如果您配置了多个工作区,且使用频道名称( / ),请传递参数(或设置环境变量)以避免歧义:
#generalgeneral--workspaceSLACK_WORKSPACE_URLbash
agent-slack message get "#general" --workspace "https://myteam.slack.com" --ts "1770165109.628379"Canvas + Users
Canvas与用户管理
bash
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"bash
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 targeting rules
#channel - references/output.md: JSON output shapes + download paths
- references/commands.md:完整命令映射及所有参数说明
- references/targets.md:URL与目标定位规则
#channel - references/output.md:JSON输出格式及下载路径说明