Audio/sound emojis in Slack

Slack is hands-down the best team chat app there is. It’s simple, fun, incredibly easy to learn, and astonishingly powerful. However, it lacks custom audio emojis, despite the fact that they’ve been in development and “coming” for months. I can understand this. Having your chat app make annoying noises can be immensely frustrating, especially if you’re in a pod with 10 other people running Slack.

That said, sounds have a place, and has been a part of software development since the dark ages. After Mosaic was unleashed on the internet back in 1994, sound notifications let the team know when someone downloaded it:

We sat in the conference room and hooked up the big TV to one of the Indys, so that we could sit around in the dark and watch the FTP download logs scroll by. jg hacked up an impromptu script that played the sound of a cannon shot each time a download successfully completed. We sat in the dark and cheered, listening to the explosions.

When I worked at Flight Centre, one of our neighbour teams had a build server that played a sound bite of Salt-N-Pepa’s Push It when someone pushed code to integration. Our SME would hit a Bullshit button whenever she signed off a user story as completed.

So, to that end, I made a slack bot that responds to messages like ‘play pushit’ by actually playing the associated sound file. It runs on a box that sits in the corner in our office that’s hooked up to speakers. Here’s how you can set one up in your office.

Team sound emojis in Slack

On the computer you want to play the sounds, you’ll need to install python, a sound player and the tiny bot script I wrote: slack-sounds.

Assuming you’re running Ubuntu, install python-dev and python-pip:

$ sudo apt-get install python-dev python-pip

Now you can install the dependencies:

$ sudo pip install websocket
$ sudo pip install slackclient

You’ll also need an audio player – I used mpg123 because it can handle mp3 files right out of the box.

$ sudo apt-get install mpg123

Finally, you can clone the actual bot:

$ git clone git@github.com:caseyfw/slack-sounds.git

Once you’ve done all that, you can now set up the bot on slack

Create a new bot user integration in your slack team. I called ours ‘sounds’.

Copy the API token out from that page and paste it into a file called token.txt in the slack-sounds directory. The bot will use this token to authenticate with Slack.

Time to fire it up and test it out!

$ python sounds.py

Now in Slack, you can try messaging your bot. Slack-sounds will respond to messages of the format:

play <sound>

For a list of sounds, check out the sounds directory – they’re straight from Campfire.

To add sounds, just put another mp3 file in that directory.

What next?

It’d be really nice to write a method of adding sounds to the bot via Slack, like imagine if you could type:

add-sound <name> <audio url>

Feel free to fork the repo have a crack yourself 🙂