Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add send_business_notification #250

Merged
merged 7 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions docs/restapi/apis/messageManagement/send_business_notification.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
sidebar_position: 5
title: 发送业务通知
hide_title: true
---

<center>

## 发送业务通知

</center>

### 简要描述
- 业务服务发送自定义通知,客户端会收到OnRecvCustomBusinessMessage回调
### 请求方式
- `post`
### 请求URL
- `{API_ADDRESS}/msg/send_business_notification`


### Header
|header名|示例值|选填|类型|说明|
|:---- |:------- |:--- |---|------ |
|operationID|1646445464564|必填|string|用于全局链路追踪,建议使用时间戳,在每个请求中独立|
|token|eyJhbxxxx3Xs|必填|string|[管理员 token](docs/restapi/apis/authenticationManagement/getAdminToken.mdx)|


### 请求参数示例


```json
{
"sendUserID": "openIMAdmin",
"recvUserID": "2839678182",
"recvGroupID": "",
"key": "xxx",
"data": "xxxxxx",
"sendMsg": false,
"reliabilityLevel": 1
}
```
|字段名|选填|类型|说明|
|:---- |:------- |:--- |---|
|sendUserID|必填|string|系统通知号ID,或用户ID|
|recvUserID|选填|string|接收者用户ID,与`recvGroupID`只能选其中一个|
|recvGroupID|选填|string|接收群ID,与`recvUserID`只能选其中一个|
|key|必填|string|根据业务分类,客户端可以通过改字段用不同方法处理`data`|
|data|必填|string|业务数据|
|sendMsg|选填|bool|是否已消息形式发送,默认: false|
|reliabilityLevel|选填|int|通知消息的可靠基本,1: 在线推送。2: 必达通知(断线重连或重新登录也会触发,用于必达的场景,该可靠性等级下,由于是顺序全量同步,建议不能发送过多,否则会影响客户端消息同步性能),默认: 1|
### 成功返回示例


```json
{
"errCode": 0,
"errMsg": "",
"errDlt": "",
"data": {
"serverMsgID": "8698dd5d163dd79b8fdfa333fee06f40",
"clientMsgID": "1ca0e4cf279ad5cce6b28331b2b42092",
"sendTime": 1679558586210
}
}
```
### 成功返回示例的参数说明


|参数名|类型|说明|
|:---- |:------- |:--- |
|errCode|int|错误码,0表示成功|
|errMsg|string|错误简要信息,为空|
|errDlt|errDlt|错误详细信息,为空|
|data|object|通用数据对象,具体结构见下方|
|serverMsgID|string|服务器消息ID,预留字段|
|clientMsgID|string|客户端消息ID,此ID为消息唯一ID|
|sendTime|int|消息发送的时间|
### 失败返回示例


```json
{
"errCode": 1004,
"errMsg": "RecordNotFoundError",
"errDlt": ": [1004]RecordNotFoundError"
}
```
### 失败返回示例的参数说明


|参数名|类型|说明|
|:---- |:------- |:--- |
|errCode|int|错误码,具体查看全局错误码文档|
|errMsg|string|错误简要信息|
|errDlt|errDlt|错误详细信息|
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
sidebar_position: 5
title: Send Business Notification
hide_title: true
---

<center>

## Send Business Notification

</center>

### Brief Description
- The business service sends a custom notification, and the client receives the OnRecvCustomBusinessMessage callback

### Request Method
- `post`

### Request URL
- `{API_ADDRESS}/msg/send_business_notification`

### Header

| Header Name | Example Value | Optional | Type | Description |
|:------------|:----------------|:---------|:-------|:---------------------------------------------------------------------------|
| operationID | 1646445464564 | Required | string | Used for global trace tracking; suggested to use a unique timestamp per request |
| token | eyJhbxxxx3Xs | Required | string | [Admin token](/restapi/apis/authenticationManagement/getAdminToken) |

### Request Parameters Example

```json
{
"sendUserID": "openIMAdmin",
"recvUserID": "2839678182",
"recvGroupID": "",
"key": "xxx",
"data": "xxxxxx",
"sendMsg": false,
"reliabilityLevel": 1
}
```

| Field Name | Optional | Type | Description |
|:-----------------------|:---------|:---------|:----------------------------------------------------------------------------|
| sendUserID | Required | string | System notification ID, or user ID |
| recvUserID | Optional | string | Receiver user ID, can only choose one from `recvGroupID` |
|recvGroupID| Optional |string|Receive group ID, you can only choose one from `recvUserID`|
|key| Required |string|Depending on the business classification, the client can process `data` in different ways by changing the field|
|data| Required |string|Business data|
|sendMsg| Optional |bool|Whether to send as a message, default: false|
|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|


### Success Response Example

```json
{
"errCode": 0,
"errMsg": "",
"errDlt": "",
"data": {
"serverMsgID": "8698dd5d163dd79b8fdfa333fee06f40",
"clientMsgID": "1ca0e4cf279ad5cce6b28331b2b42092",
"sendTime": 1679558586210
}
}
```

### Success Response Parameters Description

| Parameter Name | Type | Description |
|:---------------|:-------|:----------------------------------------|
| errCode | int | Error code; 0 indicates success |
| errMsg | string | Brief error message, empty if none |
| errDlt | errDlt | Detailed error information, empty if none |
| data | object | General data object, structure detailed below |
| serverMsgID | string | Server message ID; reserved field |
| clientMsgID | string | Client message ID; unique ID for message |
| sendTime | int | Time the message was sent |

### Failure Response Example

```json
{
"errCode": 1004,
"errMsg": "RecordNotFoundError",
"errDlt": ": [1004]RecordNotFoundError"
}
```

### Failure Response Parameters Description

| Parameter Name | Type | Description |
|:---------------|:-------|:------------------------------------------------|
| errCode | int | Error code, refer to global error code documentation |
| errMsg | string | Brief error message |
| errDlt | errDlt | Detailed error information |
Loading