You can call this operation to send messages to all online users in a group.
The QPS limit is 10 calls per second.
The client receives the message notification in the following ZIM SDK callbacks.
iOS | Android | macOS | Windows |
---|---|---|---|
Web | Flutter | Unity3D | React Native |
The following table describes only the operation-specific request parameters and some common request parameters. For the complete list of common request parameters, see the Public request parameters section of the Accessing Server APIs topic.
Parameter | Type | Required | Description |
---|---|---|---|
FromUserId |
String |
Yes |
The ID of the message sender. |
GroupId |
String |
Yes |
The group chat ID. |
MessageType |
Number |
Yes |
The message type. For more information about group message types, see MessageBody Introduction. |
Priority |
Number |
Yes |
The message priority. Valid values:
|
MessageBody |
Object |
Yes |
The message content. For more information, see MessageBody Introduction. |
SubMsgType |
Number |
No (Yes if MessageType is 200 ) |
The custom message type. Value range: [0,200]. |
SearchedContent |
String |
No |
The search field for a custom message. This field is valid only if MessageType is 200 , cannot exceed 64 bytes in length, and must be specified to search for custom messages in the client. |
The FromUserId
and GroupId
parameters can contain only digits, letters, and the following characters: '!', '#', '$', '%', '&', '(', ')', '+', '', ':', ';', '<', '=', '.', '>', '?', '@', '[', ']', '^', '_', '{', '}', '|', '~'.
2.0.0
(for more information about versions, see Release notes), the ZIM server supports only command messages whose MessageType
is 2
.MessageType
is 1
, the version of the ZIM SDK needs to be 2.7.0 or later.MessageType
is 200
, the version of the ZIM SDK needs to be 2.8.0 or later.Request URL:
https://zim-api.zego.im/?Action=SendGroupMessage
&<Common request parameters>
Request body:
{
"FromUserId": "u1",
"GroupId": "r1",
"MessageType": 1,
"Priority": 1,
"MessageBody": {
"Message":"hello world",
"ExtendedData":"d",
"OfflinePush" :{
"Enable":0,
"Title":"Title",
"Content":"Content",
"Payload":"data"
}
}
}
Parameter | Type | Description |
---|---|---|
Code |
Number |
The return code. |
Message |
String |
The description of the request result. |
RequestId |
String |
The request ID. |
MsgSeq |
Number |
The sequence of the message. This field is empty for command messages and can be used to Recall a group message. |
MsgId |
Number |
The ID of the message. |
{
"Code":0,
"Message":"success",
"RequestId":"343649807833778782",
"MsgSeq": 1,
"MsgId": 1
}
The following table describes only the return codes related to the business logic of the operation. For the complete list of return codes, see <https://doc-preview-en.zego.im/article/14024" target="_blank" rel="noopener">Return codes.
Return Code | Description | Solution |
---|---|---|
660000025 |
Failed to send the Base64-encoded signaling message when IsBase64 is set to 1 in MessageBody . |
Check the following items: - Check whether IsBase64 needs to be set to 1 , that is, whether a binary signaling message needs to be sent. - Check whether the message is Base64-encoded. |
660400001 |
The message size exceeds the limit. |
Check the message size. |
660500002 |
The message sender has not logged in to the ZIM SDK. |
Log in to the ZIM SDK before sending the message. |
660600001 |
The group ID does not exist. |
Check whether the value of the GroupId parameter is valid. |