If you're on a team that gets pinged often in slack you'll often find yourself hitting that "Mute notifications for 24 hours" button every day off you have. I'm on such a team and got so annoyed with hitting one button once a day for 3 days that I found a way to automate the muting of notifications.

Turns out you can set your Do Not Disturb status with an API call. This particular call sets your snooze interval. There are other calls that will end DND or tell you if it's active or not which allow for even greater configuration. This kind of control could be taken as far as muting notifications when you arrive home but for my purposes a simple call works for me.

To set up a cron job that mutes notifications for 24 hours:


1: Go here: https://api.slack.com/custom-integrations/legacy-tokens
2: Make a token for yourself
3: Set up a cron job to run
curl 'https://slack.com/api/dnd.setSnooze?token=YOUR_TOKEN&num_minutes=1440&pretty=1'

Here's what my crontab entry looks like. This will mute notifications for 24 hours every Friday, Saturday, and Sunday at 8 am.

0 8 * * 5,6,7 curl 'https://slack.com/api/dnd.setSnooze?token=MY_TOKEN&num_minutes=1440&pretty=1'

Here's a good refresher on the cron formatting if you need it

This has bugged me for a while so hopefully making this helps someone else who's probably too particular with his notifications.