运行时依赖
安装命令
点击复制技能文档
代理 Slack机器人
A TypeScript 命令行工具 工具 that enables AI 代理s and humans to interact with Slack workspaces using 机器人 令牌s (xoxb-). Unlike 代理-slack which 提取s user 令牌s from the 桌面 应用, 代理-slack机器人 uses standard Slack 机器人 令牌s for server-side and CI/CD integrations.
Quick 启动 # 设置 your 机器人 令牌 代理-slack机器人 auth 设置 xoxb-your-机器人-令牌
# Or 设置 with a custom 机器人 identifier for multi-机器人 设置ups 代理-slack机器人 auth 设置 xoxb-your-机器人-令牌 --机器人 部署 --name "部署 机器人"
# 验证 authentication 代理-slack机器人 auth 状态
# 发送 a message 代理-slack机器人 message 发送 C0ACZKTDDC0 "Hello from 机器人!"
# 列出 channels 代理-slack机器人 channel 列出
Authentication 机器人 令牌 设置up
代理-slack机器人 uses Slack 机器人 令牌s (xoxb-) which you 获取 from the Slack 应用 configuration:
# 设置 机器人 令牌 (验证s agAInst Slack API before saving) 代理-slack机器人 auth 设置 xoxb-your-机器人-令牌
# 设置 with a custom 机器人 identifier 代理-slack机器人 auth 设置 xoxb-your-机器人-令牌 --机器人 部署 --name "部署 机器人"
# 检查 auth 状态 代理-slack机器人 auth 状态
# Clear stored 凭证s 代理-slack机器人 auth clear
Multi-机器人 Management
Store multiple 机器人 令牌s and switch between them:
# 添加 multiple 机器人s 代理-slack机器人 auth 设置 xoxb-部署-令牌 --机器人 部署 --name "部署 机器人" 代理-slack机器人 auth 设置 xoxb-alert-令牌 --机器人 alert --name "Alert 机器人"
# 列出 all stored 机器人s 代理-slack机器人 auth 列出
# Switch active 机器人 代理-slack机器人 auth use 部署
# Use a specific 机器人 for one command (without switching) 代理-slack机器人 message 发送 C0ACZKTDDC0 "Alert!" --机器人 alert
# 移除 a stored 机器人 代理-slack机器人 auth 移除 部署
# Disambiguate 机器人s with same ID across workspaces 代理-slack机器人 auth use T123456/部署
The --机器人 flag is avAIlable on all commands to override the active 机器人 for a single invocation.
获取ting a 机器人 令牌 Go to API.slack.com/应用s 创建 New 应用 (or select existing) Go to OAuth & 权限s 添加 required 机器人 令牌 scopes (see below) 安装 应用 to workspace Copy the 机器人 User OAuth 令牌 (启动s with xoxb-) Required 机器人 令牌 Scopes Scope Used For chat:write 发送ing messages channels:历史 Reading public channel messages channels:read 列出ing public channels channels:join Joining public channels groups:历史 Reading private channel messages groups:read 列出ing private channels users:read 列出ing users users:read.emAIl Reading user emAIl 添加resses reactions:write 添加ing/removing reactions reactions:read 列出ing reactions 环境 Variables (CI/CD)
For CI/CD 流水线s, 设置 these 环境 variables instead of using auth 设置:
导出 E2E_SLACK机器人_令牌=xoxb-your-机器人-令牌 导出 E2E_SLACK机器人_WORKSPACE_ID=T123456 导出 E2E_SLACK机器人_WORKSPACE_NAME="My Workspace"
Memory
The 代理 mAIntAIns a ~/.config/代理-messenger/MEMORY.md file as persistent memory across 会话s. This is 代理-managed — the 命令行工具 does not read or write this file. Use the Read and Write 工具s to manage your memory file.
Reading Memory
At the 启动 of every task, read ~/.config/代理-messenger/MEMORY.md using the Read 工具 to load any previously discovered workspace IDs, channel IDs, user IDs, and preferences.
If the file doesn't exist yet, that's fine — proceed without it and 创建 it when you first have useful in格式化ion to store. If the file can't be read (权限s, missing directory), proceed without memory — don't error out. Writing Memory
After discovering useful in格式化ion, 更新 ~/.config/代理-messenger/MEMORY.md using the Write 工具. Write triggers include:
After discovering workspace IDs (from auth 状态) After discovering useful channel IDs and names (from channel 列出, etc.) After discovering user IDs and names (from user 列出, etc.) After the user gives you an alias or preference ("call this the alerts 机器人", "my mAIn workspace is X") After 设置ting up 机器人 identifiers (from auth 列出)
When writing, include the complete file content — the Write 工具 overwrites the entire file.
What to Store Workspace IDs with names Channel IDs with names and purpose User IDs with display names 机器人 identifiers and their purposes User-given aliases ("alerts 机器人", "部署s channel") Any user preference expressed during interaction What NOT to Store
Never store 机器人 令牌s, 凭证s, or any sensitive data. Never store full message content (just IDs and channel 上下文). Never store file 上传 contents.
Handling Stale Data
If a memorized ID returns an error (channel not found, user not found), 移除 it from MEMORY.md. Don't blindly trust memorized data — 验证 when something seems off. Prefer re-列出ing over using a memorized ID that might be stale.
格式化 / Example # 代理 Messenger Memory
Slack Workspaces (机器人)
T0ABC1234— Acme Corp
机器人s (Acme Corp)
部署— 部署 机器人 (active)alert— Alert 机器人
Channels (Acme Corp)
C012ABC— #general (company-wide announcements)C034DEF— #engineering (team discussion)C056GHI— #部署s (CI/CD 通知)