事件列表
本文列出所有可订阅的事件类型。
消息事件
| 事件类型 | 说明 |
|---|---|
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 | 机器人被移出群组 |