이 페이지는 현재 영어로만 제공되며 한국어 버전은 곧 제공될 예정입니다. 기다려 주셔서 감사드립니다.

과거 메시지 비우기

Feature Description

When messages in a conversation are cleared, all the messages in the conversation will be cleared both locally and from the cloud, but the conversation itself will not be deleted.
Note
1. When messages in a conversation are cleared, unreadCount will be set to 0, and the content of lastMessage will be cleared as well.
2. This API cannot be used to clear messages in a topic.
3. To delete a conversation when clearing messages in the conversation, use the deleteConversation API.

Clearing Messages

API
chat.clearHistoryMessage(conversationID);
Parameters
Name
Type
Description
conversationID
String
Conversation ID, in the format of:
C2C${userID} (for one-to-one chats)
GROUP{groupID} (for group chats)
Return values
Promise
Sample
// Clear one-to-one messages locally and from the cloud
let promise = chat.clearHistoryMessage('C2CExample');
promise.then(function(imResponse) {
// Messages cleared successfully
}).catch(function(imError){
console.warn('clearHistoryMessage error:', imError); // Message clearing failure information
});
// Clear group messages locally and from the cloud
let promise = chat.clearHistoryMessage('GROUPExample');
promise.then(function(imResponse) {
// Messages cleared successfully
}).catch(function(imError){
console.warn('clearHistoryMessage error:', imError); // Message clearing failure information
});