Mattermost has a manual knob for pausing notifications until a given time point, but (as of now) no way to set a schedule so that notifications are paused at the end of every work day. There is an issue and who knows when it is implemented.
However, Mattermost has a documented API. And that API lets us specify a status and an expiration time. So we can set statuses programmatically.
And then we can put a command to set the status into a crontab. (If you are on Windows, use Scheduled Tasks instead.) Boom! DND schedule on the cheap.
Python 3.8+ and a few thirdparty libraries:
On Ubuntu, you can install these with:
$ sudo apt install python3-appdirs python3-iso8601 python3-requests
Otherwise, pip3
is your friend.
$ ./mm-status -s https://mm.example.com/ -u myname login
This will ask you for your password, log in and store a login token in your home directory. After this, the following commands will work.
$ ./mm-status dnd --for=PT15H
Set the Do Not Disturb status for 15 hours.
(The --for
option uses ISO 8601 syntax for intervals.)
$ ./mm-status dnd --until=2022-08-17T10:00
Same but until a specific time in your local time zone. (You can use any valid ISO 8601 date+time here.)
$ ./mm-status online
Go back online.
$ ./mm-status custom --for PT15H --emoji zzz 'Not working'
Set a custom status.
--until
works, too.
$ ./mm-status --help
$ ./mm-status <subcommand> --help
Read this!