---
id: "deffd2c6e65998a3c704"
url: "https://www.xmcsl.cn/project/feishu-cli-embed/04-best-practices/02-%E9%A3%9E%E4%B9%A6%E6%99%BA%E8%83%BD%E4%BD%93%E6%94%AF%E6%8C%81%20Slash%20Command.html"
source_url: "https://open.feishu.cn/document/mcp_open_tools/agent-best-practices/agent-supports-slash-commands"
source_date: null
checked_at: "2026-11-05T04:21:48.909937+00:00"
status: "ready"
check_scope: "structure_only; not a factual or human review"
body_sha256: "746953905491c74ecc9d7738841466f8c2ac9350ddaffae633b815dc7b589744"
---

# 飞书智能体支持 Slash Command · 飞书 Agent 接入知识库

Slash Command 是一种允许用户在飞书聊天框中通过输入 <code>/</code> 快速触发机器人服务的交互方式。开发者可以通过 OpenAPI 为自己的机器人应用注册一组自定义指令，这些指令会以列表形式展示在用户输入 <code>/</code> 后弹出的指令面板中，从而实现更直观、便捷的能力发现与调用。

 

## 适用场景

 

Slash Command 适用于以下场景：

 

<ul>&#10;<li>&#10;<p><strong>高频快捷操作</strong>：将应用中最常用、最核心的功能注册为指令，如 <code>/todo 创建任务</code>、<code>/meeting 预定会议</code>，用户无需离开聊天窗口即可完成操作。</p>&#10;</li>&#10;<li>&#10;<p><strong>信息查询与检索</strong>：提供快速的信息查询入口，如 <code>/stock 查询股价</code>、<code>/weather 查询天气</code>，简化信息获取流程。</p>&#10;</li>&#10;<li>&#10;<p><strong>复杂任务引导</strong>：作为复杂工作流的起点，例如 <code>/approval 发起审批</code>，触发后机器人可以发送卡片消息，引导用户完成后续的多步操作。</p>&#10;</li>&#10;<li>&#10;<p><strong>开发者与运维工具</strong>：为开发和运维人员提供便捷的命令行工具，如 <code>/deploy 发布服务</code>、<code>/log 查看日志</code>，将飞书客户端转变为一个轻量级的运维入口。</p>&#10;</li>&#10;</ul>

 

## 前提条件

 

在开始接入 Slash Command 之前，请确保你已完成以下准备工作：

 

<ul>&#10;<li>&#10;<p><strong>飞书客户端版本要求</strong>：PC 端 <strong>7.70</strong> 及以上版本，移动端 <strong>7.71</strong> 及以上版本。</p>&#10;</li>&#10;<li>&#10;<p><strong>创建并发布应用</strong>：你需要在 <a href="https://open.feishu.cn/app">飞书开放平台</a> 创建一个企业自建应用或商店应用。</p>&#10;</li>&#10;<li>&#10;<p><strong>启用机器人能力</strong>：进入应用详情页，在“应用能力”下添加并启用“机器人”能力。应用需要发布后，机器人才能被用户搜索和使用。</p>&#10;</li>&#10;<li>&#10;<p><strong>获取 OpenAPI 调用凭证</strong>：了解如何获取和使用 <code>tenant&#95;access&#95;token</code> 或 <code>user&#95;access&#95;token</code>，详情参考<a href="https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM">获取访问凭证</a>。&#10;<strong>配置生效延迟</strong>：</p>&#10;</li>&#10;</ul>

 

由于客户端存在缓存策略，通过 OpenAPI 对 Slash Command 进行创建、更新或删除后，配置的变更将在客户端上<strong>有约 5 分钟的生效延迟</strong>。完成操作后，请耐心等待或尝试重启飞书客户端以查看最新效果。

 

## 快速开始

 

本章节将引导你快速完成对 Slash Command 的创建、查询、更新和删除操作。所有接口均使用统一的复数形式路径。

 

### 接口与权限

 

开发者需要通过调用以下四个 OpenAPI 来管理应用的 Slash Command。

 

<table>&#10;<thead>&#10;<tr>&#10;<th><strong>操作</strong></th>&#10;<th><strong>HTTP 方法</strong></th>&#10;<th><strong>接口路径</strong></th>&#10;<th><strong>所需权限 (Scope)</strong></th>&#10;</tr>&#10;</thead>&#10;<tbody>&#10;<tr>&#10;<td>创建指令</td>&#10;<td>POST</td>&#10;<td>/open-apis/application/v7/app&#95;slash&#95;commands</td>&#10;<td><code>application:app&#95;slash&#95;command:write</code></td>&#10;</tr>&#10;<tr>&#10;<td>查询指令列表</td>&#10;<td>GET</td>&#10;<td>/open-apis/application/v7/app&#95;slash&#95;commands</td>&#10;<td><code>application:app&#95;slash&#95;command:read</code></td>&#10;</tr>&#10;<tr>&#10;<td>更新指令</td>&#10;<td>PATCH</td>&#10;<td>/open-apis/application/v7/app&#95;slash&#95;commands/:command&#95;id</td>&#10;<td><code>application:app&#95;slash&#95;command:write</code></td>&#10;</tr>&#10;<tr>&#10;<td>删除指令</td>&#10;<td>DELETE</td>&#10;<td>/open-apis/application/v7/app&#95;slash&#95;commands/:command&#95;id</td>&#10;<td><code>application:app&#95;slash&#95;command:write</code></td>&#10;</tr>&#10;</tbody>&#10;</table>

 

在调用接口前，请确保你的应用已在“权限管理”页面申请并开通了上述权限。

 

### 请求示例

 

以下 <code>curl</code> 命令展示了如何完成一次完整的指令生命周期管理。请将 <code>YOUR&#95;TENANT&#95;ACCESS&#95;TOKEN</code> 替换为你自己的访问凭证。<code>icon&#95;key</code>可选列表参考 「Slash Command Icon Key 说明」章节。

 

#### 1\. 创建一条指令

 

<strong>指令数量上限</strong>：每个应用可创建的 Slash Command 存在数量上限（当前为 100 条）。

 

创建一个名为 <code>/greet</code> 的指令。

 

```Bash
curl --location --request POST 'https://open.feishu.cn/open-apis/application/v7/app_slash_commands' \
--header 'Authorization: Bearer YOUR_TENANT_ACCESS_TOKEN' \
--header 'Content-Type: application/json; charset=utf-8' \
--data-raw '{
    "command": "greet",
    "description": {
        "default_value": "发送一句问候",
        "i18n": {
            "en_us": "Send a greeting",
            "zh_cn": "发送一句问候"
        },
        "icon": {
          "icon_key": "skill_outlined"
        }
    }
}'
```

 

<strong>成功响应：</strong>

 

```JSON
{
    "code": 0,
    "msg": "success",
    "data": {
        "command_id": "7374693847629398036"
    }
}
```

 

<ul>&#10;<li>&#10;<p><strong>必填字段</strong>: <code>command</code> (指令名称，不含 <code>/</code>) 和 <code>description</code> (指令描述)。<code>description</code> 内部必须包含 <code>default&#95;value</code> 作为兜底文案。</p>&#10;</li>&#10;<li>&#10;<p><strong>可选字段：</strong><code>icon</code>（指令 icon key），<code>icon&#95;key</code> 可选列表参考「Slash Command Icon Key 说明」章节。</p>&#10;</li>&#10;<li>&#10;<p><strong>记录</strong><code>command&#95;id</code>: <strong>请务必记录</strong>成功响应中返回的 <code>command&#95;id</code>，这是后续更新和删除该指令的唯一标识。</p>&#10;</li>&#10;</ul>

 

#### 2\. 查询指令列表

 

查询当前应用下的所有指令。

 

```Bash
curl --location --request GET 'https://open.feishu.cn/open-apis/application/v7/app_slash_commands' \
--header 'Authorization: Bearer YOUR_TENANT_ACCESS_TOKEN'
```

 

<strong>成功响应：</strong>

 

```JSON
{
    "code": 0,
    "msg": "success",
    "data": {
        "items": [
            {
                "command_id": "7374693847629398036",
                "command": "greet",
                "description": {
                    "default_value": "发送一句问候",
                    "i18n": {
                        "en_us": "Send a greeting",
                        "zh_cn": "发送一句问候"
                    }
                },
               "icon": {
                   "icon_key": "skill_outlined"
                },
                "update_time": "1716963953"
            }
        ]
    }
}
```

 

#### 3\. 更新一条指令

 

使用 <code>command&#95;id</code> 更新指定指令的描述和 icon。

 

```Bash
curl --location --request PATCH 'https://open.feishu.cn/open-apis/application/v7/app_slash_commands/7374693847629398036' \
--header 'Authorization: Bearer YOUR_TENANT_ACCESS_TOKEN' \
--header 'Content-Type: application/json; charset=utf-8' \
--data-raw '{
    "description": {
        "default_value": "发送一句更加热情的问候",
        "i18n": {
            "en_us": "Send a more enthusiastic greeting",
            "zh_cn": "发送一句更加热情的问候"
        },
        "icon": {
          "icon_key": "skill_outlined"
        }
    }
}'
```

 

<strong>成功响应：</strong>

 

```JSON
{
    "code": 0,
    "msg": "success",
    "data": {}
}
```

 

#### 4\. 删除一条指令

 

使用 <code>command&#95;id</code> 删除指定指令。

 

```Bash
curl --location --request DELETE 'https://open.feishu.cn/open-apis/application/v7/app_slash_commands/7374693847629398036' \
--header 'Authorization: Bearer YOUR_TENANT_ACCESS_TOKEN'
```

 

<strong>成功响应：</strong>

 

```JSON
{
    "code": 0,
    "msg": "success",
    "data": {}
}
```

 

### 典型错误码

 

在调用过程中，你可能会遇到以下典型错误，可根据错误码和提示信息进行排查。

 

<table>&#10;<thead>&#10;<tr>&#10;<th><strong>错误码</strong></th>&#10;<th><strong>HTTP 状态码</strong></th>&#10;<th><strong>含义</strong></th>&#10;<th><strong>可能原因及解决方案</strong></th>&#10;</tr>&#10;</thead>&#10;<tbody>&#10;<tr>&#10;<td>99991661</td>&#10;<td>400</td>&#10;<td>缺少 Token</td>&#10;<td>请求头未携带 <code>Authorization</code>。请检查并添加 <code>Authorization: Bearer YOUR&#95;TENANT&#95;ACCESS&#95;TOKEN</code>。</td>&#10;</tr>&#10;<tr>&#10;<td>99991663</td>&#10;<td>400</td>&#10;<td>Token 无效</td>&#10;<td><code>Authorization</code> 中携带的 Token 已过期、被伪造或不属于当前应用。请重新获取有效的访问凭证。</td>&#10;</tr>&#10;<tr>&#10;<td>99992402</td>&#10;<td>400</td>&#10;<td>参数校验失败</td>&#10;<td>请求体中缺少必填字段，如 <code>command</code> 或 <code>description</code>。请根据响应中的 <code>field&#95;violations</code> 提示补充字段。</td>&#10;</tr>&#10;<tr>&#10;<td>9499</td>&#10;<td>400</td>&#10;<td>请求体格式错误</td>&#10;<td>请求体 JSON 结构不合法，或字段类型错误（例如 <code>description.i18n</code> 应为对象而非字符串）。请检查 JSON 格式。</td>&#10;</tr>&#10;<tr>&#10;<td>40000000</td>&#10;<td>200</td>&#10;<td>业务逻辑错误</td>&#10;<td>通常由业务约束导致，如 <code>command already exists</code> (指令重名) 或 <code>command&#95;id not found</code> (指令不存在)。请根据 <code>msg</code> 排查。</td>&#10;</tr>&#10;<tr>&#10;<td>40000031</td>&#10;<td>200</td>&#10;<td><code>icon&#95;key</code>错误</td>&#10;<td><code>icon&#95;key</code> 必须是「Slash Command Icon Key 说明」章节中的可用 <code>icon&#95;key</code>。</td>&#10;</tr>&#10;</tbody>&#10;</table>

 

## 接入流程

 

一个完整的 Slash Command 接入与管理流程包含以下步骤：

 

<strong>第 1 步：应用创建与权限配置</strong>

 

<ol>&#10;<li>&#10;<p>访问 <a href="https://open.feishu.cn/app">飞书开放平台</a>，创建一个新的企业自建应用，或选择一个已有的应用。</p>&#10;</li>&#10;<li>&#10;<p>在应用详情页的 <strong>应用能力</strong> 中，确保已添加并启用 <strong>机器人</strong> 能力。</p>&#10;</li>&#10;<li>&#10;<p>在 <strong>权限管理</strong> 页面，搜索并开通 <code>application:app&#95;slash&#95;command:write</code> 和 <code>application:app&#95;slash&#95;command:read</code> 权限。</p>&#10;</li>&#10;<li>&#10;<p>完成上述配置后，<strong>创建并发布一个新的应用版本</strong>，使权限和机器人能力生效。</p>&#10;</li>&#10;</ol>

 

<strong>第 2 步：获取 Access Token</strong>

 

调用 Slash Command 相关接口需要应用的访问凭证 (<code>tenant&#95;access&#95;token</code>)。请参考 <a href="https://open.feishu.cn/document/ukTMukTMukTM/ukDNz4SO0MjL5QzM/auth-v3/auth/tenant_access_token_internal">自建应用获取 tenant&#95;access&#95;token</a>，编写获取和刷新 Token 的逻辑。

 

<strong>第 3 步：注册指令 (Create)</strong>

 

调用 <code>POST /open-apis/application/v7/app&#95;slash&#95;commands</code> 接口，为你希望暴露给用户的每一个功能注册一条指令。

 

<ul>&#10;<li>&#10;<p><strong>一次性注册</strong>：建议在你的服务启动或初始化阶段，将所有需要支持的指令一次性批量注册。</p>&#10;</li>&#10;<li>&#10;<p><strong>记录 ID</strong>：将成功创建后返回的 <code>command&#95;id</code> 与你的业务逻辑（例如功能模块、函数名）进行映射，并持久化存储，以便后续更新或删除。</p>&#10;</li>&#10;</ul>

 

<strong>第 4 步：客户端生效与查询 (List)</strong>

 

<ol>&#10;<li>&#10;<p><strong>等待生效</strong>：指令注册成功后，由于客户端缓存机制，<strong>需要等待约 5 分钟</strong>才能在聊天输入框中看到。你可以尝试重启飞书客户端来加速缓存刷新。</p>&#10;</li>&#10;<li>&#10;<p><strong>验证</strong>：在与你的机器人单聊的对话框中，输入 <code>/</code>，查看弹出的指令面板中是否包含你刚刚注册的指令。</p>&#10;</li>&#10;<li>&#10;<p><strong>程序查询</strong>：随时可以调用 <code>GET /open-apis/application/v7/app&#95;slash&#95;commands</code> 接口，从服务端视角查询当前应用已成功注册的所有指令列表，从而核对或同步你的本地指令状态。&#10;<strong>客户端缓存与延迟的影响</strong>：</p>&#10;</li>&#10;</ol>

 

客户端为了提升性能，会对应用的 Slash Command 列表进行缓存，<strong>缓存有效期约为 3 分钟</strong>。这意味着：

 

<ul>&#10;<li>&#10;<p><strong>创建/更新</strong>：新的指令或对现有指令的修改，最长可能需要 <code>注册延迟(5分钟) + 缓存刷新(3分钟)</code> 才能在所有用户端可见。</p>&#10;</li>&#10;<li>&#10;<p><strong>删除</strong>：已删除的指令，可能在用户的指令面板中继续“残留”最多 3 分钟，直到下一次缓存过期并重新拉取。</p>&#10;</li>&#10;</ul>

 

因此，在进行管理操作后，请给予系统足够的同步时间。

 

<strong>第 5 步：更新与删除 (Update &amp; Delete)</strong>

 

<ul>&#10;<li>&#10;<p><strong>更新</strong>：当你需要修改某个指令的描述（例如，文案优化、功能变更说明）时，使用创建时保存的 <code>command&#95;id</code> 调用 <code>PATCH /open-apis/application/v7/app&#95;slash&#95;commands/:command&#95;id</code> 接口。</p>&#10;</li>&#10;<li>&#10;<p><strong>删除</strong>：当某个功能下线或不再希望通过 Slash Command 暴露时，使用对应的 <code>command&#95;id</code> 调用 <code>DELETE /open-apis/application/v7/app&#95;slash&#95;commands/:command&#95;id</code> 接口。</p>&#10;</li>&#10;</ul>

 

<strong>第 6 步：回滚与清理</strong>

 

<ul>&#10;<li>&#10;<p><strong>回滚</strong>：如果一次发布后希望撤销某条指令，本质上就是<strong>删除</strong>操作。</p>&#10;</li>&#10;<li>&#10;<p><strong>重建</strong>：<strong>指令的 </strong><strong><code>command</code></strong><strong> 名称在被删除后即可再次使用</strong>。如果你误删了一条指令，可以立即使用相同的 <code>command</code> 和 <code>description</code> 重新调用创建接口。服务端会生成一个全新的 <code>command&#95;id</code>，实现“原地重建”。</p>&#10;</li>&#10;<li>&#10;<p><strong>全量清理</strong>：在下线整个应用或重构指令体系时，你可以先通过 <code>GET</code> 接口拉取所有指令的 <code>command&#95;id</code>，然后遍历列表，逐一调用 <code>DELETE</code> 接口，完成所有指令的清理工作。</p>&#10;</li>&#10;</ul>

 

## 最佳实践

 

遵循以下实践，可以帮助你更稳定、高效地使用 Slash Command OpenAPI。

 

### 命名规范

 

<ul>&#10;<li>&#10;<p><strong>使用业务前缀</strong>：为了避免不同应用或应用内不同模块之间的指令冲突，建议为 <code>command</code> 名称添加有意义的前缀。例如，如果你的应用名为 “订单助手”，可以命名为 <code>order&#95;create</code>、<code>order&#95;query</code>。</p>&#10;</li>&#10;<li>&#10;<p><strong>动词优先</strong>：采用 <code>动词-名词</code> 的格式，如 <code>create-task</code>、<code>search-file</code>，使指令意图更加清晰。</p>&#10;</li>&#10;<li>&#10;<p><strong>简洁明了</strong>：指令名称应简短易记，避免使用过长或复杂的单词。</p>&#10;</li>&#10;</ul>

 

### 并发与幂等

 

<ul>&#10;<li>&#10;<p><strong>创建操作的幂等性</strong>：<code>POST</code> 创建接口本身不是幂等的，但服务端对 <code>command</code> 名称做了唯一性约束。如果短时间内使用相同的 <strong><em>&#42;<code>command</code></em></strong><em> 名称发起多次创建请求，只有第一次会成功（返回 </em><strong><em><code>code: 0</code></em></strong><em>），后续请求将失败并返回 </em><strong><em><code>code: 40000000</code></em></strong><em> 及 </em><em><code>msg: "command already exists"</code></em>&#42;。因此，调用方无需在客户端实现复杂的创建防重逻辑，只需判断响应码即可。</p>&#10;</li>&#10;<li>&#10;<p><strong>更新/删除操作的幂等性</strong>：<code>PATCH</code> 和 <code>DELETE</code> 操作在设计上是幂等的。对同一个 <code>command&#95;id</code> 多次执行相同的更新，结果保持一致；对一个已删除的 <code>command&#95;id</code> 多次调用删除，后续请求会返回 <code>command&#95;id not found</code>，但从系统状态来看，结果同样是一致的（指令不存在）。</p>&#10;</li>&#10;</ul>

 

### 错误处理

 

在编写代码时，建议对以下几类关键错误进行捕获和处理：

 

<ul>&#10;<li>&#10;<p><strong>指令已存在</strong> (<code>command already exists</code>)：当创建指令时收到此错误，表明该指令名已被占用。此时应放弃创建，并可根据业务需要调用 <code>GET</code> 接口获取现有指令的 <code>command&#95;id</code>，转为更新逻辑。</p>&#10;</li>&#10;<li>&#10;<p><strong>指令 ID 未找到</strong> (<code>command&#95;id not found</code>)：当更新或删除时收到此错误，表明目标指令已被删除或从未存在。此时应停止操作，并检查传入的 <code>command&#95;id</code> 是否正确，或同步本地的指令状态。</p>&#10;</li>&#10;<li>&#10;<p><strong>鉴权错误</strong> (<code>99991661</code> / <code>99991663</code>)：收到这类错误时，应检查 <code>Authorization</code> 请求头和 <code>access&#95;token</code> 的有效性，并触发 Token 刷新机制。</p>&#10;</li>&#10;<li>&#10;<p><strong>参数校验错误</strong> (<code>99992402</code> / <code>9499</code>)：这类错误通常由开发阶段的编码疏漏导致。应根据错误提示检查请求体的字段和结构，确保符合 API 定义。</p>&#10;</li>&#10;</ul>

 

### 数量与版本管理

 

<ul>&#10;<li><strong>指令数量上限</strong>：每个应用可创建的 Slash Command 存在数量上限（当前为 100 条）。</li>&#10;<li><strong>批量操作建议</strong>：当需要大规模清理指令时，建议的流程是：</li>&#10;</ul>

 

<ol>&#10;<li>&#10;<p>调用 <code>GET</code> 接口拉取当前全量指令列表。</p>&#10;</li>&#10;<li>&#10;<p>在本地计算出需要删除的指令 <code>command&#95;id</code> 集合。</p>&#10;</li>&#10;<li>&#10;<p>遍历该集合，逐一调用 <code>DELETE</code> 接口完成删除。</p>&#10;</li>&#10;</ol>

 

### Header 要求

 

<ul>&#10;<li>&#10;<p><code>Content-Type: application/json; charset=utf-8</code>：对于 <code>POST</code> 和 <code>PATCH</code> 请求，这是<strong>必须的</strong>。</p>&#10;</li>&#10;<li>&#10;<p><code>Authorization: Bearer &lt;token&gt;</code>：所有请求<strong>必须携带</strong>。</p>&#10;</li>&#10;</ul>

 

## Slash Command Icon Key 说明

 

本章列举用于 Slash Command 的创建和更新时<code>icon&#95;key</code>参数的可选列表，默认为<code>skill&#95;outlined</code>。

 

<table>&#10;<thead>&#10;<tr>&#10;<th>icon&#95;key</th>&#10;<th>图标</th>&#10;</tr>&#10;</thead>&#10;<tbody>&#10;<tr>&#10;<td>skill&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/80395e3e1589.png"></td>&#10;</tr>&#10;<tr>&#10;<td>light-ai&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/1a2ec94890aa.png"></td>&#10;</tr>&#10;<tr>&#10;<td>chat-ai&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/512e024e5f52.png"></td>&#10;</tr>&#10;<tr>&#10;<td>ai-edit-continue&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/bc987a893bad.png"></td>&#10;</tr>&#10;<tr>&#10;<td>education-ai&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/c0a7d767027b.png"></td>&#10;</tr>&#10;<tr>&#10;<td>ai-trans-switch&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/39c715e5d0f7.png"></td>&#10;</tr>&#10;<tr>&#10;<td>language-ai&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/56da03ba80af.png"></td>&#10;</tr>&#10;<tr>&#10;<td>toolbar-more-ai&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/3457a20ba1b3.png"></td>&#10;</tr>&#10;<tr>&#10;<td>image-ai&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/27d30d36c212.png"></td>&#10;</tr>&#10;<tr>&#10;<td>ai-agent&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/8c493cc7d2ab.png"></td>&#10;</tr>&#10;<tr>&#10;<td>ai-deepthink&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/43b4bdb48d7d.png"></td>&#10;</tr>&#10;<tr>&#10;<td>ai-style&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/cd8567fde46e.png"></td>&#10;</tr>&#10;<tr>&#10;<td>ai-reminder&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/881b627cac76.png"></td>&#10;</tr>&#10;<tr>&#10;<td>ai-block&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/4c52444aa083.png"></td>&#10;</tr>&#10;<tr>&#10;<td>ai-simplify-expression&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/97006ce7bd94.png"></td>&#10;</tr>&#10;<tr>&#10;<td>promptword&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/8379de3b6deb.png"></td>&#10;</tr>&#10;<tr>&#10;<td>meeting-ai&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/7cde6de5776f.png"></td>&#10;</tr>&#10;<tr>&#10;<td>ai-improvewriting&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/63b114726e78.png"></td>&#10;</tr>&#10;<tr>&#10;<td>slash-ai&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/086e7ec90008.png"></td>&#10;</tr>&#10;<tr>&#10;<td>pa-cost-ai&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/5e629132dc0a.png"></td>&#10;</tr>&#10;<tr>&#10;<td>update-ai&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/2a1001863cb5.png"></td>&#10;</tr>&#10;<tr>&#10;<td>diagnosis-ai&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/7c5e05c55394.png"></td>&#10;</tr>&#10;<tr>&#10;<td>ai-functions&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/16bb1148af28.png"></td>&#10;</tr>&#10;<tr>&#10;<td>mic-ai&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/32f722d5940c.png"></td>&#10;</tr>&#10;<tr>&#10;<td>search-ai&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/1d140af7b70e.png"></td>&#10;</tr>&#10;<tr>&#10;<td>explanation-ai&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/a91fffca2fc8.png"></td>&#10;</tr>&#10;<tr>&#10;<td>add-ai&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/bd0d1eae5f33.png"></td>&#10;</tr>&#10;<tr>&#10;<td>add-chat-ai&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/15685bff465b.png"></td>&#10;</tr>&#10;<tr>&#10;<td>ai-notification&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/0e218a9d018f.png"></td>&#10;</tr>&#10;<tr>&#10;<td>dynamic-layout&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/eab9f7d4dc4a.png"></td>&#10;</tr>&#10;<tr>&#10;<td>ai-doc&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/e275b1d16fe4.png"></td>&#10;</tr>&#10;<tr>&#10;<td>home&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/39fbee1d01af.png"></td>&#10;</tr>&#10;<tr>&#10;<td>mail&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/8208770082f1.png"></td>&#10;</tr>&#10;<tr>&#10;<td>browser-mac&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/4b2f41c06085.png"></td>&#10;</tr>&#10;<tr>&#10;<td>flag&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/5de1f20e09e2.png"></td>&#10;</tr>&#10;<tr>&#10;<td>calendar-line&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/d5d072a0f6ac.png"></td>&#10;</tr>&#10;<tr>&#10;<td>sent&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/4b22e4bba96a.png"></td>&#10;</tr>&#10;<tr>&#10;<td>gift&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/163610f25767.png"></td>&#10;</tr>&#10;<tr>&#10;<td>tag&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/c672fdf26e1a.png"></td>&#10;</tr>&#10;<tr>&#10;<td>cloud&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/5ebc25349818.png"></td>&#10;</tr>&#10;<tr>&#10;<td>bonus-payroll&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/7ae4ef9ad372.png"></td>&#10;</tr>&#10;<tr>&#10;<td>vote&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/a375954142b0.png"></td>&#10;</tr>&#10;<tr>&#10;<td>chat&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/e4ca8d2d7836.png"></td>&#10;</tr>&#10;<tr>&#10;<td>emoji&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/083dbbd0b37b.png"></td>&#10;</tr>&#10;<tr>&#10;<td>member&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/c15ef72cbf51.png"></td>&#10;</tr>&#10;<tr>&#10;<td>robot&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/26fc7ca879cc.png"></td>&#10;</tr>&#10;<tr>&#10;<td>mic&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/9d98360bf232.png"></td>&#10;</tr>&#10;<tr>&#10;<td>raisehand&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/0d218e72849e.png"></td>&#10;</tr>&#10;<tr>&#10;<td>officephone&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/41b9fa7f4e73.png"></td>&#10;</tr>&#10;<tr>&#10;<td>effects&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/764265f04441.png"></td>&#10;</tr>&#10;<tr>&#10;<td>labs&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/5e37b7ec083a.png"></td>&#10;</tr>&#10;<tr>&#10;<td>computer&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/b26c10fd05e2.png"></td>&#10;</tr>&#10;<tr>&#10;<td>clear&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/c38f9d93a7c9.png"></td>&#10;</tr>&#10;<tr>&#10;<td>mouse&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/5a32571784aa.png"></td>&#10;</tr>&#10;<tr>&#10;<td>cellphone&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/bbb7c7fa8f10.png"></td>&#10;</tr>&#10;<tr>&#10;<td>cursor&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/550ae5283b5e.png"></td>&#10;</tr>&#10;<tr>&#10;<td>plugin&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/43add8938184.png"></td>&#10;</tr>&#10;<tr>&#10;<td>edit&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/926c8f8dc5d5.png"></td>&#10;</tr>&#10;<tr>&#10;<td>style-fillcolor&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/d4cd12b81d18.png"></td>&#10;</tr>&#10;<tr>&#10;<td>codeblock&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/361f2925b3cf.png"></td>&#10;</tr>&#10;<tr>&#10;<td>code&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/686e7d0d399d.png"></td>&#10;</tr>&#10;<tr>&#10;<td>folder&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/decac19b6994.png"></td>&#10;</tr>&#10;<tr>&#10;<td>file-link-word&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/db6606715108.png"></td>&#10;</tr>&#10;<tr>&#10;<td>file-link-sheet&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/f6dd74cfb921.png"></td>&#10;</tr>&#10;<tr>&#10;<td>file-link-image&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/cd80c865629e.png"></td>&#10;</tr>&#10;<tr>&#10;<td>global-link&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/b04f27cffb70.png"></td>&#10;</tr>&#10;<tr>&#10;<td>champion&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/eb5139f7e099.png"></td>&#10;</tr>&#10;<tr>&#10;<td>local&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/1d2ba8fdc9b4.png"></td>&#10;</tr>&#10;<tr>&#10;<td>day&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/8e0fd9389285.png"></td>&#10;</tr>&#10;<tr>&#10;<td>waiting&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/adf937a9efb3.png"></td>&#10;</tr>&#10;<tr>&#10;<td>database&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/7a9a39703c75.png"></td>&#10;</tr>&#10;<tr>&#10;<td>marketplace&#95;outlined</td>&#10;<td><img alt="" src="https://www.xmcsl.cn/project/feishu-cli-embed/images/79d5f1484f6b.png"></td>&#10;</tr>&#10;</tbody>&#10;</table>

 

## FAQ

 

<strong>Q1：为什么我调用接口时返回 </strong><strong><code>404 Not Found</code></strong><strong>？</strong>

 

A1：<code>404</code> 错误通常由以下原因导致：

 

<ol>&#10;<li>&#10;<p><strong>URL 路径错误</strong>：请检查你的请求 URL 是否严格遵循文档格式 <code>/open-apis/application/v7/app&#95;slash&#95;commands</code> (对于列表和创建) 或 <code>/open-apis/application/v7/app&#95;slash&#95;commands/:command&#95;id</code> (对于更新和删除)。特别注意路径是复数形式 <code>commands</code>。</p>&#10;</li>&#10;<li>&#10;<p><strong>环境不匹配</strong>：如果你在测试环境（如 BOE）进行调试，但请求发往了线上环境域名 (<code>open.feishu.cn</code>)，或者未正确携带 <code>x-tt-env</code> 头部，可能导致路由失败。</p>&#10;</li>&#10;</ol>

 

<strong>Q2：我的指令已经创建成功，为什么在飞书里输入 </strong><strong><code>/</code></strong><strong> 看不到？</strong>

 

A2：这通常是由于缓存和生效延迟导致的。

 

<ol>&#10;<li>&#10;<p><strong>服务端延迟</strong>：从接口调用成功到配置在所有数据中心同步完成，有分钟级的延迟。</p>&#10;</li>&#10;<li>&#10;<p><strong>客户端缓存</strong>：飞书客户端会对指令列表进行缓存（约 3 分钟）。</p>&#10;</li>&#10;<li>&#10;<p><strong>排查步骤</strong>：</p>&#10;</li>&#10;</ol>

 

<ul>&#10;<li>&#10;<p><strong>耐心等待</strong>：在创建或更新后，<strong>至少等待 5 分钟</strong>。</p>&#10;</li>&#10;<li>&#10;<p><strong>重启客户端</strong>：完全退出飞书客户端再重新登录，可以强制刷新缓存。</p>&#10;</li>&#10;<li>&#10;<p><strong>调用 </strong><strong><code>GET</code></strong><strong> 接口确认</strong>：调用列表接口，检查你的指令是否已存在于服务端返回的列表中。如果存在，说明服务端已处理成功，问题在于客户端缓存。</p>&#10;</li>&#10;</ul>

 

<strong>Q3：调用接口返回 </strong><strong><code>code: 99991640, msg: "lacks permission"</code></strong><strong>，这是为什么？</strong>

 

A3：这个错误明确表示你的应用缺少调用该接口所需的权限。

 

<ol>&#10;<li>&#10;<p><strong>检查权限范围 (Scope)</strong>：请前往 <a href="https://open.feishu.cn/app">飞书开放平台</a> &gt; 你的应用 &gt; “权限管理”页面。</p>&#10;</li>&#10;<li>&#10;<p><strong>确认权限</strong>：确保 <code>application:app&#95;slash&#95;command:write</code> (用于写操作) 和 <code>application:app&#95;slash&#95;command:read</code> (用于读操作) 已被添加并处于“已开通”状态。</p>&#10;</li>&#10;<li>&#10;<p><strong>重新发布版本</strong>：如果在应用已发布后才添加的权限，你需要<strong>创建一个新的应用版本并重新发布</strong>，权限才会正式生效。</p>&#10;</li>&#10;</ol>

 

<strong>Q4：为什么我的 </strong><strong><code>description.i18n</code></strong><strong> 国际化配置没有生效？</strong>

 

A4：<code>i18n</code> 字段的 <code>key</code> 必须是标准的语言代码，<code>value</code> 为对应语言的描述文本。

 

<ul>&#10;<li><strong>正确结构</strong>:</li>&#10;</ul>

 

```JSON
    "description": {
        "default_value": "默认描述",
        "i18n": {
            "zh_cn": "中文描述",
            "en_us": "English Description",
            "ja_jp": "日本語の説明"
        }
    }
```

 

<ul>&#10;<li><strong>错误结构</strong>:</li>&#10;</ul>

 

```JSON
    // 错误示例1：i18n 不是一个 map/object
    "i18n": "some string" 

// 错误示例2：语言代码不标准
    "i18n": {
        "chinese": "中文描述" 
    }
```

 

请确保 <code>i18n</code> 的值是一个严格的 <code>map&#91;string&#93;string</code> 结构，且 <code>key</code> 使用 <code>zh&#95;cn</code>, <code>en&#95;us</code> 等标准代号。

 

<strong>Q5：我可以为一个应用创建多少个 Slash Command？</strong>

 

A5：目前，单个应用最多可以创建 <strong>100</strong> 条 Slash Command。建议你精选应用的核心功能进行注册，保持指令列表的简洁和高效。如果指令过多，用户反而难以查找和使用。
