/ SDKs / JavaScript
SDKs
Chat SDKs JavaScript v4
Chat SDKs JavaScript
Chat SDKs
JavaScript
Version 4

Clear the chat history in a group channel

Copy link

By using the resetMyHistory() method, you can help the current user clear the chat history in a group channel and start a fresh conversation with other members in the same channel. As the method's name implies, the chat history will be cleared only from the channel view of the current user, and will no longer be shown in that view. But the messages aren't deleted from the database of the Sendbird system, and other members can still see all the messages in their channel views.

This method simply clears the messages for the user by updating the lastMessage and messageOffsetTimestamp properties of a group channel object which is caused by resetMyHistory(). In addition, other internally managed data such as the number of the user’s unread message is cleared as well.

JavaScriptTypeScript
await channel.resetMyHistory();