|
| 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