The problem
A bot that writes Telegram or Discord messages cannot automatically send spoken replies. It needs a tool that turns its words into audio, followed by a way to attach that audio to the message. The messaging app alone does not give the bot a voice.
How NativePort helps
NativePort connects to ElevenLabs to turn a bot’s written reply into a spoken audio file. Your bot can then have its Telegram or Discord connection send that file as a voice reply. This adds speech to the conversation while the messaging app handles delivery.
Let your agent build it
You don’t need to write this code yourself. Copy the prompt and paste it into your agent. It will follow NativePort’s setup guide, help you use an existing account or create one, read this page, and ask what you’d like to do next.
View prompt
Help me use NativePort for this use case. 1. Read https://nativeport.ai/SKILL.md and follow its instructions to learn how to use NativePort. Save or update the skill if your environment supports it. 2. Check whether I already have a working NativePort connection or account. Reuse it if available. Otherwise, help me sign in or create an account by following the skill's setup instructions. Guide me through any steps that require me to use a browser, then help connect my agent. Keep credentials private. 3. Follow the skill to learn how to find the right tools, check their prices and instructions, and use them through NativePort. 4. Read this entire use-case page, including the instructions for agents inside the accordion: https://nativeport.ai/use-cases/voice-bots/ Once setup is complete and you have read the page, briefly explain what you can help me do and ask me what I would like to do next. Wait for my answer before implementing the example or running paid tools.
Instructions for the agents - You don't need to read this
Technical implementation
Use Python 3 with requests installed (python -m pip install requests). Set NATIVEPORT_API_KEY in your environment to your NativePort key. Run the snippets on your server, where your key stays private.
Choose a voice with GET /elevenlabs/v1/voices, then set VOICE_ID. This function produces the audio bytes to attach in your existing bot handler.
import os
import requests
BASE = "https://api.nativeport.ai"
HEADERS = {"Authorization": f"Bearer {os.environ['NATIVEPORT_API_KEY']}"}
def spoken_reply(text):
response = requests.post(
BASE + "/elevenlabs/v1/text-to-speech/" + os.environ["VOICE_ID"],
headers=HEADERS,
json={"text": text, "model_id": "eleven_multilingual_v2"},
timeout=120,
)
response.raise_for_status()
return response.content
audio_bytes = spoken_reply("Your booking is confirmed for tomorrow at ten.")
with open("reply.mp3", "wb") as audio:
audio.write(audio_bytes)In Telegram, attach reply.mp3 using your bot’s sendAudio method. In Discord, attach it to a channel reply through your bot framework. This example creates a spoken message; joining a live voice channel needs a separate playback integration. Keep the speech call off your bot’s event loop if the framework is asynchronous. For incoming voice messages, use the speech-to-text workflow.
Tool costs
| Tool used in the example | Price per call |
|---|---|
| ElevenLabs — text to speech | $0.000211 / credit (usage-based) |
Prices in USD. Usage-based tools have no fixed per-call price. View pricing.