Slack 通道
通过 Slack 与 Moltbot 进行交互,接收消息、发送回复和管理频道。
配置
先决条件
- Slack App(具有 Bot Token)
- 必要的权限:
channels:historychannels:readchat:writeim:historympim:historyusers:read
创建 Slack App
- 访问 Slack API
- 点击 "Create New App" → "From scratch"
- 选择工作区并命名应用
- 在 "OAuth & Permissions" 添加上述权限
- 安装应用到工作区
添加通道
bash
moltbot channels add --channel slack --account default --token xoxb-your-bot-token使用
发送消息
bash
moltbot message send --channel slack --target "#general" --message "Hello from Moltbot!"回复线程
bash
moltbot message thread reply --channel slack --target C12345678 --thread-ts 1234567890.123456 --message "Reply in thread"频道操作
bash
# 获取频道信息
moltbot message channel info --channel slack --target C12345678
# 列出可用的频道
moltbot message channel list --channel slack功能
消息类型支持
- 文本消息 ✅
- 代码块 ✅
- 表情反应 ✅
- 附件 ✅
- 线程回复 ✅
- 斜杠命令 ✅
- 消息编辑 ✅
- 消息删除 ✅
限制
- 每条消息最大 4000 字符
- 文件上传需额外配置
- 某些高级功能需要特定权限
故障排除
机器人未响应
bash
# 检查通道状态
moltbot channels status --channel slack
# 查看通道日志
moltbot channels logs --channel slack权限错误
确保 Bot Token 具有以下 scopes:
channels:historychannels:readchat:writeim:historympim:historyusers:read