How to share audio messages on Slack
Before we start I just wanted to give full disclosure that I’m a Co-Founder of Aflorithmic, so expect some bias towards what we’re building. Not only is it my job, audio tech is my passion.
Aflorithmic makes scalable audio, something that has never been possible before, due to the fact that voice content has to be recorded. Our main product api.audio provides the infrastructure to do that. You can use Text to speech for creating voice content, add a sound design, master the track and do all of that automatically for thousands of versions. Job done? Well, there’s more. As an infrastructure there should also be connectivity with other services and apps.
So we built an integration for Slack. There are many of them, so why does it matter? The reason why I think this is important is because it’s a connector to our infrastructure. You can create your audio tracks on api.audio and share them into Slack. We’re building a lot of these connectors so you’ll hear me talking about those a lot more in the future.
But let me show you how it works. Or as I like to term it — ‘show me the code’.
1. Create your Slack account
Go to https://slack.com/intl/en-es/help and click on Sign up
(👍 Already have a Slack account? You’re all set! Move on to step 2)
2. Create your Slack app and set it up
1️⃣ Log into your Slack account, and select select the Slack Workspace to send messages to
2️⃣ Go to https://api.slack.com/ and click on Create a custom app
3️⃣ Choose a name and a Development Slack Workspace and click on Create App
4️⃣ On the left menu click on OAuth & Permissions and under “Bot Token Scopes” select Add an OAuth Scope. Select “files:write”, “groups:write” and “chat:write”.
5️⃣ Scroll up and click on Install to Workspace and Allow. Copy the Bot User OAuth Token.
6️⃣ Now, in Slack Workspace, find the group you want to send the audio message to and copy&paste: /invite @your_App_name.
Now we can start coding!
3. Create your audio file with the API.audio
1️⃣ Obtain and import your API key
2️⃣ Create and download a voice clip from text with API.audio
(👍 Customise your script text and choose your favourite speaker and background track!)
4. Send a message to the Slack channel with a file attached!
📘 The following sample code is given by the Slack API documentation. More information: https://api.slack.com/methods/files.upload/code
1️⃣ Paste in the Bot User OAuth Token.
2️⃣ Choose your target channel. (At the channel variable, it is possible to write the name of the channel or its id. More information about how to find the id here: https://www.wikihow.com/Find-a-Channel-ID-on-Slack-on-PC-or-Mac)
Script to send files
And that’s it!
So what is this good for? The most obvious reason I had in my mind was sending my part of the daily standup as an audio file to Slack so I can keep coding! Other people in the organisation like to send pranks using a Darth Vader filter with one of the Text To Speech voices in our library. My favourite one used a Russian voice but typed the content in English, resulting in what I think of a heavy Vladivostok accent (I’ve never been in Russia though).
I’m passionate about developer tools. And one of the key things about developer tools is that they unleash human creativity! I’m sure there are use cases that are much more advanced than what I wrote and actually useful to your business. However, I’m also a big fan of playing around with tech and seeing what comes out of it.
If you want to have a closer look at the slack connector try this: https://docs.api.audio/docs/create-an-audio-message-and-share-it-on-slack