deleteMessages
Introduction
Delete messages from both local and remote server.
This API deletes messages both locally and from the cloud, which cannot be recovered.
Up to 30 messages can be deleted per call.
Messages to be deleted per call must be from the same conversation.
This API can be called only once per second.
If messages have been pulled on a device by an account, they will remain on the device after the API is called to delete them from the cloud; in other words, deleted messages are not synced.
The lastMessage
from V2TimConversation
will ba changed to the previous message, if the deleted message is the last message.
Parameter details
Parameter name | Parameter type | Required | Description |
---|---|---|---|
msgIDs | string[] | yes | The list of msgID of the messages to be deleted. |
Returned template
V2TimCallback
{
code : number
desc : string
}
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. |
Code example
import { TencentImSDKPlugin } from 'react-native-tim-js';
const deleteMessagesRes = await TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.deleteMessages(
['messageid']
);
if (deleteMessagesRes.code === 0) {
}