Skip to content

Commit 860268b

Browse files
authored
feat: add send_business_notification (#250)
* feat: s3 convert * feat: add send_business_notification * feat: add send_business_notification * feat: add send_business_notification
1 parent 177ea7e commit 860268b

File tree

2 files changed

+192
-0
lines changed

2 files changed

+192
-0
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
sidebar_position: 5
3+
title: 发送业务通知
4+
hide_title: true
5+
---
6+
7+
<center>
8+
9+
## 发送业务通知
10+
11+
</center>
12+
13+
### 简要描述
14+
- 业务服务发送自定义通知,客户端会收到OnRecvCustomBusinessMessage回调
15+
### 请求方式
16+
- `post`
17+
### 请求URL
18+
- `{API_ADDRESS}/msg/send_business_notification`
19+
20+
21+
### Header
22+
|header名|示例值|选填|类型|说明|
23+
|:---- |:------- |:--- |---|------ |
24+
|operationID|1646445464564|必填|string|用于全局链路追踪,建议使用时间戳,在每个请求中独立|
25+
|token|eyJhbxxxx3Xs|必填|string|[管理员 token](docs/restapi/apis/authenticationManagement/getAdminToken.mdx)|
26+
27+
28+
### 请求参数示例
29+
30+
31+
```json
32+
{
33+
"sendUserID": "openIMAdmin",
34+
"recvUserID": "2839678182",
35+
"recvGroupID": "",
36+
"key": "xxx",
37+
"data": "xxxxxx",
38+
"sendMsg": false,
39+
"reliabilityLevel": 1
40+
}
41+
```
42+
|字段名|选填|类型|说明|
43+
|:---- |:------- |:--- |---|
44+
|sendUserID|必填|string|系统通知号ID,或用户ID|
45+
|recvUserID|选填|string|接收者用户ID,与`recvGroupID`只能选其中一个|
46+
|recvGroupID|选填|string|接收群ID,与`recvUserID`只能选其中一个|
47+
|key|必填|string|根据业务分类,客户端可以通过改字段用不同方法处理`data`|
48+
|data|必填|string|业务数据|
49+
|sendMsg|选填|bool|是否已消息形式发送,默认: false|
50+
|reliabilityLevel|选填|int|通知消息的可靠基本,1: 在线推送。2: 必达通知(断线重连或重新登录也会触发,用于必达的场景,该可靠性等级下,由于是顺序全量同步,建议不能发送过多,否则会影响客户端消息同步性能),默认: 1|
51+
### 成功返回示例
52+
53+
54+
```json
55+
{
56+
"errCode": 0,
57+
"errMsg": "",
58+
"errDlt": "",
59+
"data": {
60+
"serverMsgID": "8698dd5d163dd79b8fdfa333fee06f40",
61+
"clientMsgID": "1ca0e4cf279ad5cce6b28331b2b42092",
62+
"sendTime": 1679558586210
63+
}
64+
}
65+
```
66+
### 成功返回示例的参数说明
67+
68+
69+
|参数名|类型|说明|
70+
|:---- |:------- |:--- |
71+
|errCode|int|错误码,0表示成功|
72+
|errMsg|string|错误简要信息,为空|
73+
|errDlt|errDlt|错误详细信息,为空|
74+
|data|object|通用数据对象,具体结构见下方|
75+
|serverMsgID|string|服务器消息ID,预留字段|
76+
|clientMsgID|string|客户端消息ID,此ID为消息唯一ID|
77+
|sendTime|int|消息发送的时间|
78+
### 失败返回示例
79+
80+
81+
```json
82+
{
83+
"errCode": 1004,
84+
"errMsg": "RecordNotFoundError",
85+
"errDlt": ": [1004]RecordNotFoundError"
86+
}
87+
```
88+
### 失败返回示例的参数说明
89+
90+
91+
|参数名|类型|说明|
92+
|:---- |:------- |:--- |
93+
|errCode|int|错误码,具体查看全局错误码文档|
94+
|errMsg|string|错误简要信息|
95+
|errDlt|errDlt|错误详细信息|
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
sidebar_position: 5
3+
title: Send Business Notification
4+
hide_title: true
5+
---
6+
7+
<center>
8+
9+
## Send Business Notification
10+
11+
</center>
12+
13+
### Brief Description
14+
- The business service sends a custom notification, and the client receives the OnRecvCustomBusinessMessage callback
15+
16+
### Request Method
17+
- `post`
18+
19+
### Request URL
20+
- `{API_ADDRESS}/msg/send_business_notification`
21+
22+
### Header
23+
24+
| Header Name | Example Value | Optional | Type | Description |
25+
|:------------|:----------------|:---------|:-------|:---------------------------------------------------------------------------|
26+
| operationID | 1646445464564 | Required | string | Used for global trace tracking; suggested to use a unique timestamp per request |
27+
| token | eyJhbxxxx3Xs | Required | string | [Admin token](/restapi/apis/authenticationManagement/getAdminToken) |
28+
29+
### Request Parameters Example
30+
31+
```json
32+
{
33+
"sendUserID": "openIMAdmin",
34+
"recvUserID": "2839678182",
35+
"recvGroupID": "",
36+
"key": "xxx",
37+
"data": "xxxxxx",
38+
"sendMsg": false,
39+
"reliabilityLevel": 1
40+
}
41+
```
42+
43+
| Field Name | Optional | Type | Description |
44+
|:-----------------------|:---------|:---------|:----------------------------------------------------------------------------|
45+
| sendUserID | Required | string | System notification ID, or user ID |
46+
| recvUserID | Optional | string | Receiver user ID, can only choose one from `recvGroupID` |
47+
|recvGroupID| Optional |string|Receive group ID, you can only choose one from `recvUserID`|
48+
|key| Required |string|Depending on the business classification, the client can process `data` in different ways by changing the field|
49+
|data| Required |string|Business data|
50+
|sendMsg| Optional |bool|Whether to send as a message, default: false|
51+
|reliabilityLevel| Optional |int|The reliability of notification messages is as follows: 1: Online push. 2: Must-reach notification (will also be triggered by disconnection and reconnection or re-login, used for scenarios where must-reach notifications are required. At this reliability level, since it is a sequential full synchronization, it is recommended not to send too many messages, otherwise it will affect the client message synchronization performance). Default: 1|
52+
53+
54+
### Success Response Example
55+
56+
```json
57+
{
58+
"errCode": 0,
59+
"errMsg": "",
60+
"errDlt": "",
61+
"data": {
62+
"serverMsgID": "8698dd5d163dd79b8fdfa333fee06f40",
63+
"clientMsgID": "1ca0e4cf279ad5cce6b28331b2b42092",
64+
"sendTime": 1679558586210
65+
}
66+
}
67+
```
68+
69+
### Success Response Parameters Description
70+
71+
| Parameter Name | Type | Description |
72+
|:---------------|:-------|:----------------------------------------|
73+
| errCode | int | Error code; 0 indicates success |
74+
| errMsg | string | Brief error message, empty if none |
75+
| errDlt | errDlt | Detailed error information, empty if none |
76+
| data | object | General data object, structure detailed below |
77+
| serverMsgID | string | Server message ID; reserved field |
78+
| clientMsgID | string | Client message ID; unique ID for message |
79+
| sendTime | int | Time the message was sent |
80+
81+
### Failure Response Example
82+
83+
```json
84+
{
85+
"errCode": 1004,
86+
"errMsg": "RecordNotFoundError",
87+
"errDlt": ": [1004]RecordNotFoundError"
88+
}
89+
```
90+
91+
### Failure Response Parameters Description
92+
93+
| Parameter Name | Type | Description |
94+
|:---------------|:-------|:------------------------------------------------|
95+
| errCode | int | Error code, refer to global error code documentation |
96+
| errMsg | string | Brief error message |
97+
| errDlt | errDlt | Detailed error information |

0 commit comments

Comments
 (0)