Created
June 29, 2016 15:39
-
-
Save kwhinnery/3edf9e5b415be7103a935304496f0af0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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