How to use the twilio.LookupsClient function in twilio

To help you get started, we’ve selected a few twilio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TwilioDevEd / api-snippets / lookups / lookup-get-basic-example-2 / lookup-get-basic-example-2.2.x.js View on Github external
// Download the Node helper library from twilio.com/docs/node/install
// These consts are your accountSid and authToken from twilio.com/user/account
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const LookupsClient = require('twilio').LookupsClient;
const client = new LookupsClient(accountSid, authToken);

client.phoneNumbers('(510) 867-5309').get({
    countryCode: 'US',
    type: 'carrier'
  }, function(error, number) {
    console.log(number.carrier.type);
    console.log(number.carrier.name);
  });
github TwilioDevEd / api-snippets / lookups / lookup-national-basic / lookup-national-basic.2.x.js View on Github external
// Download the Node helper library from twilio.com/docs/library/node
var LookupsClient = require('twilio').LookupsClient;

// These vars are your Account Sid and Auth Token from twilio.com/console
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = 'your_auth_token';
var client = new LookupsClient(accountSid, authToken);

client.phoneNumbers('(510) 867-5309').get({
  countryCode: 'US'
}, function(error, number) {
  console.log(number.phoneNumber);
});
github TwilioDevEd / api-snippets / lookups / lookup-international-basic / lookup-international-basic.2.x.js View on Github external
// Download the Node helper library from twilio.com/docs/library/node
var LookupsClient = require('twilio').LookupsClient;

// These vars are your Account Sid and Auth Token from twilio.com/console
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = 'your_auth_token';
var client = new LookupsClient(accountSid, authToken);

client.phoneNumbers('+4402077651182').get(function(error, number) {
  console.log(number.nationalFormat);
});
github TwilioDevEd / api-snippets / lookups / lookup-get-basic-example-1 / lookup-get-basic-example-1.2.x.js View on Github external
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = 'your_auth_token';
var LookupsClient = require('twilio').LookupsClient;
var client = new LookupsClient(accountSid, authToken);

client.phoneNumbers('+15108675309').get({
  type: 'carrier'
}, function(error, number) {
  console.log(number.carrier.type);
  console.log(number.carrier.name);
});
github stanford-oval / thingpedia-common-devices / com.twilio / lookup.js View on Github external
// This file is part of ThingPedia
//
// Copyright 2016 Weston Makoto Mizumoto 
//                Dersu Abolfathi 
//
// See LICENSE for details

const Tp = require('thingpedia');
const LookupsClient = require('twilio').LookupsClient;

// Twilio Credentials
var accountSid = 'AC9d005f8a60c176bbcccc85c57694b2c7';
var authToken = 'e93833ab8bd579edb0dafb4ca95056c3';

//require the Twilio module and create a REST client
var client = LookupsClient(accountSid, authToken);
var messagingClient = require('twilio')(accountSid, authToken);

module.exports = new Tp.ChannelClass({
    Name: "Lookup",

    sendEvent: function(event) {
        var recipientNumber = event[0];
        var queryNumber = event[1];
        console.log('Looking up query number: '+queryNumber);

        client.phoneNumbers(queryNumber).get( {
            type: 'carrier'
        }, function(error, number) {
            messagingClient.sendMessage({
                to:String(recipientNumber),
                from:'+16506668936',
github freedomexio / rocketx-condenser / src / server / utils / twilio.js View on Github external
export default function verify(phone) {
    if (!client) client = new twilio.LookupsClient(accountSid, authToken);
    return new Promise(resolve => {
        if (!checkEligibility(phone)) {
            resolve('na');
            return;
        }
        client.phoneNumbers(phone).get(
            {
                type: 'carrier',
                addOns: 'whitepages_pro_phone_rep',
            },
            (error, result) => {
                if (error) {
                    if (error.code === 20404) {
                        console.log('Twilio phone not found ', phone);
                        resolve('block');
                    } else {