Skip to main content

Disappearing Messages

The Disappearing Messages extension allows end-users to send messages that disappear after a certain interval of time. This extension works for both private (one-on-one) and group messages.

This extension is also known as exploding messages on some platforms.

Extension settings

  1. Login to CometChat and select your app.
  2. Go to the Extensions section and enable the Disappearing messages extension.

How does it work?

Once the messages are sent, you can immediately schedule them for deletion using the disappearing messages extension. The message with the mentioned msgId gets deleted at timeInMS.

Warning

The value of timeInMS should strictly be less than 1 year

This extension uses the callExtension method provided by the CometChat SDK.

CometChat.sendMessage(textMessage) // Can be any type of message
.then(message => {
CometChat.callExtension('disappearing-messages','DELETE','v1/disappear',{
msgId: message.id, // The id of the message that was just sent
timeInMS: 1633521809051 // Time in milliseconds. Should be a time from the future.
}).then(response => {
// Successfully scheduled for deletion
})

// Logic to display the sent message on the screen.
// ...
}).catch(error => {
// Error occured
});