Create a mood ring with Glitch, Slack, and LIFX

code × August 31, 2018

Earlier this year I attended a Slack Session called Building your first Slack integration. It gave me a ton of ideas. Naturally, I decided to turn my office lamp into a mood ring as dictated by the emoji in my Slack status.

Here’s the mood ring in action:

Under the hood

Using Glitch, I created an Express app that listens for Slack’s Events API. In this case, I’m listening for changes made to my Slack user (which includes my status).

Once I change my status, my Glitch app will parse the emoji from the response. Next, it finds a color value based on mood.json. This file maps emoji with a hex value. Finally, the color is sent to the LIFX API where it sets my light bulb.

This was a really fun way to experiment both with Glitch and the Slack Events API.

You can check out the code on Glitch and the README to learn how I configured my Slack app.

Turn a Spotify playlist into a Jekyll post