Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 43 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ That's it! You have a working AI assistant in 2 minutes.

## 💬 Chat Apps

Talk to your picoclaw through Telegram, Discord, WhatsApp, Matrix, QQ, DingTalk, LINE, or WeCom
Talk to your picoclaw through Telegram, Discord, WhatsApp, Matrix, Mattermost, QQ, DingTalk, LINE, or WeCom

> **Note**: All webhook-based channels (LINE, WeCom, etc.) are served on a single shared Gateway HTTP server (`gateway.host`:`gateway.port`, default `127.0.0.1:18790`). There are no per-channel ports to configure. Note: Feishu uses WebSocket/SDK mode and does not use the shared HTTP webhook server.

Expand All @@ -321,6 +321,7 @@ Talk to your picoclaw through Telegram, Discord, WhatsApp, Matrix, QQ, DingTalk,
| **QQ** | Easy (AppID + AppSecret) |
| **DingTalk** | Medium (app credentials) |
| **LINE** | Medium (credentials + webhook URL) |
| **Mattermost** | Easy (bot token) |
| **WeCom AI Bot** | Medium (Token + AES key) |

<details>
Expand Down Expand Up @@ -436,6 +437,47 @@ picoclaw gateway

</details>

<details>
<summary><b>Mattermost</b></summary>

**1. Create a bot account**

* Go to your Mattermost instance → Integrations → Bot Accounts → Add Bot Account
* Copy the bot token

**2. Configure**

```json
{
"channels": {
"mattermost": {
"enabled": true,
"url": "https://your-mattermost-server.com",
"token": "YOUR_BOT_TOKEN",
"username": "picoclaw",
"reply_in_thread": true,
"allow_from": ["YOUR_USER_ID"]
}
}
}
```

| Field | Type | Required | Description |
| ---------------- | ------ | -------- | ----------------------------------------------- |
| enabled | bool | Yes | Enable Mattermost channel |
| url | string | Yes | Mattermost server URL |
| token | string | Yes | Bot access token |
| username | string | No | Bot username for @mention stripping |
| reply_in_thread | bool | No | Auto-thread replies in channels (default: true) |
| allow_from | array | No | User ID allowlist (empty = allow all) |
| group_trigger | object | No | Group trigger config (mention_only, etc.) |
| typing | object | No | Typing indicator config (enabled, etc.) |
| placeholder | object | No | Placeholder config (enabled, text; default: "Thinking... 💭") |

**3. Add the bot to channels** in Mattermost, then DM it or @mention it.

</details>

<details>
<summary><b>WhatsApp</b> (native via whatsmeow)</summary>

Expand Down
1 change: 1 addition & 0 deletions cmd/picoclaw/internal/gateway/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
_ "github.com/sipeed/picoclaw/pkg/channels/line"
_ "github.com/sipeed/picoclaw/pkg/channels/maixcam"
_ "github.com/sipeed/picoclaw/pkg/channels/matrix"
_ "github.com/sipeed/picoclaw/pkg/channels/mattermost"
_ "github.com/sipeed/picoclaw/pkg/channels/onebot"
_ "github.com/sipeed/picoclaw/pkg/channels/pico"
_ "github.com/sipeed/picoclaw/pkg/channels/qq"
Expand Down
50 changes: 50 additions & 0 deletions docs/channels/mattermost/README.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Mattermost

Mattermost 是一个开源的团队协作平台。PicoClaw 通过 WebSocket API v4 和 REST API v4 连接到 Mattermost 服务器,支持接收和发送消息、文件上传、线程回复和输入指示器。

## 配置

```json
{
"channels": {
"mattermost": {
"enabled": true,
"url": "https://your-mattermost-server.com",
"token": "YOUR_BOT_TOKEN",
"username": "picoclaw",
"reply_in_thread": true,
"allow_from": ["YOUR_USER_ID"]
}
}
}
```

| 字段 | 类型 | 必填 | 描述 |
| ---------------- | ------ | ---- | ---------------------------------------- |
| enabled | bool | 是 | 是否启用 Mattermost 频道 |
| url | string | 是 | Mattermost 服务器地址 |
| token | string | 是 | 机器人访问令牌 |
| username | string | 否 | 机器人用户名(用于去除 @提及) |
| reply_in_thread | bool | 否 | 在频道中自动使用线程回复(默认:true) |
| allow_from | array | 否 | 用户ID白名单,空表示允许所有用户 |
| group_trigger | object | 否 | 群组触发设置 |
| typing | object | 否 | 输入指示器设置 |
| placeholder | object | 否 | 占位消息设置(默认启用,文本:"Thinking... 💭")|

## 设置流程

1. 前往 Mattermost 管理后台 → 集成 → 机器人帐户 → 添加机器人帐户
2. 复制机器人令牌
3. 将令牌填入配置文件中
4. 将机器人添加到需要的频道
5. 通过私信或 @提及 与机器人交互

## 功能

- **线程回复**:频道消息自动使用线程,私信保持平面结构
- **自动重连**:WebSocket 断开后自动重连(指数退避 5s-60s)
- **消息分割**:超长消息自动分割(上限 4000 字符)
- **文件上传**:支持通过 MediaSender 接口上传文件
- **输入指示器**:支持显示"正在输入"状态
- **消息编辑**:支持编辑已发送的消息
- **占位消息**:发送"思考中..."占位消息,完成后替换为实际回复
6 changes: 6 additions & 0 deletions pkg/channels/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ func (m *Manager) initChannels() error {
m.initChannel("matrix", "Matrix")
}

if m.config.Channels.Mattermost.Enabled &&
m.config.Channels.Mattermost.Token != "" &&
m.config.Channels.Mattermost.URL != "" {
m.initChannel("mattermost", "Mattermost")
}

if m.config.Channels.LINE.Enabled && m.config.Channels.LINE.ChannelAccessToken != "" {
m.initChannel("line", "LINE")
}
Expand Down
13 changes: 13 additions & 0 deletions pkg/channels/mattermost/init.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package mattermost

import (
"github.com/sipeed/picoclaw/pkg/bus"
"github.com/sipeed/picoclaw/pkg/channels"
"github.com/sipeed/picoclaw/pkg/config"
)

func init() {
channels.RegisterFactory("mattermost", func(cfg *config.Config, b *bus.MessageBus) (channels.Channel, error) {
return NewMattermostChannel(cfg.Channels.Mattermost, b)
})
}
Loading
Loading