Delete messages
Community channel messages are stored on the server (free storage for 7 days) and in the local database. Users can delete messages from their own history — locally only or from the server only.
tip
- Deleting messages only removes them from the current user's history, without affecting other users.
- To permanently delete a message for all community members, use the recall message feature.
Delete messages before a timestamp (all subchannels)
Delete messages across all subchannels of a community channel before a specified timestamp.
Dart
final community = CommunityChannel('<community-id>');
await community.deleteMessagesForMeByTimestamp(
DeleteMessagesForMeByTimestampParams(
timestamp: <cutoff-timestamp>,
policy: MessageOperationPolicy.local,
),
(error) {
if (error?.isSuccess == true) {
print('All subchannel messages cleared');
}
},
);
Delete messages before a timestamp (specific subchannel)
Delete messages in a specific subchannel before a timestamp.
Dart
final subChannel = CommunitySubChannel('<community-id>', '<subchannel-id>');
await subChannel.deleteMessagesForMeByTimestamp(
DeleteMessagesForMeByTimestampParams(
timestamp: <cutoff-timestamp>,
policy: MessageOperationPolicy.local,
),
(error) {
if (error?.isSuccess == true) {
print('Subchannel messages cleared');
}
},
);