Mattermost 集成

将 ClawdBot 连接到 Mattermost 团队平台

概述

Mattermost 是一个开源的团队协作平台,可以自托管。 非常适合对数据安全有要求的企业。通过集成 ClawdBot,你的团队可以 在 Mattermost 中使用 AI 助手。

自托管

数据存储在你的服务器

团队协作

整个团队共享 AI 助手

企业级

满足企业安全要求

创建 Bot

步骤 1: 启用 Bot 账户

  1. 登录 Mattermost 管理后台
  2. 进入 System Console → Integrations → Bot Accounts
  3. 启用 "Enable Bot Account Creation"

步骤 2: 创建 Bot

  1. 进入 Integrations → Bot Accounts
  2. 点击 "Add Bot Account"
  3. 填写信息:
    • Username: clawdbot
    • Display Name: ClawdBot AI
    • Role: 根据需要选择
  4. 保存后复制 Access Token

配置连接

配置文件

# ~/.clawdbot/config.yaml

channels:
  mattermost:
    enabled: true
    server_url: "https://mattermost.yourcompany.com"
    token: "your-bot-token"

    # 可选配置
    team: "your-team-name"
    default_channel: "town-square"

环境变量

export CLAWDBOT_MATTERMOST_URL="https://mattermost.yourcompany.com"
export CLAWDBOT_MATTERMOST_TOKEN="your-bot-token"
clawdbot gateway

验证连接

clawdbot channels list
clawdbot mattermost test

权限设置

Bot 角色

角色权限
Member发送消息、加入公开频道
System Admin访问所有频道、管理功能

频道限制

channels:
  mattermost:
    # 只在特定频道响应
    allowed_channels:
      - "ai-assistant"
      - "dev-team"

    # 需要 @mention 才响应
    require_mention: true

功能特性

  • 频道消息 - 在频道中 @mention 使用
  • 私信 - 直接与 Bot 对话
  • 文件处理 - 接收和发送文件
  • 线程回复 - 在消息线程中回复
  • Slash 命令 - 自定义斜杠命令

故障排查

连接失败

  • 检查 server_url 是否正确
  • 确认 token 有效
  • 验证网络可以访问 Mattermost 服务器

Bot 不响应

  • 确认 Bot 已被添加到频道
  • 检查 require_mention 设置
  • 查看日志:clawdbot logs