How to use the twilio.pricing 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 / pricing / list-voice-countries / list-voice-countries.3.x.js View on Github external
// Get your Account SID and Auth Token from twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';

// Get twilio-node from twilio.com/docs/libraries/node
const client = require('twilio')(accountSid, authToken).pricing;

client.voice.countries
  .list()
  .then(countries => {
    countries.forEach(country => {
      console.log(country.isoCountry);
    });
  })
  .catch(error => {
    console.log(error);
    throw error;
  });
github TwilioDevEd / api-snippets / pricing / list-messaging-countries / list-messaging-countries.3.x.js View on Github external
// Get your Account SID and Auth Token from twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';

// Get twilio-node from twilio.com/docs/libraries/node
const client = require('twilio')(accountSid, authToken).pricing;

client.messaging.countries
  .list()
  .then(countriesList => {
    countriesList.forEach(country => {
      console.log(country.isoCountry);
    });
  })
  .catch(error => {
    console.log(error);
    throw error;
  });
github TwilioDevEd / api-snippets / pricing / get-phone-number-country / get-phone-number-country.3.x.js View on Github external
// Get your Account SID and Auth Token from twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';

// Get twilio-node from twilio.com/docs/libraries/node
const client = require('twilio')(accountSid, authToken).pricing;

client.phoneNumbers
  .countries('US')
  .fetch()
  .then(country => {
    country.phoneNumberPrices.forEach(price => {
      console.log(`${price.number_type} ${price.current_price}`);
    });
  })
  .catch(error => {
    console.log(error);
    throw error;
  });
github TwilioDevEd / api-snippets / pricing / get-voice-number-with-origination-number / get-voice-number-with-origination-number.3.x.js View on Github external
// Get your Account SID and Auth Token from twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';

// Get twilio-node from twilio.com/docs/libraries/node
const client = require('twilio')(accountSid, authToken).pricing;

client.voice
  .numbers('+15108675310')
  .fetch({
    originationNumber: '+12421234567'
  })
  .then(numbers => {
    console.log(number.outboundCallPriceWithOrigin.current_price);
    numbers.outboundCallPriceWithOrigin.forEach(price => {
      console.log(price.current_price);
    });
  })
  .catch(error => {
    console.log(error);
    throw error;
  });
github TwilioDevEd / api-snippets / pricing / get-voice-country / get-voice-country.3.x.js View on Github external
// Get your Account SID and Auth Token from twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';

// Get twilio-node from twilio.com/docs/libraries/node
const client = require('twilio')(accountSid, authToken).pricing;

client.voice
  .countries('EE')
  .fetch()
  .then(country => {
    country.inboundCallPrices.forEach(price => {
      console.log(`${price.number_type} ${price.current_price}`);
    });
  })
  .catch(error => {
    console.log(error);
    throw error;
  });
github TwilioDevEd / api-snippets / pricing / get-messaging-country / get-messaging-country.3.x.js View on Github external
// Get your Account SID and Auth Token from twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';

// Get twilio-node from twilio.com/docs/libraries/node
const client = require('twilio')(accountSid, authToken).pricing;

client.messaging
  .countries('EE')
  .fetch()
  .then(country => {
    country.inboundSmsPrices.forEach(price => {
      console.log(`${price.number_type} ${price.current_price}`);
    });
  })
  .catch(error => {
    console.log(error);
    throw error;
  });
github TwilioDevEd / api-snippets / pricing / list-phone-number-countries / list-phone-number-countries.3.x.js View on Github external
// Get your Account SID and Auth Token from twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';

// Get twilio-node from twilio.com/docs/libraries/node
const client = require('twilio')(accountSid, authToken).pricing;

client.phoneNumbers.countries
  .list()
  .then(countries => {
    countries.forEach(country => {
      console.log(country.isoCountry);
    });
  })
  .catch(error => {
    console.log(error);
    throw error;
  });
github TwilioDevEd / api-snippets / pricing / get-voice-number / get-voice-number.3.x.js View on Github external
// Get your Account SID and Auth Token from twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';

// Get twilio-node from twilio.com/docs/libraries/node
const client = require('twilio')(accountSid, authToken).pricing;

client.voice
  .numbers('+15108675310')
  .fetch()
  .then(number => {
    console.log(number.outboundCallPriceWithOrigin.current_price);
  })
  .catch(error => {
    console.log(error);
    throw error;
  });