Deleting messages in a channel automatically


I currently have a golang bot in a mattermost channel that users use for Q&A. Is there a way to delete all messages in the channel at 23:59 every evening? Sort of like an auto refresh function.

This function will be helpful when in a scenario where a user might choose to scroll back into the chat bot’s history to find an answer instead of asking it.This can cause some confusion because the older information might not be current.

  • Victoria

Hi @vlee,

Thanks for your question,

There isn’t a way to delete all messages in a channel via the UI but there might be a way using the command line interface.

I’ll check with our devs and get back to you…

Hi @vlee,

That sounds somewhat similar to the data retention feature in Enterprise Edition, but that’s configured on a system-wide basis, not for a single channel.

In terms of deleting posts with the command line, there’s no option to do that, so you’d need something custom to do it.

For people who are looking for an alternative to the data retention feature but are using the open source version I have made a small guide: