机器人消息加急 API
将 bot 此前发送的一条消息对一个或多个接收方标记为加急。 被选中的接收方会收到加急消息通知。
接口
| 项目 | 说明 |
|---|---|
| URL | https://api-coco.typex.im/open/robot/message/urgent |
| Method | POST |
| Content-Type | application/json |
请求头
Authorization: Bearer <bot_token>
Content-Type: application/json
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
chat_id | string | 是 | 包含该消息的会话 ID。 |
message_id | string | 是 | 要标记为加急的 bot 消息 ID。 |
target_users | string[] | 是 | 接收加急通知的用户 ID。必须至少包含一个用户 ID。 |
该消息必须是 bot 在指定会话中发送的、有效且可见的消息。系统消息、已撤回、已过期或其他无效消息不能被标记为加急。在一对一会话中,target_users 必须包含对方参与者。在群组中,每个目标都必须是当前成员且能够看到该消息。
target_users 中的重复 ID 会被去重。已经针对该消息被标记过加急的用户不能再次提交;请求会被拒绝。尚未被标记加急的其他接收方可以在后续请求中添加。
示例:将消息标记为加急
curl --location 'https://api-coco.typex.im/open/robot/message/urgent' \
--header 'Authorization: Bearer <bot_token>' \
--header 'Content-Type: application/json' \
--data '{
"chat_id": "123445",
"message_id": "7543434",
"target_users": [
"124468778",
"878756565"
]
}'
成功响应
{
"code": 0,
"data": null,
"msg": "ok",
"msg_i18n": {
"en": "ok"
}
}
常见失败情况
| 情况 | 结果 |
|---|---|
| bot token 缺失或无效,或 bot 已被屏蔽 | 鉴权或权限错误 |
chat_id、message_id 或 target_users 缺失或无效 | 请求被拒绝 |
消息在 chat_id 中不存在、不是由该 bot 发送,或已不再有效 | 请求被拒绝 |
| 目标不是会话成员,或无法看到该消息 | 权限或请求错误 |
| 目标已针对该消息被标记过加急 | 请求被拒绝 |