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 🙂

9 thoughts on “Audio/sound emojis in Slack”

  1. Hey there! Inspired by what you’ve written here. I’ve created a node based Slack bot based on what you’ve talked about here (couldn’t get Python working in my environment). As of writing it’s VERY specifically configured to play sound from the second available device on a windows machine (or test on the primary). The idea here was being able to listen to music in an office with my headphones on my primary output, but run the audio bot through my speakers. A bit of tweaking might sort that out if anyone is interested! https://github.com/BrenMurrell/slack-audiobot

    1. Awesome! Hope it provides your office with as much ridiculousness as it has ours. We have over 500 sounds now – it really started ballooning when I added the “add-sound” command.

      1. Hah! I have’t done anything _that_ technical. I just shared the sound subfolder. It seems to be exploding. I’ve also managed to get it working on our office Mac now, so it’s cross platform. Have just added TTS to it to so it can say things. The boss / company owner has even been using it! Huge success.

  2. Hi,

    Just wondering if this still works? Downloaded it a few days back to try use it for some sound automation stuff in slack, got it to show connecting to token but then just seems to hang?

    1. did you get it to work eventually? I seem to be facing the same exact problem. It says ‘connecting to ‘ and hangs..

Leave a Reply

Your email address will not be published. Required fields are marked *