Skip to main content

Overview

Sends a group message from your server. Supported message types include @-mention messages, plain-text messages, images, audio, and more.

Request

Authentication Add authentication headers to the request. See Authentication

Method POST

Rate limit 100 requests/second

Endpoint https://API domain/apigateway/messages/group/send

Content-Type application/json

Request Parameters

ParameterData TypeRequiredDescription
sender_idstringYesSender ID. Maximum length: 32 characters.
target_idsarrayYesGroup IDs. Each ID can contain up to 32 characters.
msg_typestringYesMessage type identifier. Maximum length: 50 characters.
msg_contentstringYesMessage content. JSON is recommended.
to_user_idsarrayNoIDs of group members who receive this directed message. Each ID can contain up to 32 characters.
push_data.push_textstringNoPush-notification text.
push_data.push_extrastringNoCustom push-notification data. A JSON string is recommended.
push_data.push_levelnumberNoPush priority: 0 default; 1 ignores push rate limiting; 2 ignores Mute Notifications.
is_storageboolNoWhether to store the message in message history. Default: true.
is_countboolNoWhether to include the message in the unread count. Default: true.
is_notify_senderboolNoWhether to notify the sender. Default: true.
is_stateboolNoWhether this is a state message. State messages have high sending throughput.
mention_info.mention_typestringNo@-mention type: mention_all for everyone; mention_someone for specified users; mention_all_someone for everyone and specified users.
mention_info.target_user_idsarrayNoUser IDs to mention when mention_type is mention_someone. Each ID can contain up to 32 characters.
refer_msgobjNoReferenced message.
life_timeintNoMessage lifetime in milliseconds. 0 means that the message does not expire.
life_time_after_readintNoMessage lifetime after it is read, in milliseconds.

Request Example

POST /apigateway/messages/group/send HTTP/1.1
appkey: appkey
signature: 2e639ae3600a4sdff61fb88b76f485b
nonce: nonce
timestamp: 1672568121910
Content-Type: application/json

{
"sender_id":"userid1",
"target_ids":["groupid1","groupid2"],
"msg_type":"text",
"msg_content":"{\"content\":\"aabbcc\"}",
"to_user_ids":["userid1"]
"push_data":{
"push_text":"push content",
"push_extra":"extra",
"push_level":0
},
"is_storage":true,
"is_notify_sender":true,
"is_state":false,
"mention_info":{
"mention_type":"mention_all",
"target_user_ids":["userid1","userid2"]
},
"refer_msg":{
"msg_id":"xxx",
"sender_id":"xxx",
"target_id":"xxx",
"channel_type":1,
"msg_type":"xxx",
"msg_content":"xxxxx"
}
}

Response Parameters

ParameterData TypeDescription
msg_idstringUnique message identifier.

Response Example

{
"code":0,
"msg":"sucess",
"data":[
{
"target_id":"groupid1",
"msg_id":"aaaaaaa"
},
{
"target_id":"groupid2",
"msg_id":"bbbbbbb"
}
]
}