|
| 1 | +--- |
| 2 | +sidebar_position: 13 |
| 3 | +title: batch_send_msg |
| 4 | +hide_title: true |
| 5 | +--- |
| 6 | + |
| 7 | +<center> |
| 8 | + |
| 9 | +## Batch Send Message |
| 10 | + |
| 11 | +</center> |
| 12 | + |
| 13 | +### Brief Description |
| 14 | +- Batch send messages. |
| 15 | + |
| 16 | +### Request Method |
| 17 | +- `POST` |
| 18 | + |
| 19 | +### Request URL |
| 20 | +- `http://x.x.x.x:10002/msg/batch_send_msg` |
| 21 | + |
| 22 | +### Header |
| 23 | +| Header Name | Example Value | Required | Type | Description | |
| 24 | +|:----------- |:-------------- |:-------- |------- |------------------------------------- | |
| 25 | +| operationID | 1646445464564 | Required | string | operationID used for global tracing | |
| 26 | +| token | eyJhbxxxx3Xs | Required | string | Admin token | |
| 27 | + |
| 28 | +### Request Parameter Example |
| 29 | + |
| 30 | +```json |
| 31 | +{ |
| 32 | + "sendID": "openIMAdmin", |
| 33 | + "senderNickname": "Gordon", |
| 34 | + "senderFaceURL": "http://www.head.com", |
| 35 | + "senderPlatformID": 1, |
| 36 | + "content": { |
| 37 | + "text": "{\"content\":\"hello world!\"}" |
| 38 | + }, |
| 39 | + "contentType": 101, |
| 40 | + "sessionType": 1, |
| 41 | + "isOnlineOnly": false, |
| 42 | + "notOfflinePush": false, |
| 43 | + "offlinePushInfo": { |
| 44 | + "title": "send message", |
| 45 | + "desc": "", |
| 46 | + "ex": "", |
| 47 | + "iOSPushSound": "default", |
| 48 | + "iOSBadgeCount": true |
| 49 | + }, |
| 50 | + "isSendAll": true |
| 51 | +} |
| 52 | +``` |
| 53 | + |
| 54 | +### Parameter Description |
| 55 | + |
| 56 | +| Field Name | Required | Type | Description | |
| 57 | +|:---------------- |:-------- |------- |--------------------------------------------------------------------------- | |
| 58 | +| sendID | Required | string | Sender ID (can be admin ID or user ID) | |
| 59 | +| recvIDs | Optional | array | List of receiver IDs, required for sessionType 1 or 4, for individual user chats; leave empty for group chats | |
| 60 | +| senderNickname | Optional | string | Sender's nickname | |
| 61 | +| senderFaceURL | Optional | string | Sender's profile picture URL | |
| 62 | +| senderPlatformID | Optional | int | Sender's platform ID, fill when simulating user sending: 1->iOS, 2->Android, 3->Windows, 4->OSX, 5->Web, 6->MiniWeb, 7->Linux, 8->AndroidPad, 9->iPad | |
| 63 | +| content | Required | object | The actual message content, internally a JSON object, for details refer to the message type format documentation | |
| 64 | +| contentType | Required | int | Message type, 101 for text, 102 for image, etc. Refer to message type format documentation for more details | |
| 65 | +| sessionType | Required | int | Conversation type, 1 for individual chat, 2 for group chat (normal write spread), 3 for large group (read spread interface), 4 for notification conversation | |
| 66 | +| isOnlineOnly | Optional | boolean| When set to true, the message is not stored on the server; only online recipients will receive the message, and the message will be lost if they are offline | |
| 67 | +| notOfflinePush | Optional | boolean| When set to true, the message will not trigger offline push notifications for offline users | |
| 68 | +| offlinePushInfo | Optional | object | Offline push notification details, if not provided, default server push title is used | |
| 69 | +| offlinePushInfo.title | Optional | string | Push notification title | |
| 70 | +| offlinePushInfo.desc | Optional | string | Push notification description | |
| 71 | +| offlinePushInfo.ex | Optional | string | Extension field | |
| 72 | +| offlinePushInfo.iOSPushSound| Optional | string | iOS push sound | |
| 73 | +| offlinePushInfo.iOSBadgeCount| Optional| boolean| Whether the iOS push notification increments the badge count on the app icon| |
| 74 | +| isSendAll | Optional | boolean| Whether to send to all users | |
| 75 | + |
| 76 | +### Success Response Example |
| 77 | + |
| 78 | +```json |
| 79 | + |
| 80 | +``` |
| 81 | + |
| 82 | +### Success Response Parameter Description |
| 83 | + |
| 84 | +| Parameter Name | Type | Description | |
| 85 | +|:-------------- |:----- |----------------------------------------- | |
| 86 | +| errCode | int | Error code, 0 indicates success | |
| 87 | +| errMsg | string| Brief error message, empty if no error | |
| 88 | +| errDlt | string| Detailed error message, empty if no error| |
| 89 | +| data | object| General data object, refer to the structure below| |
| 90 | + |
| 91 | +### Failure Response Example |
| 92 | + |
| 93 | +```json |
| 94 | +{ |
| 95 | + "errCode": 1004, |
| 96 | + "errMsg": "RecordNotFoundError", |
| 97 | + "errDlt": ": [1004]RecordNotFoundError" |
| 98 | +} |
| 99 | +``` |
| 100 | + |
| 101 | +### Failure Response Parameter Description |
| 102 | + |
| 103 | +| Parameter Name | Type | Description | |
| 104 | +|:-------------- |:----- |-------------------------- | |
| 105 | +| errCode | int | Error code, refer to the global error code documentation for details | |
| 106 | +| errMsg | string| Brief error message | |
| 107 | +| errDlt | string| Detailed error message | |
0 commit comments