19

I want to set up an #emergency channel in which important messages will come from an incoming webhook and will contain @channel in them.

I want these notifications to be seen immediately by all who have joined the channel, regardless of the time or their Do Not Disturb (DND) settings.

It seems that there is no API to change the DND settings of anyone but the "current user" (the user invoking the API call). Otherwise I would turn off all channel members' DND before posting a message, then restore original DND settings.

Is there some other way to ensure that DND does not stop notifications on this #emergency channel?

Everyone who joins the #emergency channel will know that they may receive notifications at any time, so these notifications will not be unexpected.

(Note that this is not a work-related Slack team, it's a community organization and messages on the #emergency channel are about real emergencies.)

Dan Tenenbaum
  • 1,809
  • 3
  • 23
  • 35
  • 2
    Any updates? have you found a solution? – Snufkin Oct 11 '18 at 11:13
  • This question is still update to date. I have the same use case and looking for a solution. How did you solve this? I think about setting up a second slack workspace for this use case. Asking everybody to disable DND. – FredFlitsPaal Sep 26 '20 at 09:20

1 Answers1

0

You can end the current DND session of a user with dnd.endDnd. But as you pointed out those API methods only work for the owner of a token.

If you want to end the DND sessions of other users your app therefore needs to have tokens from all users that participate in the #emergency channel. It can then call the API method with the token for each user to end the DND session.

This can be achieved by asking every user to install your Slack app once. They will run through the normal Oauth process and generate a new token for themselves. Your app can collect and store those tokens for later use.

Here is a rough outline of the basic logic:

  1. Get the list of users in the emergency channel with conversations.members

  2. Get DND settings for those users with dnd.teamInfo

  3. Disable DND settings for users that are currently in DND session with dnd.endDnd

In addition you need to consider rate limits for this method, which is Tier 2 (max. 20 calls per minute). Depending on how many users are in DND and while considering rate limiting that process might take too long in an emergency. Therefore I would suggest to first issue a ping to everyone with @channel EMERGENCY and then repeat that emergency ping for the ex-dnd users, after their dnd session has been disabled, e.g. @user-1 @user-2 @user-3 EMERGENCY.

Erik Kalkoken
  • 30,467
  • 8
  • 79
  • 114