cd /news/artificial-intelligence/turn-phone-numbers-into-lead-signals · home topics artificial-intelligence article
[ARTICLE · art-45641] src=dev.to ↗ pub= topic=artificial-intelligence verified=true sentiment=↑ positive

Turn Phone Numbers into Lead Signals

Telnyx released a Python Flask app that combines Number Lookup and AI Inference to enrich phone numbers and qualify leads. The app scores lead quality and recommends a follow-up channel (SMS or voice) by first gathering carrier and line-type data, then passing it to an AI model for structured JSON output. It exposes endpoints for single and bulk enrichment, and the code is designed to be easily extended for production use.

read2 min views1 publishedJun 30, 2026

Subtitle: Build a Python app that combines Telnyx Number Lookup with Telnyx AI Inference to qualify leads and recommend the best follow-up channel.

A lead form usually gives you just enough information to create a question.

Someone enters a name, an email address, maybe a phone number, and maybe a note about what they want. Now the app has to decide what happens next. Does this lead go to sales? Should the first touch be SMS or voice? Is the phone number even usable?

That is the workflow behind this example:

https://github.com/team-telnyx/telnyx-code-examples/tree/main/number-lookup-lead-enrichment-python

It is a small Python Flask app that takes a phone number, enriches it with Telnyx Number Lookup, then uses Telnyx AI Inference to score the lead and recommend a follow-up channel.

The app exposes three routes:

POST /enrich

for one phone numberPOST /enrich/bulk

for up to 50 phone numbersGET /health

for app healthIt uses two Telnyx APIs:

GET /v2/number_lookup/{phone}
POST /v2/ai/chat/completions

The current default model is set in .env.example

:

AI_MODEL=MiniMaxAI/MiniMax-M3-MXFP8

The pattern is simple: gather phone intelligence first, then use an inference model to turn that data into a lead-quality decision.

The request is intentionally small:

curl -X POST http://localhost:5000/enrich \
  -H "Content-Type: application/json" \
  -d '{
    "phone_number": "+12125550123"
  }'

The app looks up the number and extracts fields like carrier name, carrier type, caller name, line type, country, and validity.

Then it asks the model to return JSON like:

{
  "lead_quality": "hot",
  "reasoning": "Valid mobile number with usable carrier data",
  "is_mobile": true,
  "is_voip": false,
  "recommended_channel": "sms"
}

That response is much easier to build with than a paragraph. A product can route it, store it, show it in a CRM, or use it to kick off a workflow.

Lead enrichment usually turns into a pile of small decisions:

Number Lookup gives you the underlying phone intelligence. AI Inference lets you apply a lightweight reasoning layer over that data.

That is a nice AI app pattern because the model is not doing everything. It is operating on structured context from a real API.

The app asks the model to return only JSON, with no prose and no markdown fences.

It still includes a helper to strip markdown fences and parse the JSON object. I like that because AI app code should be defensive. Prompts reduce variance, but validation is what keeps the output safe to use in an application.

The example keeps everything readable in one Flask app, which makes it easy to adapt.

For production, I would add:

The repo is also structured to be agent-readable. Your coding agent can inspect the README, API reference, guide, environment file, and app code, then help extend it. You can ask it to add CRM writes, tests, stricter validation, or a scheduled enrichment job.

Code:

https://github.com/team-telnyx/telnyx-code-examples/tree/main/number-lookup-lead-enrichment-python

Telnyx AI skills and toolkits:

https://github.com/team-telnyx/ai

Number Lookup API:

https://developers.telnyx.com/api/number-lookup/lookup

Telnyx AI Inference docs:

https://developers.telnyx.com/docs/inference

Chat Completions API:

https://developers.telnyx.com/api/inference/chat-completions

Telnyx Portal:

https://portal.telnyx.com/

── 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/turn-phone-numbers-i…] indexed:0 read:2min 2026-06-30 ·