Giter VIP home page Giter VIP logo

namsor / phone-validation Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 2.0 10.89 MB

Global phone number validation based on personal name and phone formatting.

License: GNU General Public License v3.0

TypeScript 1.34% HTML 5.42% CSS 39.87% JavaScript 53.21% PHP 0.12% Batchfile 0.03%
phone-number-validation phone-validation phone-number phone-number-verification phone-number-formatting data-quality

phone-validation's Introduction

NamSor phone validation API

A free API for global phone number validation based on personal name and phone number formatting. FYI, this is a full AngularJS 6 project, hosted using Github Pages at https://namsor.github.io/phone-validation/ with a HTTPS custom domain. The website uses NamSor API v2.

Getting started

The following sample shows how to validate a locally formated phone number into an international phone number E.164

E.164 is an ITU-T recommendation, titled The international public telecommunication numbering plan.

How to Use

The API simply takes personal name : first name / given name and last name / surname, as well as the phone number. You don't need to have the phone number in an international format : it can be a local number.

Make a call to NamSor API https://v2.namsor.com/NamSorAPIv2/apidoc.html#/social/phoneCode with firstName lastName phoneNumber and pass the API Key as a X-API-KEY header.

Response You get

Since POTUS gave his own personal number in a Tweet (https://twitter.com/realDonaldTrump/status/628590822913650688), we'll use that as a example :

curl -X GET "https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCode/Donald/Trump/917.756.8000" -H "accept: application/json" -H "X-API-KEY: <your api key here>"

Will get you this JSON response :

{
  "id": null,
  "firstName": "Donald",
  "lastName": "Trump",
  "internationalPhoneNumberVerified": "+1 917-756-8000",
  "phoneCountryIso2Verified": "US",
  "phoneCountryCode": 1,
  "phoneCountryCodeAlt": 63,
  "phoneCountryIso2": "US",
  "phoneCountryIso2Alt": "PH",
  "originCountryIso2": "GB",
  "originCountryIso2Alt": "FR",
  "phoneNumber": "917.756.8000",
  "verified": true,
  "score": 1.8924464202870794
}

The main output is internationalPhoneNumberVerified, if the number could be verified using Google's validation API. Once you have this information, you can use additional APIs to enrich your customer information (ex. NumVerify https://numverify.com, Twilio https://www.twilio.com/lookup etc.)

Using from AngularJS or JQuery

You can try with a few numbers for yourself or see how the API can be used from AngularJS or JQuery here, https://namsor.github.io/phone-validation/

How it works

Google's phone validation API (googlei18n/libphonenumber) normally requires as input a COUNTRY and PHONE number. NamSor's phoneCode API combines the likely country of origin from the name and the predicted phone country, based on both name and phone number formatting, to call's google phone validation API and workaround its limitations.

phone-validation's People

Contributors

namsor avatar saad141 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

hummans

phone-validation's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.