On this page

Restore messages

restore() recovers soft-deleted messages and their attached files. Hard-deleted messages cannot be restored.

Requires Message Persistence

Enable Message Persistence and Enable Delete-From-History in the Admin Portal.

Method signature

icon

Under the hood


This method has the following signature:

1message.restore()
2: Promise<Message>

Input

This method doesn't take any parameters.

Output

TypeDescription
Promise<Message>
Object returning the restored Message object.

Sample code

Restore a previously soft deleted message with the 16200000000000001 timetoken.

1// reference the "message" object
2const message = await channel.getHistory({
3 startTimetoken: "16200000000000000",
4 endTimetoken: "162000000000000001"
5})
6// soft delete this message
7await message.delete({
8 soft: true
9})
10
11// restore the deleted message
12await message.restore()
Last updated on