agent-slack by stablyai/agent-slack
npx skills add https://github.com/stablyai/agent-slack --skill agent-slackagent-slack 实现 Slack 自动化agent-slack 是 $PATH 上的一个 CLI 二进制文件。直接调用(例如 agent-slack user list)。
如果在 $PATH 上找不到 agent-slack,请安装它:
curl -fsSL https://raw.githubusercontent.com/stablyai/agent-slack/main/install.sh | sh(推荐)npm i -g agent-slack(需要 Node >= 22.5)nix run github:stablyai/agent-slack -- <args>(无需安装,在所有命令前加上此前缀)广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
Claude Code 的权限检查器具有安全启发式规则,会强制触发手动批准提示。避免以下模式以保持命令自动允许。参见:https://github.com/anthropics/claude-code/issues/34379
#。 即使在引号内,也会被视为注释分隔符。使用纯频道名称(用 general 而不是 #general)。内联脚本中不要使用 # 注释——请改用 Bash 工具的 description 参数。''(连续单引号)或 ""(连续双引号)。 这会触发“潜在混淆”检查。避免使用像 d.get('key', '') 这样的 Python 空字符串字面量——请改用 d.get('key')。| jq 进行过滤——不要使用 python3,不要使用其他命令。 python3 -c 不在允许列表中,会触发提示。仅使用单引号表达式(内部没有 ")的 jq 是安全的:
agent-slack search ... | python3 -c "..."(不允许)agent-slack search ... | jq '.a + "x"'(混合引号)agent-slack search ... | jq '.a'agent-slack search ... | jq '.messages[] | .ts'|| 或 && 链。 将多个 agent-slack 命令作为单独的 Bash 工具调用运行。>、>>)。 直接处理 JSON 输出,不要写入文件。在 macOS 和 Windows 上,认证是自动进行的(首选 Slack Desktop,然后在 macOS 上回退到 Chrome/Firefox)。
如果凭据不可用,请运行以下命令之一:
Slack Desktop 导入(macOS/Windows):
agent-slack auth import-desktop agent-slack auth test
Chrome 回退:
agent-slack auth import-chrome agent-slack auth test
Firefox 回退:
agent-slack auth import-firefox agent-slack auth test
或者设置环境变量(浏览器令牌;避免将这些粘贴到聊天日志中):
export SLACK_TOKEN="xoxc-..." export SLACK_COOKIE_D="xoxd-..." agent-slack auth test
或者设置标准令牌:
export SLACK_TOKEN="xoxb-..." # 或 xoxp-... agent-slack auth test
检查已配置的工作区:
agent-slack auth whoami
agent-slack message get "https://workspace.slack.com/archives/C123/p1700000000000000"
agent-slack message list "https://workspace.slack.com/archives/C123/p1700000000000000"
要查看频道中最近发布的内容(频道历史记录):
agent-slack message list "general" --limit 20
agent-slack message list "C0123ABC" --limit 10
agent-slack message list "general" --with-reaction eyes --oldest "1770165109.000000" --limit 20
agent-slack message list "general" --without-reaction dart --oldest "1770165109.000000" --limit 20
这将按时间顺序返回最新的消息。使用 --limit 控制返回数量(默认 25)。使用 --with-reaction 或 --without-reaction 时,还必须传递 --oldest 来限制扫描范围。
message get/list 和 search 会自动下载附件,并在 JSON 输出中包含文件元数据(通常在 message.files[] / files[] 下),包括可用的 name 和本地下载的 path。消息附件下载失败会保留附件条目,保留一个本地的 .download-error.txt 路径,并为 message get/list 包含 message.files[].error,或为 search messages|all 包含 messages[].files[].error;search files 会跳过下载失败的文件。
在浏览器中打开类似 Slack 的富文本编辑器,用于撰写带有格式工具栏(粗体、斜体、删除线、链接、列表、引用、代码、代码块)的消息。发送后,显示“在 Slack 中查看”链接。
agent-slack message draft "general"
agent-slack message draft "general" "initial text"
agent-slack message draft "https://workspace.slack.com/archives/C123/p1700000000000000"
agent-slack message send "https://workspace.slack.com/archives/C123/p1700000000000000" "I can take this."
agent-slack message send "alerts-staging" "here's the report" --attach ./report.md
agent-slack message edit "https://workspace.slack.com/archives/C123/p1700000000000000" "I can take this today."
agent-slack message delete "https://workspace.slack.com/archives/C123/p1700000000000000"
agent-slack message send "general" "Here's the plan:
- Step 1: do the thing
- Step 2: verify it worked
- Sub-step: check logs"
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"
编辑/删除的频道模式需要 --ts:
agent-slack message edit "general" "Updated text" --workspace "myteam" --ts "1770165109.628379"
agent-slack message delete "general" --workspace "myteam" --ts "1770165109.628379"
message send 的附件选项:
--attach <path> 上传本地文件(可重复)agent-slack channel list
agent-slack channel list --user "@alice" --limit 50
agent-slack channel list --all --limit 100
agent-slack channel new --name "incident-war-room"
agent-slack channel new --name "incident-leads" --private
agent-slack channel invite --channel "incident-war-room" --users "U01AAAA,@alice,bob@example.com"
agent-slack channel invite --channel "incident-war-room" --users "partner@vendor.com" --external
agent-slack channel invite --channel "incident-war-room" --users "partner@vendor.com" --external --allow-external-user-invites
对于 --external,邀请目标必须是电子邮件。默认情况下,被邀请者是外部受限的;添加 --allow-external-user-invites 以允许他们邀请其他用户。
为了可靠性,建议使用频道范围的搜索:
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
如果您配置了多个工作区,并且使用频道名称(例如 general),请传递 --workspace(或设置 SLACK_WORKSPACE_URL)以避免歧义:
agent-slack message get "general" --workspace "https://myteam.slack.com" --ts "1770165109.628379"
agent-slack message get "general" --workspace "myteam" --ts "1770165109.628379"
获取私信或群组私信的频道 ID,用于向一组用户发送消息:
agent-slack user dm-open @alice @bob
agent-slack user dm-open U01AAAA U02BBBB U03CCCC
将频道、私信或群组私信标记为已读到指定消息:
agent-slack channel mark "https://workspace.slack.com/archives/C123/p1700000000000000"
agent-slack channel mark "general" --workspace "myteam" --ts "1770165109.628379"
agent-slack channel mark "D0A04PB2QBW" --workspace "myteam" --ts "1770165109.628379"
要使特定消息显示为未读,请将 --ts 设置为其之前的值(减去 0.000001)。这将移动已读游标,使该消息及其之后的所有内容显示为新消息:
agent-slack channel mark "general" --workspace "myteam" --ts "1770165109.628378"
发现并运行在频道中书签的 Slack 工作流:
# 列出频道中的工作流
agent-slack workflow list "#ops"
# 预览触发器元数据(无副作用)
agent-slack workflow preview "Ft123ABC"
# 获取工作流定义,包括表单字段和步骤
agent-slack workflow get "Ft123ABC"
agent-slack workflow get "Wf456DEF"
# 触发工作流触发器
agent-slack workflow run "Ft123ABC" --channel "#ops"
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"
#channel 定位规则每周安装次数
829
代码仓库
GitHub 星标数
354
首次出现时间
2026年2月5日
安全审计
安装于
codex720
opencode718
gemini-cli614
github-copilot612
amp593
kimi-cli593
agent-slackagent-slack is a CLI binary on $PATH. Invoke directly (e.g. agent-slack user list).
If agent-slack is not found on $PATH, install it:
curl -fsSL https://raw.githubusercontent.com/stablyai/agent-slack/main/install.sh | sh (recommended)npm i -g agent-slack (requires Node >= 22.5)nix run github:stablyai/agent-slack -- <args> (no install needed, prefix all commands)Claude Code's permission checker has security heuristics that force manual approval prompts. Avoid these patterns to keep commands auto-allowed. See: https://github.com/anthropics/claude-code/issues/34379
# anywhere in the command string. Treated as a comment delimiter even inside quotes. Use bare channel names (general not #general). No # comments in inline scripts — use the Bash tool's description parameter instead.'' (consecutive single quotes) or "" (consecutive double quotes). Triggers "potential obfuscation" check. Avoid Python empty string literals like d.get('key', '') — use d.get('key') instead.| jq for filtering — no python3, no other commands. is not in the allow list and triggers prompts. with single-quote-only expressions (no inside) is safe:
Authentication is automatic on macOS and Windows (Slack Desktop first, then Chrome/Firefox fallbacks on macOS).
If credentials aren’t available, run one of:
Slack Desktop import (macOS/Windows):
agent-slack auth import-desktop agent-slack auth test
Chrome fallback:
agent-slack auth import-chrome agent-slack auth test
Firefox fallback:
agent-slack auth import-firefox 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
agent-slack message get "https://workspace.slack.com/archives/C123/p1700000000000000"
agent-slack message list "https://workspace.slack.com/archives/C123/p1700000000000000"
To see what's been posted recently in a channel (channel history):
agent-slack message list "general" --limit 20
agent-slack message list "C0123ABC" --limit 10
agent-slack message list "general" --with-reaction eyes --oldest "1770165109.000000" --limit 20
agent-slack message list "general" --without-reaction dart --oldest "1770165109.000000" --limit 20
This returns the most recent messages in chronological order. Use --limit to control how many (default 25). When using --with-reaction or --without-reaction, you must also pass --oldest to bound scanning.
message get/list and search auto-download attachments and include file metadata in JSON output (typically under message.files[] / files[]), including name when available and path for the local download. Failed message attachment downloads keep the attachment entry, preserve a local .download-error.txt path, and include message.files[].error for message get/list or messages[].files[].error for search messages|all; skips files whose download fails.
Opens a Slack-like rich-text editor in the browser for composing messages with formatting toolbar (bold, italic, strikethrough, links, lists, quotes, code, code blocks). After sending, shows a "View in Slack" link.
agent-slack message draft "general"
agent-slack message draft "general" "initial text"
agent-slack message draft "https://workspace.slack.com/archives/C123/p1700000000000000"
agent-slack message send "https://workspace.slack.com/archives/C123/p1700000000000000" "I can take this."
agent-slack message send "alerts-staging" "here's the report" --attach ./report.md
agent-slack message edit "https://workspace.slack.com/archives/C123/p1700000000000000" "I can take this today."
agent-slack message delete "https://workspace.slack.com/archives/C123/p1700000000000000"
agent-slack message send "general" "Here's the plan:
- Step 1: do the thing
- Step 2: verify it worked
- Sub-step: check logs"
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"
Channel mode for edit/delete requires --ts:
agent-slack message edit "general" "Updated text" --workspace "myteam" --ts "1770165109.628379"
agent-slack message delete "general" --workspace "myteam" --ts "1770165109.628379"
Attach options for message send:
--attach <path> upload a local file (repeatable)agent-slack channel list
agent-slack channel list --user "@alice" --limit 50
agent-slack channel list --all --limit 100
agent-slack channel new --name "incident-war-room"
agent-slack channel new --name "incident-leads" --private
agent-slack channel invite --channel "incident-war-room" --users "U01AAAA,@alice,bob@example.com"
agent-slack channel invite --channel "incident-war-room" --users "partner@vendor.com" --external
agent-slack channel invite --channel "incident-war-room" --users "partner@vendor.com" --external --allow-external-user-invites
For --external, invite targets must be emails. By default, invitees are external-limited; add --allow-external-user-invites to allow them to invite other users.
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
If you have multiple workspaces configured and you use a channel name (e.g. general), pass --workspace (or set SLACK_WORKSPACE_URL) to avoid ambiguity:
agent-slack message get "general" --workspace "https://myteam.slack.com" --ts "1770165109.628379"
agent-slack message get "general" --workspace "myteam" --ts "1770165109.628379"
Get the channel ID for a DM or group DM, useful for sending messages to a group of users:
agent-slack user dm-open @alice @bob
agent-slack user dm-open U01AAAA U02BBBB U03CCCC
Mark a channel, DM, or group DM as read up to a given message:
agent-slack channel mark "https://workspace.slack.com/archives/C123/p1700000000000000"
agent-slack channel mark "general" --workspace "myteam" --ts "1770165109.628379"
agent-slack channel mark "D0A04PB2QBW" --workspace "myteam" --ts "1770165109.628379"
To make a specific message appear unread, set --ts to just before it (subtract 0.000001). This moves the read cursor so that message and everything after it appear as new:
agent-slack channel mark "general" --workspace "myteam" --ts "1770165109.628378"
Discover and run Slack workflows bookmarked in channels:
# List workflows in a channel
agent-slack workflow list "#ops"
# Preview trigger metadata (no side effects)
agent-slack workflow preview "Ft123ABC"
# Get workflow definition including form fields and steps
agent-slack workflow get "Ft123ABC"
agent-slack workflow get "Wf456DEF"
# Trip a workflow trigger
agent-slack workflow run "Ft123ABC" --channel "#ops"
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"
#channel targeting rulesWeekly Installs
829
Repository
GitHub Stars
354
First Seen
Feb 5, 2026
Security Audits
Gen Agent Trust HubFailSocketWarnSnykFail
Installed on
codex720
opencode718
gemini-cli614
github-copilot612
amp593
kimi-cli593
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
140,500 周安装
python3 -cjq"agent-slack search ... | python3 -c "..." (not allowed)agent-slack search ... | jq '.a + "x"' (mixed quotes)agent-slack search ... | jq '.a'agent-slack search ... | jq '.messages[] | .ts'|| or && chains. Run multiple agent-slack commands as separate Bash tool calls.>, >>). Process JSON output directly, don't write to files.search files