Update your slack status automatically using node.js

My inspiration to be lazy

There is a saying (or myth) that a good developer is a lazy developer, because a lazy developer hates to do something repetitive and will find a way to automate it. Of course, this does mean that sometimes precious time is being “wasted” on solving a problem that would have been quicker without spending time on writing code. This Slack lifehack falls in that category, but I hope it can be of use to you anyway!

Update your Slack status automatically

Currently I have three main locations where I sit during the week randomly. At the Indivirtual office, at a customer’s office or at home/coffeeshop, etc… I had promised my colleagues that that they would always be able to see via my Slack status where I am. This would save them some time in searching for me. However, I forget to update the status (a lot), which leads to confusion (and inevitably chaos). After a quick Google search I learned that it wouldn’t be as easy as using IFTTT or Zapier1 since it would require code that would need to be running on your laptop to detect Wi-Fi signals. (Slack, could easily add this feature in their software though…)

UPDATE: A commentor pointed out that for the Mac Users there are some different options using Mac OSX launchd in combinations with some shell scripts instead of NodeJS: Automating my Slack status based on my wi-fi location

Three easy steps:

1: Download and install node.js from nodejs.org

If you have nodejs installed on your laptop already you can immediately skip to step 2

2: Download and install the code from our Github environment: Indivirtual@Github

All you have to edit is the config.js file, which looks like the code below.
The Slack token you can get via the browser by opening the Slack token link.
After that you will have to identify the SSID’s of the wifi you want to set-up. For me the office wi-fi SSID is Indivirtual (where it says OFFICE right now). Add your status text and emoji: Look it up in Slack which ones you can use.

Be careful with the updateInterval setting. Setting it too low will result in Slack being annoyed and telling you to stop spamming the status notification option.

Now you will need to install the project and test it. I would suggest for testing purposes to keep the interval number low to see if it is working correctly.

Open your Command Prompt (cmd) and navigate to your project location. Enter the following commands:

  • npm install axios
  • npm install dotenv
  • npm install
  • node app.js (or npm start)
    • This runs the program, and you will quickly see if it works in the cmd window.

cmd with example to install nodejs Slack status update script

3: Download and configure NSSM to add your nodejs project to a window service

Go to NSSM and download the latest version. It’s not an installation, so download the nssm.exe file into a logical location. Open your Command Prompt (cmd) in administrator mode; because you are going to create a windows service now! Navigate to the folder you placed nssm.exe in and enter the following commands:

  • nssm install SlackStatusUpdater “C:\Program Files\nodejs\node.exe”
  • nssm set SlackStatusUpdater AppDirectory “C:\Projects\wifi-based-slack-status”
  • nssm set SlackStatusUpdaterr AppParameters app.js
  • nssm start SlackStatusUpdater

cmd with example to install Slack status update script as windows service using NSSM

The result; A slack Status Updater windows service!

Slack Status Updater windows service has been added!

If you make a mistake, fear not. With the simple “nssm remove SlackStatusUpdater” you can remove the service again. For more commands in NSSM go the their website.


You, after you have installed the automatic Slack status update script

You should now have your automatic Wi-Fi based Slack Status update script running at your set interval. Now you can use that valuable time you have saved by implementing this lifehack finding more animated gif’s to communicate to your colleagues. Let me know if you need help or if I need help or whatever cool tricks you came up with.

Download code from Indivirtual Github: https://github.com/Indivirtual/wifi-based-slack-status


But, wait! There is more!

Get even more out of your automatic Slack updates by using IFTTT or Zapier to set a meeting status when in a meeting. In my case I used an existing Zapier template to achieve this (IFTTT didn’t want to play along): https://zapier.com/app/editor/template/15953.It connects to my Google work Calendar and sets the status 1 minute before it starts. But, you are free to play around in this Zapier template, of course. Enjoy your automation!

  1. In today’s age of automation, there’s simply no reason you should spend precious seconds every morning brewing coffee when you could be catching an extra five minutes of ZZZs. It seems as if ‘automation,’ ‘productivity’ and ‘efficiency’ are developers’ favorite terms these days and thus new products meant to save time and effort are hitting the market at lightening speed. IFTTT and Zapier are two well known examples, but Google for more examples

Hendrik Beenker

Hendrik Beenker is a Solution Architect who has been delivering website solutions to you since 2000. He joined Indivirtual in 2004 and has worked on corporate websites and environments, specializing in CMS implementations such as Tridion, Episerver, Hippo and Umbraco. Loves Social Media, Cloud solutions and dreams of a technocracy.