curl -X POST "http://localhost:5001/messages" \
-H "Content-Type: application/json" \
-d '{
"message_ids": [123456789, 123456790, 123456791]
}'
const response = await fetch('http://localhost:5001/messages', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
message_ids: [123456789, 123456790, 123456791]
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"message_ids": [123456789, 123456790, 123456791]
}
response = requests.post('http://localhost:5001/messages', json=data)
result = response.json()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]interface{}{
"message_ids": []int64{123456789, 123456790, 123456791},
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/messages",
"application/json",
bytes.NewBuffer(jsonData),
)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result []map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("%+v\n", result)
}
[
{
"message_id": 123456789,
"message_seq": 1001,
"client_msg_no": "msg_123",
"from_uid": "user123",
"channel_id": "group123",
"channel_type": 2,
"timestamp": 1640995200,
"payload": "SGVsbG8gV29ybGQ="
},
{
"message_id": 123456790,
"message_seq": 1002,
"client_msg_no": "msg_124",
"from_uid": "user456",
"channel_id": "group123",
"channel_type": 2,
"timestamp": 1640995260,
"payload": "SGkgdGhlcmU="
}
]
消息管理
批量消息搜索
根据消息 ID 列表批量搜索多条消息
POST
/
messages
curl -X POST "http://localhost:5001/messages" \
-H "Content-Type: application/json" \
-d '{
"message_ids": [123456789, 123456790, 123456791]
}'
const response = await fetch('http://localhost:5001/messages', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
message_ids: [123456789, 123456790, 123456791]
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"message_ids": [123456789, 123456790, 123456791]
}
response = requests.post('http://localhost:5001/messages', json=data)
result = response.json()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]interface{}{
"message_ids": []int64{123456789, 123456790, 123456791},
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/messages",
"application/json",
bytes.NewBuffer(jsonData),
)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result []map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("%+v\n", result)
}
[
{
"message_id": 123456789,
"message_seq": 1001,
"client_msg_no": "msg_123",
"from_uid": "user123",
"channel_id": "group123",
"channel_type": 2,
"timestamp": 1640995200,
"payload": "SGVsbG8gV29ybGQ="
},
{
"message_id": 123456790,
"message_seq": 1002,
"client_msg_no": "msg_124",
"from_uid": "user456",
"channel_id": "group123",
"channel_type": 2,
"timestamp": 1640995260,
"payload": "SGkgdGhlcmU="
}
]
概述
根据消息 ID 列表批量搜索多条消息,适用于需要同时获取多条消息详情的场景。请求体
curl -X POST "http://localhost:5001/messages" \
-H "Content-Type: application/json" \
-d '{
"message_ids": [123456789, 123456790, 123456791]
}'
const response = await fetch('http://localhost:5001/messages', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
message_ids: [123456789, 123456790, 123456791]
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"message_ids": [123456789, 123456790, 123456791]
}
response = requests.post('http://localhost:5001/messages', json=data)
result = response.json()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]interface{}{
"message_ids": []int64{123456789, 123456790, 123456791},
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/messages",
"application/json",
bytes.NewBuffer(jsonData),
)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result []map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("%+v\n", result)
}
[
{
"message_id": 123456789,
"message_seq": 1001,
"client_msg_no": "msg_123",
"from_uid": "user123",
"channel_id": "group123",
"channel_type": 2,
"timestamp": 1640995200,
"payload": "SGVsbG8gV29ybGQ="
},
{
"message_id": 123456790,
"message_seq": 1002,
"client_msg_no": "msg_124",
"from_uid": "user456",
"channel_id": "group123",
"channel_type": 2,
"timestamp": 1640995260,
"payload": "SGkgdGhlcmU="
}
]
响应字段
响应是一个消息对象数组,每个消息对象包含以下字段:integer
必填
服务器生成的消息 ID
integer
必填
消息序列号
string
必填
客户端消息编号
string
必填
发送者用户 ID
string
必填
频道 ID
integer
必填
频道类型
1- 个人频道2- 群组频道
integer
必填
消息时间戳(Unix 时间戳)
string
必填
Base64 编码的消息内容
状态码
| 状态码 | 说明 |
|---|---|
| 200 | 消息搜索成功 |
| 400 | 请求参数错误 |
| 404 | 部分或全部消息不存在 |
| 500 | 服务器内部错误 |
⌘I

