The problem
A voice note contains sound, not text tokens. An agent configured for text cannot read that file simply because it receives a link or filename. It needs a transcription step before it can respond to the words that were spoken.
How NativePort helps
NativePort sends the recording to ElevenLabs and returns the transcript. Your agent can then handle a voice message much like a written message. The original audio remains useful when a name, number, or unclear phrase needs checking.
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.
Set AUDIO_PATH to a local MP3 recording.
import os
import requests
BASE = "https://api.nativeport.ai"
HEADERS = {"Authorization": f"Bearer {os.environ['NATIVEPORT_API_KEY']}"}
with open(os.environ["AUDIO_PATH"], "rb") as audio:
response = requests.post(BASE + "/elevenlabs/v1/speech-to-text",
headers=HEADERS,
data={"model_id": "scribe_v1"},
files={"file": ("recording.mp3", audio, "audio/mpeg")},
timeout=180)
response.raise_for_status()
transcript = response.json()
print(transcript["text"])Send transcript["text"] to your agent as the user’s message. For other formats, change the multipart filename and media type. This is a recording-upload workflow, not a live microphone stream. The transcription reference describes available options.
Tool costs
| Tool used in the example | Price per call |
|---|---|
| ElevenLabs — speech to text | $0.026375 / call |
Prices in USD. Usage-based tools have no fixed per-call price. View pricing.
Let your agent build it
You don’t need to write this code yourself. Copy this page’s link and paste it into your agent. Ask it to follow the guide and implement the feature for you.