Signal Do Not Disturb to Co-Workers on Slack

Let coworkers know you're busy with Slack and don't want to be interrupted.

Slack messaging app

Slack is an awesome messaging app for teams. If you're using it at work, wouldn't it be great to integrate it with Focus so you could let your co-workers know when you were available?

With a little work, we can do just that!

Read on to learn how. The following steps can get a little advanced, so if you need help contact [email protected].

Getting setup

We'll be using node-slack-cli an open-source project that lets us control Slack from the command line.

Open /Applications/Utilities/ and type:

npm install node-slack-cli -g

This installs the package onto your computer.

Next visit and under "Authentication" click Create Token next to the team you want to create the token for.

Copy the token for use below.

Tell Slack when you start Focusing

Now you can add the following lines in Preferences > Scripting > Focus

export PATH=$PATH:/usr/local/bin
/usr/local/bin/slack -c general -m "I've started a Focus session" -u YOUR_USERNAME_GOES_HERE

Replace YOUR_TOKEN_GOES_HERE with the token from Slack and YOUR_USERNAME_GOES_HERE with your username.

You can customize the message I've started a Focus session to say whatever you want and change the channel by changing general to whichever channel you want.

These lines, in order, say:

  1. Let Focus know where the node program lives by adding it's directory to our path
  2. Setup the Slack token
  3. Send the command to Slack

That's it. Now you should see something like the following in your Slack channel when you Focus:

Slack chat

Tell Slack when you stop Focusing

To notify a Slack room when you stop Focusing, add the following lines in Preferences > Scripting > Unfocus

export PATH=$PATH:/usr/local/bin
/usr/local/bin/slack -c general -m "I've stopped a Focus session" -u YOUR_USERNAME_GOES_HERE

Replace the same tokens from above, and customize the message and channel if needed.

That's it! Now your coworkers know if it's a good time to bug you or if they should wait until you're done working.

Having a hard time staying on task because of distractions? Focus is an app for your Mac computer that helps you stay on track. It blocks things that can distract you so you can get your work done. Try Focus and see how much better you can do!
Download Focus
← Back to blog
Focus Productivity on July 19, 2015