Mattermost(插件)
状态:通过插件支持(机器人令牌 + WebSocket 事件)。支持频道、群组和私聊�? Mattermost 是一个可自托管的团队消息平台;请参阅官方网站 mattermost.com 获取产品详情和下载�?
需要插�?
Mattermost 作为插件提供,不随核心安装一起打包�?
通过 CLI 安装(npm 注册表)�?
openclaw plugins install @openclaw/mattermost
本地检出(�?git 仓库运行时)�?
openclaw plugins install ./extensions/mattermost
如果�?configure/onboarding 期间选择 Mattermost 并检测到 git 检出, OpenClaw 将自动提供本地安装路径�?
详情:Plugins
快速设�?
- 安装 Mattermost 插件�?
- 创建 Mattermost 机器人账户并复制**机器人令�?*�?
- 复制 Mattermost 基础 URL(例�?
https://chat.example.com)�? - 配置 OpenClaw 并启动网关�?
最小配置:
{
channels: {
mattermost: {
enabled: true,
botToken: "mm-token",
baseUrl: "https://chat.example.com",
dmPolicy: "pairing",
},
},
}
环境变量(默认账户)
如果你更喜欢环境变量,请在网关主机上设置�?
MATTERMOST_BOT_TOKEN=...MATTERMOST_URL=https://chat.example.com
环境变量仅适用�?*默认**账户(default)。其他账户必须使用配置值�?
聊天模式
Mattermost 自动回复私聊。频道行为由 chatmode 控制�?
oncall(默认):仅在频道中�?@提及时回复�?onmessage:回复每条频道消息�?onchar:当消息以触发前缀开头时回复�?
配置示例�?
{
channels: {
mattermost: {
chatmode: "onchar",
oncharPrefixes: [">", "!"],
},
},
}
注意事项�?
onchar仍然会回复显式的 @提及�?- 旧配置支�?
channels.mattermost.requireMention,但优先使用chatmode�?
访问控制(私聊)
- 默认:
channels.mattermost.dmPolicy = "pairing"(未知发送者获得配对代码)�? - 通过以下方式批准�?
openclaw pairing list mattermostopenclaw pairing approve mattermost <CODE>
- 公开私聊:
channels.mattermost.dmPolicy="open"加上channels.mattermost.allowFrom=["*"]�?
频道(群组)
- 默认:
channels.mattermost.groupPolicy = "allowlist"(提及门控)�? - 使用
channels.mattermost.groupAllowFrom允许列表发送者(推荐用户 ID)�? @username匹配是可变的,仅�?channels.mattermost.dangerouslyAllowNameMatching: true时启用�?- 开放频道:
channels.mattermost.groupPolicy="open"(提及门控)�? - 运行时注意:如果完全缺少
channels.mattermost,运行时将回退�?groupPolicy="allowlist"进行群组检查(即使设置�?channels.defaults.groupPolicy)�?
出站传递目�?
将这些目标格式与 openclaw message send �?cron/webhook 一起使用:
channel:<id>用于频道user:<id>用于私聊@username用于私聊(通过 Mattermost API 解析�?
�?ID 被视为频道�?
反应(消息工具)
- 使用
message action=react并设�?channel=mattermost�? messageId�?Mattermost 帖子 ID�?emoji接受thumbsup�?:+1:这样的名称(冒号可选)�?- 设置
remove=true(布尔值)以移除反应�? - 反应添加/移除事件作为系统事件转发到路由的智能体会话�?
示例�?
message action=react channel=mattermost target=channel:<channelId> messageId=<postId> emoji=thumbsup
message action=react channel=mattermost target=channel:<channelId> messageId=<postId> emoji=thumbsup remove=true
配置�?
channels.mattermost.actions.reactions:启�?禁用反应操作(默�?true)�?- 每个账户覆盖:
channels.mattermost.accounts.<id>.actions.reactions�?
多账�?
Mattermost 支持�?channels.mattermost.accounts 下配置多个账户:
{
channels: {
mattermost: {
accounts: {
default: { name: "Primary", botToken: "mm-token", baseUrl: "https://chat.example.com" },
alerts: { name: "Alerts", botToken: "mm-token-2", baseUrl: "https://alerts.example.com" },
},
},
},
}
故障排除
- 频道中没有回复:确保机器人在频道中并提及它(oncall),使用触发前缀(onchar),或设�?
chatmode: "onmessage"�? - 认证错误:检查机器人令牌、基础 URL,以及账户是否已启用�?
- 多账户问题:环境变量仅适用�?
default账户�?