Lab results are one of those healthcare workflows where the phone call sounds simple, but the product boundaries matter a lot.
A patient wants to know whether results are back. The clinic needs to verify identity. The system should disclose only what is appropriate. And if the patient needs the full report, the best answer is usually a secure portal link, not reading everything out loud or putting lab values in an SMS.
So I built the sample as a notification assistant, not a clinical assistant.
The Telnyx code example is here:
It uses Telnyx AI Assistants with a small Python + Flask app for the screen-share dashboard and optional backend extension points.
The Flow
The caller dials a Telnyx phone number that is assigned directly to the AI Assistant.
The assistant asks for:
- Full legal name
- Date of birth
Only after those match a mock record does it disclose the lab result summary.
For the normal result path, the assistant says the result is back and within the expected range, then asks whether the patient wants a secure portal link by text.
If the patient says yes, the assistant uses Telnyx native messaging to send a portal link. The text does not include lab values.
For abnormal or borderline examples, the assistant gives follow-up language and points the patient toward a nurse callback or clinical staff.
The Part I Care About
The AI is not practicing medicine.
The AI is not interpreting raw lab values.
The AI is not replacing the provider.
It is doing the operational part:
verify identity
give a short provider-approved summary
send the patient to the secure portal
route follow-up
That distinction matters in healthcare AI demos. A good demo should show what the system can do, but also show what it refuses to do.
Why Use Telnyx AI Assistants Here
The cleanest version of this demo does not need a custom tunnel in the call path.
The phone number is assigned directly to the Telnyx AI Assistant. The assistant is provisioned from provision_assistant.py. The SMS link uses the assistant's native send_message tool.
That means the live demo path is:
Telnyx number
-> Telnyx AI Assistant
-> native SMS link
The Flask app is still useful, but mostly for the demo dashboard and optional backend extension points.
That keeps the call experience simple enough to explain on screen.
The Dashboard
I also added a local Flask UI at:
http://127.0.0.1:5000
It shows:
- call flow
- mock patient test identities
- HIPAA compliance safeguards
- local audit and callback state
It does not show API keys, real PHI, the raw assigned phone number, or raw transcripts.
That screen is useful for a video because it gives viewers something concrete to look at while the phone call is happening.
HIPAA Compliance Safeguards
This sample is designed around the safeguards expected in a HIPAA-compliant lab results notification workflow:
- mock data only
- identity verification before result disclosure
- minimum necessary spoken result summary
- no lab values in SMS
- recording disabled
- assistant data retention disabled
- no diagnosis or treatment advice
For production, pair these controls with the required BAA, role-based access controls, storage controls, audit logs, retention settings, monitoring, and legal/compliance review.
That is the deployment posture this demo is built to show: Telnyx AI for a privacy-sensitive healthcare workflow, with PHI kept out of SMS and result access routed through a secure portal.
Run It Locally
git clone https://github.com/team-telnyx/telnyx-code-examples.git
cd telnyx-code-examples/ai-lab-results-notification-voice-python
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
Set:
TELNYX_API_KEY=KEY...
TELNYX_PHONE_NUMBER=+18005551234
Start the dashboard:
python app.py
Provision the assistant:
python provision_assistant.py
Then assign a Telnyx number directly to the assistant in the Portal and call it.
For the happy path, use:
name: maya rivera
date of birth: november 22 1984
Then ask for the secure portal link by text.
Production Notes
For a production version, I would move patient verification and result lookup out of the prompt and into a backend connected to the real patient portal or EHR workflow.
I would also keep the assistant prompt conservative:
verify identity
disclose minimum necessary
do not diagnose
do not interpret beyond provider note
do not put lab values in sms
route clinical questions to staff
That is the shape I like for this kind of workflow. AI handles a narrow phone interaction, while the secure patient portal remains the place where patients access the full report.
Resources
- Code example: https://github.com/team-telnyx/telnyx-code-examples/tree/main/ai-lab-results-notification-voice-python
- Telnyx AI Assistant quickstart: https://developers.telnyx.com/docs/inference/ai-assistants/no-code-voice-assistant
- AI Assistant interruption settings: https://developers.telnyx.com/docs/inference/ai-assistants/interruption-settings
- Architecting for HIPAA on Telnyx: https://telnyx.com/resources/architecting-hipaa-telnyx
- Telnyx Developer Docs: https://developers.telnyx.com
Top comments (0)