Create AI Voice Responses for Slack Bots A developer published a step-by-step guide for building a Slack bot that replies with synthesized speech, using the ElevenLabs text-to-speech REST API and Python. The tutorial wires Slack's Events API to a Flask endpoint that calls ElevenLabs for MP3 audio, then uploads the clip back to the channel via the Slack SDK's files_upload and chat_postMessage methods. If you’ve ever wished your Slack bot could talk back to you, you’re not alone. Adding voice responses turns a plain text interaction into a more engaging, accessible experience—perfect for status updates, alerts, or just a little fun. In this article we’ll walk through building a Slack bot that speaks using modern text‑to‑speech TTS and voice‑cloning technology. We’ll use ElevenLabs as the TTS engine the affiliate link is included below and glue everything together with a few lines of Python. TL;DR – By the end of this guide you’ll have a Slack bot that receives a message, generates a realistic voice clip with ElevenLabs, uploads it to Slack, and posts the audio file back to the channel. All of this is possible today without building a deep learning model from scratch. Services like ElevenLabs provide high‑quality, low‑latency TTS APIs that can even clone a voice from a few minutes of audio. ElevenLabs offers a straightforward REST API for generating speech. Sign up through the affiliate link below, grab your API key, and you’re ready to go: Once you have the key, you can request speech in a variety of voices, set speaking rates, and even use your own cloned voice model if you’ve uploaded a sample . The API returns an MP3 stream that we’ll later upload to Slack. First, create a Slack app: chat:write files:write app mentions:read xoxb- . You’ll also need the Signing Secret under Basic Information for request verification. Below is a minimal Python function that sends a prompt to ElevenLabs and returns the raw MP3 bytes. python import requests ELEVENLABS API KEY = "YOUR ELEVENLABS API KEY" ELEVENLABS TTS URL = "https://api.elevenlabs.io/v1/text-to-speech/EXAMPLE VOICE ID" def synthesize speech text: str - bytes: """Call ElevenLabs TTS and return MP3 data.""" headers = { "xi-api-key": ELEVENLABS API KEY, "Content-Type": "application/json" } payload = { "text": text, "model id": "eleven monolingual v1", "voice settings": { "stability": 0.75, "similarity boost": 0.85 } } response = requests.post ELEVENLABS TTS URL, json=payload, headers=headers response.raise for status return response.content Tip: Replace EXAMPLE VOICE ID with the ID of the voice you want to use. You can list your voices via the /v1/voices endpoint or use a cloned voice ID if you’ve uploaded a custom sample. Slack doesn’t support streaming audio directly in a message, but you can upload an MP3 file and share it. Here’s a helper that takes the MP3 bytes from the previous step and posts it back to the channel where the bot was mentioned. python from slack sdk import WebClient from slack sdk.errors import SlackApiError SLACK BOT TOKEN = "xoxb-YOUR SLACK BOT TOKEN" slack client = WebClient token=SLACK BOT TOKEN def upload and post audio bytes: bytes, channel: str, title: str = "Voice reply" : try: Upload the file first upload resp = slack client.files upload channels=channel, file=audio bytes, filename="reply.mp3", title=title, filetype="mp3" Share the file in a message slack client.chat postMessage channel=channel, text=f"Here’s the voice response:", attachments= { "fallback": title, "title": title, "file id": upload resp "file" "id" } except SlackApiError as e: print f"Slack error: {e.response 'error' }" Now let’s create a simple Flask endpoint that Slack will hit whenever the bot is mentioned. The flow is: event callback with the message text. synthesize speech . python from flask import Flask, request, jsonify import hmac import hashlib import os app = Flask name SLACK SIGNING SECRET = os.getenv "SLACK SIGNING SECRET" def verify slack request req : timestamp = req.headers.get "X-Slack-Request-Timestamp" sig basestring = f"v0:{timestamp}:{req.get data as text=True }" my sig = "v0=" + hmac.new SLACK SIGNING SECRET.encode , sig basestring.encode , hashlib.sha256 .hexdigest slack sig = req.headers.get "X-Slack-Signature" return hmac.compare digest my sig, slack sig @app.route "/slack/events", methods= "POST" def slack events : if not verify slack request request : return "Invalid request", 403 data = request.json Respond to URL verification challenge if data.get "type" == "url verification": return jsonify {"challenge": data "challenge" } Only handle app mention events if data.get "event", {} .get "type" == "app mention": event = data "event" channel = event "channel" user text = event "text" Remove the bot mention part cleaned text = user text.split " " 1 .strip if " " in user text else user text Generate speech audio = synthesize speech cleaned text Post back to Slack upload and post audio, channel, title=f"Reply to <@{event 'user' } " return "", 200 if name == " main ": app.run port=3000 What you need to run this: pip install flask slack sdk requests SLACK SIGNING SECRET SLACK BOT TOKEN ELEVENLABS API KEY Expose the Flask server with a tool like ngrok and add the public URL to your Slack app’s Event Subscriptions subscribe to app mention . EXAMPLE VOICE ID with that ID. Your bot can now sound like your team lead, mascot, or even yourself. /voice speed=1.2 text=Hello . You now have a fully functional Slack bot that listens, converts text to a natural‑sounding voice, and replies with an audio file—all powered by ElevenLabs. Play around with different voices, experiment with voice cloning, and consider adding a UI in Slack to let users pick their favorite voice. 🔊 Ready to give your Slack bot a voice? Try ElevenLabs today and bring your bots to life: https://try.elevenlabs.io/kr07zfuqn1bp https://try.elevenlabs.io/kr07zfuqn1bp Happy coding 🚀