SendPeerMessage
https://zim-api.zego.im/
Send 1v1 one-to-one messages, supporting sending messages to a single user or batch sending to multiple users.
The target client will receive one-to-one message notifications through the ZIM SDK callback interface.
| iOS | Android | macOS | Windows |
|---|---|---|---|
| peerMessageReceived | onPeerMessageReceived | peerMessageReceived | onPeerMessageReceived |
| Web | Mini Program | Flutter | React Native |
|---|---|---|---|
| peerMessageReceived | peerMessageReceived | onPeerMessageReceived | peerMessageReceived |
| Unity3D | uni-app | uni-app x | HarmonyOS |
|---|---|---|
| OnReceivePeerMessage | peerMessageReceived | peerMessageReceived |
FromUserId and ToUserId have logged in to the ZIM service by calling the login method on the client, or the developer has registered the relevant userID by calling the server-side API.The parameters FromUserId and ToUserId only support numbers, English characters, and '!','#','$','%','&','(',')','+','-',':',';','<','=','.','>','?','@','[',']','^','_',' ','{','}','|','~'.
If the sender's SDK version (for version information, please refer to Release notes) is lower than 2.0.0, the ZIM server only supports Command type messages with MessageType 2, and does not support other types. To provide developers with a better experience, ZEGOCLOUD recommends that developers use the latest version of the SDK.
If the sender requests to send a text message with MessageType 1, the sender's corresponding client (SDK version needs to be 2.7.0 or above) will also receive the message.
For sending and receiving custom messages with MessageType 200, the SDK version of the sender's and receiver's corresponding clients needs to be 2.8.0 or above.
If the receiver's SDK version is in the [2.0.0, 2.8.0) range, they can receive custom messages, but the message type will be displayed as unknown and the message content cannot be obtained. To obtain this message, please upgrade the SDK to version 2.8.0 or above.
If the receiver's SDK version is 1.x.x, they will not be able to receive custom messages, nor will they receive unknown messages.
Request
Query Parameters
Possible values: [SendPeerMessage]
API prototype parameter
https://zim-api.zego.im/?Action=SendPeerMessage
💡Public parameter. Application ID, assigned by ZEGOCLOUD. Get it from the ZEGOCLOUD Admin Console.
💡Public parameter. A 16-character hexadecimal random string (hex encoding of 8-byte random number). Refer to Signature example for how to generate.
💡Public parameter. Current Unix timestamp, in seconds. Refer to Signature example for how to generate, with a maximum error of 10 minutes.
Possible values: [2.0]
Default value: 2.0
💡Public parameter. Signature version number.
💡Public parameter. Signature, used to verify the legitimacy of the request. Refer to Signing the requests for how to generate an API request signature.
- application/json
Responses
- 200
- application/json
