跳到主要内容

Slack 设置

使用 Socket Mode 将 Hermes Agent 连接到 Slack。Socket Mode 使用 WebSocket 而不是公共 HTTP 端点,无需公开访问即可工作。

创建 Slack 应用

  1. 进入 api.slack.com/apps 创建新应用
  2. OAuth & Permissions 添加 Bot Token Scopes:chat:writeapp_mentions:readchannels:historychannels:readgroups:historyim:historyim:readim:writeusers:readfiles:readfiles:write
  3. Settings → Socket Mode 启用 Socket Mode,创建 App-Level Token
  4. Features → Event Subscriptions 启用事件,订阅 message.immessage.channelsmessage.groupsapp_mention
  5. Features → App Home 启用 Messages Tab
  6. 安装应用到工作区获取 Bot Token

配置

SLACK_BOT_TOKEN=xoxb-your-bot-token
SLACK_APP_TOKEN=xapp-your-app-token
SLACK_ALLOWED_USERS=U01ABC2DEF3
hermes gateway setup # 选择 Slack

机器人行为

  • DM:响应所有消息,无需 @mention
  • 频道:需要 @mention 才响应,在线程中回复
  • 线程:回复在同一线程中,无需再次 @mention

配置选项

platforms:
slack:
reply_to_mode: "first" # off/first/all
extra:
reply_in_thread: true
reply_broadcast: false
group_sessions_per_user: true

故障排除

问题解决方案
DM 不响应检查 message.im 事件订阅
频道不响应添加 message.channels/message.groups,重新安装应用,邀请机器人
"missing_scope"添加 scope 后重新安装应用

更多信息请参阅 安全指南