# 删除消息表情回复

删除指定消息的某一表情回复。

## 前提条件

- 应用需要开启[机器人能力](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-enable-bot-ability)。
- 调用当前接口的机器人或者用户，需要在待删除表情回复的消息所属的会话内。

## 使用限制

- 已被撤回的消息无法添加表情回复。
- 调用当前接口的机器人或者用户，只能删除由自己添加的表情回复，且需要保证该表情回复真实存在于消息中。

## 请求

基本 | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/im/v1/messages/:message_id/reactions/:reaction_id
HTTP Method | DELETE
接口频率限制 | [1000 次/分钟、50 次/秒](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)
支持的应用类型 | Custom App、Store App
权限要求<br>**调用该 API 所需的权限。开启其中任意一项权限即可调用**<br>开启任一权限即可 | 获取与发送单聊、群组消息(im:message)<br>发送、删除消息表情回复(im:message.reactions:write_only)

### 请求头

名称 | 类型 | 必填 | 描述
---|---|---|---
Authorization | string | 是 | `tenant_access_token`<br>或<br>`user_access_token`<br>**值格式**："Bearer `access_token`"<br>**示例值**："Bearer u-7f1bcd13fc57d46bac21793a18e560"<br>[了解更多：如何选择与获取 access token](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-choose-which-type-of-token-to-use)

### 路径参数

名称 | 类型 | 描述
---|---|---
message_id | string | 待删除表情回复的消息 ID。ID 获取方式：<br>- 调用[发送消息](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/create)接口后，从响应结果的 `message_id` 参数获取。<br>- 监听[接收消息](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/events/receive)事件，当触发该事件后可以从事件体内获取消息的 `message_id`。<br>- 调用[获取会话历史消息](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/list)接口，从响应结果的 `message_id` 参数获取。<br>**示例值**："om_8964d1b4*********2b31383276113"
reaction_id | string | 待删除的表情回复 ID，该 ID 获取方式：<br>- 调用[添加消息表情回复](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message-reaction/create)接口添加表情回复后，在返回结果中获取。<br>- 调用[获取消息表情回复](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message-reaction/list)接口，获取某一表情回复的 ID。<br>**示例值**："ZCaCIjUBVVWSrm5L-3ZTw*************sNa8dHVplEzzSfJVUVLMLcS_"

## 响应

### 响应体

名称 | 类型 | 描述
---|---|---
code | int | 错误码，非 0 表示失败
msg | string | 错误描述
data | message.reaction | \-
reaction_id | string | 表情回复 ID。
operator | operator | 添加表情回复的操作人。
operator_id | string | 操作人 ID，具体的取值与 `operator_type` 相关：<br>- 当 `operator_type` 取值 `app` 时返回机器人的应用 ID（app_id）。<br>- 当 `operator_type` 取值 `user` 时返回用户的 open_id。
operator_type | string | 操作人身份。<br>**可选值有**：<br>- app：应用<br>- user：用户
action_time | string | 添加消息表情回复的时间。Unix 时间戳，单位：ms
reaction_type | emoji | 表情类型
emoji_type | string | emoji 类型。emoji_type 值对应的表情参考[表情文案说明](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message-reaction/emojis-introduce)。

### 响应体示例
```json
{
    "code": 0,
    "msg": "success",
    "data": {
        "reaction_id": "ZCaCIjUBVVWSrm5L-3ZTw****",
        "operator": {
            "operator_id": "ou_ff0b7ba35fb****",
            "operator_type": "user"
        },
        "action_time": "1626086391570",
        "reaction_type": {
            "emoji_type": "SMILE"
        }
    }
```

### 错误码

HTTP状态码 | 错误码 | 描述 | 排查建议
---|---|---|---
400 | 230110 | Action unavailable as the message has been deleted. | 消息被删除，无法进行操作。
400 | 231001 | reaction type is invalid. | 要操作的表情回复不归属于当前租户，无法删除。
400 | 231002 | The operator has no permission to react on the specific message. | 当前调用接口的机器人或用户，没有权限对目标消息添加或删除表情回复。通常是因为机器人或用户不在消息所属的会话内。
400 | 231003 | The message is not found, maybe not exist or deleted. | 找不到目标消息，可能因为传入的消息 ID 有误或者消息已经被撤回。
400 | 231004 | The chat in which the message exists is not found, maybe not exist, deleted or archived. | 目标消息所属会话不存在、已被解散或归档等，无法进行操作。
400 | 231005 | The thread has been no-trace removed, cannot put reaction. | 目标消息是一个话题消息，该话题消息被无痕撤回，无法进行操作。
400 | 231007 | The operator has no permission to delete this reaction. | 当前操作者没有权限删除某个表情回复。原因为表情回复的原始添加人不是当前操作者。
400 | 231008 | The operator has no access to the message. | 操作人对该消息没有访问权限，通常是因为操作人不在消息所在会话内。
400 | 231010 | The reaction does not belong to the message. | 待删除的表情回复不属于指定的消息，请检查 reaction_id 和 message_id 是否匹配。
400 | 231011 | The request has an invalid reaction_id. | reaction_id 参数不合法，无法定位到真实存在的表情回复。请获取并传入正确的 reaction_id 后重试。
400 | 231012 | The request has an invalid pageToken. | page_token 参数不合法。请根据 page_token 参数描述，设置正确的值。
400 | 231013 | The request has an invalid AuthType. | 请求的授权方式不合法。没有使用 tenant_access_token 或者 user_access_token 进行授权。
400 | 231015 | Act on reaction failed, repeated request is processing. | 重复的表情回复请求正在处理中。
400 | 231018 | The message is invisible to the operator. | 该消息对于操作者不可见，无法进行本操作。
400 | 231019 | Due to the settings of this user, you are temporarily unable to perform this operation. | 由于目标用户（消息发送者）的设置（例如屏蔽消息），暂时无法执行此操作。
400 | 231020 | Due to the configuration of the tenant administrator, you cannot perform this operation on the target user temporarily. | 由于租户管理员的配置，暂时无法对目标用户（消息发送者）执行此操作，请联系租户管理员协助排查。
400 | 231021 | No permission to operate external chats. | 没有权限操作外部群。
400 | 231022 | Bot has NO availability to this user. | 单聊用户（以群聊的 chat_id 指定的消息接收者，但 chat_id 对应的群聊类型为单聊 `p2p`）不在应用机器人的可用范围内，或者是在应用的禁用范围内。<br>解决方案：<br>1. 登录[开发者后台](https://open.feishu.cn/app)，找到并进入指定应用详情页。<br>2. 在左侧导航栏进入 **应用发布** >  **版本管理与发布** 页面，点击 **创建版本**。<br>3. 在 **版本详情** 页面，找到 **可用范围** 区域，点击 **编辑**。<br>4. 在弹出的对话框内，配置应用的可用范围，将用户添加至可用范围内。<br>5. 在页面底部点击 **保存**，并发布应用使配置生效。<br>6. （可选）如果以上配置完成后仍报错，则需要联系企业管理员登录[管理后台](https://feishu.cn/admin)，在 **工作台** > **应用管理** 中进入指定应用详情页，在 **应用可用范围** 内查看该用户是否被设置为了 **禁用成员**。<br>具体操作参见[配置应用可用范围](https://open.feishu.cn/document/home/introduction-to-scope-and-authorization/availability)。
400 | 232009 | Your request specifies a chat which has already been dissolved. | 群组已被解散，无法执行操作。

更多错误码信息，参见[通用错误码](https://open.feishu.cn/document/ukTMukTMukTM/ugjM14COyUjL4ITN)。

