setMessageExtensions
Introduction
Set message extension
This method only works with Ultimate Edition, you can find the pricing plan here.
This method only works with Ultimate Edition, you can find the pricing plan here.
Usage limitation: 1. the supportMessageExtension
should be set to true before the message was sent; 2. the message must be sent successfully; 3. The message couldn't be from the Community or the AVChatRoom.
If the extension key already exists, the extended value information will be modified. If the extension key does not exist, an extension will be added.
The maximum length of the extended key is 100 bytes, the maximum length of the extended value is 1KB.
Up to 20 extensions can be set once.
A message could be set with 300 extensions.
When multiple users set the same extended key at the same time, only the first user could set it successfully. The other users would receive the 23001 error code and the updated information. After receiving the error code and the latest information, please re set it as required.
We strongly suggest that different users set different extension key, so that most of the scenes won't conflict, such as voting, and investigation. You can use userID
as the extension key.
Parameter details
Parameter name | Parameter type | Required | Description |
---|---|---|---|
msgID | String | yes | Message id. |
extensions | V2TimMessageExtension[] | yes | Message extension field. |
Returned template
V2TimValueCallback<V2TimMessageExtensionResult[]>
{
code : int
desc : String
data : V2TimMessageExtensionResult[]
}
Return value details
name | type | description |
---|---|---|
code | number | Request result: Error codes. 0 means success. |
desc | string | The description of the error. It will be empty if success. |
data | V2TimMessageExtensionResult[] | Result list of setting message extension operation. |
Code example
V2TimValueCallback<V2TimMessageExtensionResult[]>
setMessageExtensionsRes = await TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.setMessageExtensions(msgID: '',
extensions: []);
if (setMessageExtensionsRes.code == 0) {
}