cd /news/artificial-intelligence/route-voicemails-with-python-and-tel… · home topics artificial-intelligence article
[ARTICLE · art-80749] src=dev.to ↗ pub= topic=artificial-intelligence verified=true sentiment=· neutral

Route Voicemails with Python and Telnyx AI

Telnyx released a Python Flask example that uses AI to classify voicemails and route them to appropriate workflows such as Slack alerts, email, or ticket queues. The app transcribes audio voicemails, then uses Telnyx AI Inference to categorize messages into types like urgent, billing, or spam, triggering corresponding actions.

read1 min views1 publishedJul 30, 2026

I built a small Flask example that turns voicemail into a routing workflow.

Code:

https://github.com/team-telnyx/telnyx-code-examples/tree/main/voicemail-smart-router-python

The app accepts either:

For audio, it transcribes the voicemail first. Then it uses Telnyx AI Inference to classify the message and decide where it should go.

The app classifies voicemails into:

urgent

billing

support

sales

spam

routine

Each category maps to a route:

urgent  -> Slack alert
billing -> email
support -> ticket queue
sales   -> CRM lead
spam    -> blocklist + archive
routine -> daily digest
git clone https://github.com/team-telnyx/telnyx-code-examples.git
cd telnyx-code-examples/voicemail-smart-router-python
cp .env.example .env
pip install -r requirements.txt
python app.py

Configure .env

:

TELNYX_API_KEY=your_telnyx_api_key
AI_MODEL=zai-org/GLM-5.2
FALLBACK_MODEL=meta-llama/Llama-3.3-70B-Instruct
HOST=127.0.0.1

Optional Slack webhook for urgent messages:

SLACK_WEBHOOK=https://hooks.slack.com/...
curl -X POST http://localhost:5000/voicemails/transcript \
  -H "Content-Type: application/json" \
  -d '{
    "transcript": "This is an emergency. Our production system is down and we need help immediately.",
    "caller_number": "+17177247292"
  }'

Example response:

{
  "category": "urgent",
  "confidence": 1.0,
  "priority": "high",
  "reason": "The caller reports a production system outage requiring immediate attention.",
  "suggested_action": "Escalate immediately to the on-call engineering team.",
  "route": "slack",
  "routed_to": "#oncall-alerts",
  "routing_status": "delivered"
}
curl -X POST http://localhost:5000/voicemails/process \
  -F "file=@voicemail.wav" \
  -F "caller_number=+17177247292"

For audio, the app calls:

POST /v2/ai/audio/transcriptions

using:

distil-whisper/distil-large-v2

Then it calls:

POST /v2/ai/chat/completions

to classify the transcript.

POST /voicemails/transcript

POST /voicemails/process

GET /voicemails

GET /voicemails/<id>

GET /routes

GET /health

This sample uses in-memory storage and a simple routing map.

For production, I would add:

The useful pattern is not just classification. It is classification plus action. The model turns a voicemail into structured intent, and the application routes it to the right workflow.

Resources:

── more in #artificial-intelligence 4 stories · sorted by recency
── more on @telnyx 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/route-voicemails-wit…] indexed:0 read:1min 2026-07-30 ·