Send Group Status Message
Users within an application can send group status messages to a group. Messages sent through this interface can only be received by group members who are currently online. If a group member is offline, they will not receive this status message.
- By default, messages sent through this interface will not be synchronized to the sender's client. For synchronization, refer to the
isIncludeSender
parameter usage. - A maximum of 3 groups can be targeted in a single message send.
About Group Status Messages
The server provides the group status message interface /statusmessage/group/publish.json
. Any type of message sent through this interface has the following characteristics:
- Only online group members can receive this message.
- The message is not counted or stored on the server. Therefore, if the recipient is currently offline, they will not receive this message, nor can they retrieve it from the server's historical messages.
- By default, post-messaging callback is not supported.
When the mobile client receives messages sent through this interface, it processes them in the same way as other one-to-one chat messages. The client determines whether to count the message as unread or store it locally based on the message type's storage and counting attributes. For details on the storage and counting attributes of predefined message types in the IM service, refer to the Message Type Overview. If you are sending a custom message type, pay attention to the specific counting and storage attributes of that custom message type in the client.
Request Method
POST: https://Data Center Domain/statusmessage/group/publish.json
Rate Limit: A maximum of 20 messages can be sent per second. Note that sending a message to 3 groups counts as 3 messages.
Signature Rule: All server API requests require rule validation. For details, refer to API Request Signature.
Body Parameters
The HTTP request body data format is application/x-www-form-urlencoded
, and the following HTTP form parameters are supported:
Parameter | Type | Required | Description |
---|---|---|---|
fromUserId | String | Yes | The sender's user ID. Non-group members can also send messages to the group via the Server API. |
toGroupId | String | Yes | The recipient group ID. Providing multiple parameters allows sending messages to multiple groups, with a maximum of 3 groups. |
objectName | String | Yes | The message type, which accepts built-in message types (see Message Type Overview) or custom message type values. Note: When defining custom messages, the message type must not start with "RC:" to avoid conflicts with system-built-in message types; the message type length must not exceed 32 characters. The SDK must have registered this custom message type; otherwise, the SDK will not be able to parse the message when received. |
content | String | Yes | The content of the message being sent, with a maximum size of 128k per message.
|
isIncludeSender | Int | No | Whether to synchronize the sent message to the sender's client. 1 means synchronize, default is 0 , meaning no synchronization. Note that this interface is used for sending status messages, so synchronization is only supported if the sender is logged into the client (online). |
Request Example
POST /statusmessage/group/publish.json HTTP/1.1
Host: api.rong-api.com
App-Key: uwd1c0sxdlx2
Timestamp: 1585127132438
Nonce: 14314
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: application/x-www-form-urlencoded
content=%7B%22content%22%3A%22hello%22%2C%22extra%22%3A%22helloExtra%22%7D&fromUserId=2191&toGroupId=2193&toGroupId=2192&objectName=RC:TxtMsg&isIncludeSender=0
Response
The HTTP response body contains a JSON object with the following structure:
Return Value | Return Type | Description |
---|---|---|
code | Number | Return code, 200 indicates success. |
messageUIDs | Array | List of messageUIDs |
messageUIDs[i].groupId | String | Group ID, corresponding to the request's toGroupId |
messageUIDs[i].messageUID | String | The unique ID of the message sent to the corresponding group |
Response Example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"code": 200,
"messageUIDs": [
{
"groupId": "2191",
"messageUID": "XXXX-JJJJ-KKK-LLLL"
},
{
"groupId": "2192",
"messageUID": "XXXX-JJJJ-KKK-LLKL"
}
]
}