跳到主要内容

事件列表

本文列出所有可订阅的事件类型。

消息事件​

事件类型说明
message.receive收到用户发送的消息
message.read消息被已读

message.receive​

当用户 @机器人 或在私聊中发送消息时触发。

{
"event_type": "message.receive",
"data": {
"message_id": "msg_xxxxxx",
"sender_id": "user_001",
"sender_name": "张三",
"room_id": "room_001",
"room_type": "group",
"msg_type": "text",
"content": {
"text": "@Bot 查询今日订单"
},
"mentions": ["bot_001"],
"timestamp": 1703232000000
}
}

卡片交互事件​

事件类型说明
card.action用户点击卡片按钮

card.action​

当用户点击卡片消息中的按钮时触发。

{
"event_type": "card.action",
"data": {
"message_id": "msg_xxxxxx",
"user_id": "user_001",
"action": {
"tag": "button",
"value": "approve"
},
"timestamp": 1703232000000
}
}

用户事件​

事件类型说明
user.add_bot用户添加机器人
user.remove_bot用户移除机器人

群组事件​

事件类型说明
group.bot_added机器人被添加到群组
group.bot_removed机器人被移出群组