流式消息
请求URL
https://chat-go.jwzhd.com/open-apis/v1/bot/send-stream?token=016ec8e4d17a4fbda3ccb0e99b44aca0
技术原理
text
流式传输消息采用分块传输编码(Chunked transfer encoding)技术。
请求头中需要设置`Transfer-Encoding: chunked`,表示使用分块传输编码。请求类型
POST
请求头
bash
Transfer-Encoding: "chunked"请求URL参数
| 字段 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| recvId | string | 是 | 接收消息对象ID 用户: userId 群: groupId |
| recvType | string | 是 | 接收对象类型 用户: user 群: group |
| contentType | string | 是 | 消息类型,取值如下 text/markdown |
响应内容
| 字段 | 类型 | 说明 |
|---|---|---|
| code | int | 响应代码 |
| msg | string | 响应信息,包括异常信息 |
| data | Object | 返回数据 |
完整示例
bash
curl --location 'https://chat-go.jwzhd.com/open-apis/v1/bot/send-stream?token=016ec8e4d17a4fbda3ccb0e99b44aca0&recvId=307149245&recvType=group&contentType=text' \
--header 'Transfer-Encoding: chunked' \
--header 'Content-Type: text/plain' \
--data-binary '@/E:/download/Windowsdownload/temp/tempdemo.txt'注意: 如果使用浏览器/postman调试,请移除 Transfer-Encoding 头,让 浏览器/Postman 自动处理分块传输:
bash
curl --location 'https://chat-go.jwzhd.com/open-apis/v1/bot/send-stream?token=016ec8e4d17a4fbda3ccb0e99b44aca0&recvId=307149245&recvType=group&contentType=text' \
--header 'Content-Type: text/plain' \
--data-binary '@/E:/download/Windowsdownload/temp/tempdemo.txt'响应内容示例
json
{
"code": 1,
"data": {
"messageInfo": {
"msgId": "57815794deeb4166958d9774401b47f0",
"recvId": "307149245",
"recvType": "group"
}
},
"msg": "success"
}