You can delete either individual messages or entire conversations and channels. Deleting a conversation also deletes the associated messages. Deleting a message only affects that message and its parts.
Layer supports two deletion modes:
- My devices: Content will only be deleted for the currently authenticated user. The deletion will also propagate to the user’s other devices. The content will not be deleted for other participants who have access to it.
- This option is not avaialble for deleting channels
- This option is not avaialble for deleting messages within channels
- All participants: The object will be marked as deleted (“tombstoned”) from all devices for all participants. The deleted object will be considered completely deleted, and will not appear in queries or other SDK methods.
Marking content as deleted does not immediately purge it from storage. Deletion of the underlying content happens asynchronously.
// Deletes a message for all participants message.delete(layer.Constants.DELETION_MODE.ALL); // Deletes a message for current user message.delete(layer.Constants.DELETION_MODE.MY_DEVICEs) // Delete a message within a Channel, which does not support deletion modes message.delete();
// Deletes a conversation for all participants conversation.delete(layer.Constants.DELETION_MODE.ALL);
// Deletes a channel for all participants; this is the only mode, so no arguments needed. conversation.delete();
Leaving a conversation
Leaving a conversation means that the user is removed as a participant, and the Conversation is deleted on all the user’s devices.
Leaving a Channel is not yet available.
It is possible to delete a conversation across all the user’s devices, without removing the user as a participant:
Conversation will be removed from the user’s devices, but since the user is still a participant, new
Message objects in the
Conversation will cause the
Conversation to be restored to all the user’s devices.