#phone-number #twilio #query-api #numbers #lookup #cnam #caller

app twlu

Small CLI tool to query the Twilio Lookup API V2 for a phone number

1 unstable release

0.1.1 Oct 2, 2024
0.1.0 Oct 2, 2024

#841 in Command line utilities

MIT license

8KB
132 lines

twlu

Small CLI tool to query the Twilio Lookup API V2 for a phone number

The Twilio Lookup API provides a paid (per request) way to query the line information database for CNAM data used in caller ID services. The API also has an endpoint to identify the line type (landline, mobile, voip, etc) and carrier.

This tool provides a quick interface to query this API for a phone number and return some basic data in JSON format.

Setup

  1. Create a Twilio Account with access to the Lookup API. The API costs ~$0.01 per request.
  2. Set the environment variables TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN. You can retrieve this values by followng the directions in this article.

Usage

$> twlu --help      
CLI interface for the Twilio Lookup API V2

Usage: twlu [OPTIONS] <NUMBER>

Arguments:
  <NUMBER>  Phone number to lookup

Options:
  -n, --caller-name  Lookup Caller Name
  -t, --line-type    Lookup Line Type Intelligence
  -h, --help         Print help

Example nonFixedVoip Query

$> twlu +14159929960
{
  "call_forwarding": null,
  "caller_name": {
    "caller_name": null,
    "caller_type": "UNDETERMINED",
    "error_code": null
  },
  "calling_country_code": "1",
  "country_code": "US",
  "identity_match": null,
  "line_type_intelligence": {
    "carrier_name": "Bandwidth/13 - Bandwidth.com - SVR",
    "error_code": null,
    "mobile_country_code": "313",
    "mobile_network_code": "981",
    "type": "nonFixedVoip"
  }
}

Dependencies

~4–5.5MB
~97K SLoC