How to delete slack message via Ubuntu CMD?

I use Mup to deploy my app to server.
I created .sh auto-backup script and upload backup-data to Slack Channel.

curl -F file=@PrefixName_$(date +%Y-%m-%d).tar.gz -F channels=#SLACK_CHANNEL_NAME -F token=SLACK_TOKEN https://slack.com/api/files.upload

But now I would like to create .sh script to delete slack message before date condition.
Please help me.

Thanks for your reply.


But I don’t know the Timestamp of my chart message.
And I would like to dell all message Lester then 30 days.
Could example the cmd?

What I wanted to say with that link: This is not a slack forum. Maybe there is a better place to ask.
Maybe these links will help you
Npm package: https://github.com/tahaipek/slack-channel-cleaner
Windows command line tool: https://github.com/kfei/slack-cleaner/blob/master/slack_cleaner/cli.py
I guess you should be able to adapt the command line tool to work on ubuntu

thanks I will try soon