The Shhlack-bot

If you haven’t read my other post on Microservices… don’t worry, it’s totally unnecessary in the understanding of this one, but it will make more sense if you have.

Back in the days when the revolution of #Microservices&APIs was a trending topic in my team, we thought that some critical alerts could be sent via Slack. We all agreed that that an API-Chat would be needed in case we wanted to make things right. Luckily we had two trainees whose skills needed to be tested, so we put them in charge of developing a RESTful API-Chat which was able to abstract various ways of sending messages to different chat platforms. Since Slack was the main chat platform, we decided to go with that integration first.

Once the API was finished we realized we didn’t need to deal with Slack-apps, attaching Slack-bots to channels or setting up tedious Webhooks. We got completely independent of modules like python-slackclient or node-slack-sdk. Everyone in the office could send a message through Slack with a single curl.

By the time the office was getting more and more crowded as new people were hired. We were running out of quiet places and every time someone had an important meeting we hopelessly asked for silenced.

It was time to demonstrate how powerful this kind of abstraction could be, so my friend and I decided to build The Shhlack-bot. Built from a NodeMCU (ESP8266) and a sound detection sensor (KY-037) we managed to build our toy, a simple device that would send a message via Slack when ever the office was too noisy.

At first sight the spinning wheel in the sensor, with which you regulate the sound levels, looks like it has infinite turns. We thought our little buddy wasn’t working until we read that it has only ten turns, and then you would hear a gentle * click * that will let you know that you are at the max/min decibels possible even though might still be able to turn the wheel right or left. Only then did we realize how to properly setup the sound levels.

Spamming slack be like..

In case you wan’t to replicate our shhlack-bot, I’ll leave the code and techs used in this project at the end of the post. Please consider leaving a comment or upvoting this post in the following subreddit

Bibliography and technology used in this project


Author: Lucas Contreras

Leave a comment: Join the Reddit discussion