Automate Your Slack Status

Josh Hamilton
Made by Munsters
Published in
3 min readMay 24, 2017

--

Slack is one of the most powerful communication tools we have as a fully remote company. Recently, Slack released a much improved status system to let your coworkers know where and what you are currently doing. This has made life a little easier, as instead of going to the main Slack channel and scrolling through the messages to find out if someone is on lunch or maybe out for the day, we can instantly see their status next to each users name.

Of course this also has a downside as what if you forget to update your status for the rest of the day? Your coworkers might think you are unreachable when really you are at your office working away. To simplify the most basic use case of this new status system I was able to use IFTTT (IF This Then That). This lets me set certain locations on a map and when I am within those locations it updates my Slack status with the appropriate status. Let’s walk through how to get this setup for your own Slack status.

01. GRAB A LEGACY TOKEN

If you go to Slack Legacy Token you can generate a legacy token for any Slack Team you would like to set this up for. A legacy token in Slack is an older way to authenticate yourself and will work great for our simple use case of setting up a status. The token should look something like this

//Slack Legacy Token xoxp-125234376-360123512234-18112345234-5634dasadsfhad345234573afb02c34s

02. OVERVIEW SLACK STATUS API

Slack has a pretty simple endpoint for setting up a status. You can find the documentation for this here. In short, we want to make a POST request with a JSON payload that is a URL-encoded profile parameter to slack.com/api/users.profile.set and include the Legacy Token we obtained from the previous step.

{ "status_text": "riding a train", "status_emoji": ":mountain_railway:" }//Request https://slack.com/api/users.profile.set?token=super_secret_token&profile=%7B%22status_text%22%3A%22riding%20a%20train%22%2C%22status_emoji%22%3A%22%3Amountain_railway%3A%22%7D

Now that we have an endpoint to go to and the legacy token setup we can start to create our IFTTT Applet.

03. SETUP IFTTT APPLET

By going to Create Applet we can start to craft out our simple interface. The IF portion will use the Location Recipe and you can pick a location that you would like to be triggered.

By default IFTTT Location Recipe gives you the ability to setup for entering, leaving, and entering & leaving a location. Next we can use the Maker Webhook Recipe in order to trigger a status change. This will simply have the URL created from the JSON url encoded profile payload and legacy token above with the Method setup to POST.

After that you can click the create action, give it a brief name, setup the Receive notifications when this Applet runs toggle to your own preference, and proceed to finish.

04. FINISHING UP

After setting up a few Applets, you are ready to go with automating your Slack status. Take note you will need the IFTTT application on your phone logged in to track your location.

As a few examples, I have my Applets setup to show Out of the Office with a Car emoji whenever I am not at my home office. In addition, if my location is at the gym it will show a Gym status with a runner emoji and if I arrive back home it will show Working Remotely. You can setup as many status automations that you need and you will never have to worry about forgetting to update your status again.

Originally published at madebymunsters.com.

--

--