TwilioKelley Robinson, Dylan FrankcomTutorial
How to Approve Real Users and Block Fake Accounts at Sign Up with Lookup and Verify in Python
Summary
This Python tutorial builds a signup flow that screens phone numbers for fake accounts while aiming to keep legitimate onboarding smooth. It combines Twilio Lookup’s Line Type Intelligence, optional Line Status, and Identity Match checks before using Twilio Verify to send an OTP and confirm possession of the number. The provided Flask example collects a phone number and first and last names, rejects landlines, nonfixed VoIP, toll-free numbers, and pagers, and accepts Identity Match only when both name fields are exact_match or high_partial_match. The post shows how to configure the project, run it locally, inspect outcomes such as LINE_TYPE_BLOCKED or identity-match failure, and consider pricing because the four API calls have different costs.
Context
The flow is intended to block bots, fake accounts, and fraudulent signups while providing real users with a smooth onboarding path. It uses progressively more intensive checks and considers API pricing when ordering the checks.
Approach / What changed
A Flask application collects a phone number and name, runs Twilio Lookup checks for line type and identity match, optionally checks line status, and then starts a Twilio Verify OTP flow when the lookup checks pass. The project uses Python 3.8+, environment variables, the Twilio SDK, and a basic HTML interface.
Takeaways
Line Type Intelligence blocks landlines, nonfixed VoIP, toll-free numbers, and pagers before later verification steps.
Identity Match requires both first_name_match and last_name_match to be exact_match or high_partial_match; no_match, partial_match, null, or an unavailable result rejects the request.
Line Status is optional, commented out by default because it is in Private Beta, and the Lookup and Verify steps have different costs that can influence their order.
Source and freshness
- Source
- twilio.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.