
---
url: /mod/feishu.md
---
# x feishu

使用 x feishu 发送、监听飞书消息。


::: tip
飞书群机器人（x feishu bot）

用途：向飞书群发送单向通知，无需认证，只需 webhook URL，仅支持发送消息

常见场景：
  - CI/CD 构建通知（GitHub Actions）
  - 服务器监控告警（CPU、内存、磁盘使用率）

获取方式: https://cn.x-cmd.com/mod/feishu/cookbook-1
:::

::: tip
飞书智能机器人（x feishu abot）

用途：用于发送和接收消息，通过指定模型启动后台监听消息服务，需要配置 app_id 和 app_secret（从飞书开放平台创建应用获取）

配置命令：x feishu --cfg app_id=&lt;id&gt; app_secret=&lt;secret&gt;

常见场景：
  - 接入 x claw 作为私人 AI 助手

创建指引: https://open.feishu.cn/document/develop-an-echo-bot/introduction
:::

::: tip
消息监听服务有两种模式（x feishu abot service）：
1. --admin — 单聊模式（默认）

    监听机器人创建者与机器人之间的消息，作为私人 AI 助手

    首次启动需要配置 owner chat_id，服务名：x-feishu-admin-listener

    配置命令：x feishu --cfg chatid=&lt;chat_id&gt;
2. --group — 群聊模式

    不指定 chat_id：自动获取所有群列表并监听每个群，服务名：x-feishu-group-listener

    指定 chat_id：监听指定群，服务名：x-feishu-group-&lt;chat_id&gt;-listener
:::

::: tip
chat_id 获取方式：聊天页面 -&gt; 右上角设置 -&gt; 底部获取
:::

::: tip
飞书智能机器人接入 claw 作为私人 AI 助手：
1. 配置 app_id 、app_secret 和 owner chat_id
2. 启动飞书后台监听消息服务：x feishu abot service start
3. 启动 x claw 接入飞书: x claw start --feishu
:::


## 例子

交互模式初始化配置

```sh
x feishu init
```

发送文本消息到飞书群

```sh
x feishu send --text "x-cmd 新版本发布成功"
```

使用智能机器人发送文本消息

```sh
x feishu abot send --text --chatid <chat_id> "Hello"
```

启动智能机器人监听服务（单聊模式）

```sh
x feishu abot service start
```

以群聊模式启动，监听所有群

```sh
x feishu abot service start --group
```

以群聊模式启动，监听指定群的消息

```sh
x feishu abot service start --group <chat_id>
```

停止监听服务（单聊模式）

```sh
x feishu abot service stop
```

停止群聊模式监听服务

```sh
x feishu abot service stop --group
```

重启监听服务（单聊模式）

```sh
x feishu abot service restart
```

查看监听服务状态（单聊模式）

```sh
x feishu abot service status
```

查看指定会话的服务日志

```sh
x feishu abot service log <chat_id>
```

启动交互式指令模式，将收到的消息作为命令执行并返回结果

```sh
x feishu react --runner repl
```

## 子命令

| 名称 | 描述 |
| ------- | ------- |
| [x feishu send](/mod/feishu/send.md) | 使用飞书群机器人（webhook）发送消息（等同于 x feishu bot send） |
| [x feishu bot](/mod/feishu/bot.md) | 使用飞书群机器人（webhook）发送消息 |
| [x feishu abot](/mod/feishu/abot.md) | 使用飞书智能机器人发送消息和管理监听服务 |
| [x feishu listen](/mod/feishu/listen.md) | 长轮询监听飞书消息 |
| [x feishu group](/mod/feishu/group.md) | 获取飞书群组列表 |
| [x feishu parse](/mod/feishu/parse.md) | 解析飞书消息数据，自动下载媒体文件 |
| [x feishu react](/mod/feishu/react.md) | 监听飞书消息，根据指定模式自动回复消息 |
| [x feishu init](/mod/feishu/init.md) | 使用交互模式初始化配置 |
| [x feishu login](/mod/feishu/login.md) | 扫描二维码登录创建飞书机器人 |
| [x feishu --cur](/mod/feishu/--cur.md) | 当前会话默认值管理 |
| [x feishu --cfg](/mod/feishu/--cfg.md) | 飞书配置管理 |
