Skip to main content

Overview

Simulates a specified user sending a private message from your server. For example, after a friend request is approved, send a message such as User A added you as a friend on behalf of that user.

Request

Authentication Add authentication headers to the request. See Authentication

Method POST

Rate limit 100 requests/second

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

Content-Type application/json

Request Parameters

ParameterData TypeRequiredDescription
sender_idstringYesSender ID. Maximum length: 32 characters.
target_idsarrayYesRecipient IDs. Each ID can contain up to 32 characters.
msg_typestringYesMessage type identifier. Maximum length: 50 characters.
msg_contentstringYesMessage content. JSON is recommended.
push_data.push_textstringNoPush-notification text.
push_data.push_extrastringNoCustom push-notification data. A JSON string is recommended.
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 but are not guaranteed to be reliable.
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/private/send HTTP/1.1
appkey: appkey
signature: 2e639ae3600a4sdff61fb88b76f485b
nonce: nonce
timestamp: 1672568121910
Content-Type: application/json

{
"sender_id":"userid1",
"target_ids":["userid2","userid3"],
"msg_type":"jg:text",
"msg_content":"{\"content\":\"aabbcc\"}",
"push_data":{
"push_text":"push content",
"push_extra":"extra"
},
"is_storage":true,
"is_notify_sender":true,
"is_state":false
}

Response Parameters

ParameterData TypeDescription
msg_idstringUnique message identifier.

Response Example

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