Hey folks! This is my very first Medium post and I wanted to take this as an opportunity to share my project with you.
So let me introduce you to Meow!
Meow is a little modified Maneki-Neko. At first sight, she looks like any other happy lucky cat but once she’s connected to a WiFi network and integrated into your Slack environment (as a common Slack Bot), Meow starts to wave directly after you’ve received a Slack message.
Before I started this project I was really annoyed by receiving Slack messages all the time during work. Because there is nothing more disturbing than these little notification banners flying into your viewport, grabbing your attention and distracting you from work. So I thought the simplest solution is to switch to ‘do not disturb’.
Receiving an instant message is not a bad thing at all, don’t get me wrong. But what I could observe during work is, if somebody sends an instant message via Slack, this person also wants an instant answer back. So if the receiver (me) does not answer quickly enough, the sender (teammate) will find another way to get his answer. For example: Yelling at you loud from the other side of the office to read and answer your Slack messages…
Therefore I wanted to receive Slack messages without being actively disturbed in my rhythm, regardless if I answer them quickly enough or not. My approach was to translate something so trivial, like the receiving of an instant message, out of its digital realm, onto a physical object. This physical object should imitate a behavior during the reception, that generates attention, but in a more subliminal way, then these notification banners.
So I came up with Meow. Every time I receive a message in a Slack channel, Meow is listening to my user-id and starts waving at me. Of course, a Slack channel can contain a lot of messages, but in my case, I prioritized Slack messages, containing my user-id, as more urgent than messages without.
And this is how it works. Since I was working on an ESP32, I took a closer look at the JSON formatted messages I received in my console. After playing around with the Slack REST API for a while, I came up with this comparison:
On the left, you can see the JSON message I received after sending only some text via Slack. On the right side, the JSON message contains text, a user-id, and an emoji. So basically both JSON messages have the same root object called “text” containing the raw text output.
Since I am only looking for my user-id and avoiding some cumbersome text comparison, I had to take a closer look. Fortunately, the JSON contains an array called “blocks” which in turn contains two furthermore arrays and a user-id I can watch for when receiving Slack messages.
So I came up with a for loop which iterates through all elements in the array, looking for my predefined user-id, and writes a serial print in my console, if there is a match. Note: During the loop through the array, I recommend you to do your text comparison without the strcmp() function. In some cases, this could cause a null pointer dereferencing and your controller starts to reboot again and again.
The next thing was to understand, how these happy lucky cats work. Long story short: A magnet mounted to the inside end of the arm is swinging over a coil. Every time the magnet crosses the coil, this movement induces a voltage. By running current through the coil the swinging arm gets a little push and keeps moving on. So if you want to know more about how this works, I can really recommend you to take a closer look at the links below.
As you can see, the connection between the cat’s coil and the controller is through its 3V3 pin and a data pin connected with the GND of the coil. The data pin is declared as output and initially set LOW. So, every time a teammate mentions me in a message, the data pin is set to HIGH and the current flows through the coil.
When the message has been read and I have given a reaction to it, the data pin will set to LOW and the paw swings out.
In order to use Meow outside the testing environment, she’s serving an HTML page within an access point to configure WiFi credentials. Once there is a connection, you can reload the page and enter your specific Slack Bot token and the user-id you want to watch for while receiving Slack messages.
And that’s it :) I am looking forward to uploading all the project files and 3D models on Github as soon as possible. I am interested in sharing some more projects, so stay tuned!