消息列表
请求URL
https://chat-go.jwzhd.com/open-apis/v1/bot/messages?token=016ec8e4d17a4fbda3ccb0e99b44aca0
请求类型
GET
请求头
bash
Content-Type: "application/json"请求参数
| 字段 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| chat-id | string | 是 | 获取消息对象ID 用户: 使用userId 群: 使用groupId |
| chat-type | string | 是 | 获取消息对象类型 用户: user 群: group |
| message-id | string | 否 | 消息ID,不填时可以配合before参数返回最近的N条消息 |
| before | int | 否 | 指定消息ID前N条,默认0条 |
| after | int | 否 | 指定消息ID后N条,默认0条 |
响应内容
| 字段 | 类型 | 说明 |
|---|---|---|
| code | int | 响应代码 |
| msg | string | 响应信息,包括异常信息 |
| data | Object | 返回数据 |
请求示例
text
// 获取群ID【xxx】中最新 10 条消息,共返回 10 条消息
https://chat-go.jwzhd.com/open-apis/v1/bot/messages?token=xxxxx&chat-id=xxx&chat-type=group&before=10
// 获取群ID【xxx】中消息 ID【xxxx】前 10 条消息,共返回 11 条消息
https://chat-go.jwzhd.com/open-apis/v1/bot/messages?token=xxxxx&chat-id=xxx&chat-type=group&message-id=xxxx&before=10
// 获取群ID【xxx】中消息 ID【xxxx】后 10 条消息,共返回 11 条消息
https://chat-go.jwzhd.com/open-apis/v1/bot/messages?token=xxxxx&chat-id=xxx&chat-type=group&message-id=xxxx&after=10
// 获取群ID【xxx】中消息 ID【xxxx】前后各 10 条消息,共返回 21 条消息
https://chat-go.jwzhd.com/open-apis/v1/bot/messages?token=xxxxx&chat-id=xxx&chat-type=group&message-id=xxxx&before=10&after=10
// 获取用户ID【xxx】中消息 ID【xxxx】前 10 条消息,共返回 11 条消息
https://chat-go.jwzhd.com/open-apis/v1/bot/messages?token=xxxxx&chat-id=xxx&chat-type=user&message-id=xxxx&before=10完整示例
bash
curl --location 'https://chat-go.jwzhd.com/open-apis/v1/bot/messages?token=016ec8e4d17a4fbda3ccb0e99b44aca0&chat-id=307149245&chat-type=group&message-id=57815794deeb4166958d9774401b47f0&before=1&after=0'响应示例
json
{
"code": 1,
"data": {
"list": [
{
"msgId": "57815794deeb4166958d9774401b47f0",
"parentId": "",
"senderId": "86297657",
"senderType": "bot",
"senderNickname": "yunhu test bot",
"contentType": "text",
"content": {
"text": "这里是一些示例使用的文字内容。",
"tip": "本内容由AI生成,仅供参考"
},
"sendTime": 1761755075535,
"commandName": "",
"commandId": 0
},
{
"msgId": "0a6b658c079e45d19216b14cd69ba7cc",
"parentId": "",
"senderId": "86297657",
"senderType": "bot",
"senderNickname": "yunhu test bot",
"contentType": "text",
"content": {
"buttons": [
[
{
"actionType": 2,
"text": "复制",
"value": "xxxx"
},
{
"actionType": 1,
"text": "点击跳转",
"url": "http://www.baidu.com"
}
]
],
"text": "这里是消息内容"
},
"sendTime": 1761754362746,
"commandName": "",
"commandId": 0
}
],
"total": 2
},
"msg": "success"
}不正常的请求示例
bash
curl --location 'https://chat-go.jwzhd.com/open-apis/v1/bot/messages?token=016ec8e4d17a4fbda3ccb0e99b44aca0&chat-id=307149245&chat-type=group&message-id=57815794deeb4166958d9774401b47f0&before=0&after=0'不正常的响应示例
json
{
"code": 1,
"data": {
"list": [],
"total": 0
},
"msg": "success"
}