Skip to content

Instantly share code, notes, and snippets.

@kwhinnery
Created June 29, 2016 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwhinnery/3edf9e5b415be7103a935304496f0af0 to your computer and use it in GitHub Desktop.
Save kwhinnery/3edf9e5b415be7103a935304496f0af0 to your computer and use it in GitHub Desktop.
var accountSid = '{{ YOUR_ACCOUNT_SID }}';
var authToken = '{{ YOUR_AUTH_TOKEN }}';
var LookupsClient = require('twilio').LookupsClient;
var client = new LookupsClient(accountSid, authToken);
var phoneNumber = process.argv[2];
client.phoneNumbers(phoneNumber).get({
type: 'carrier'
}, (error, number) => {
var message = number ? number.national_format + ' is valid' : error;
if (error && error.status === 404) message = 'Invalid phone number';
console.log(message);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment