How to use the twilio.Twilio 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 / wireless / devices / usage / instance-get-example-1 / instance-get-example-1.3.x.js View on Github external
// Download the **Next-Gen** twilio-node library from:
// twilio.com/docs/libraries/node#installation-nextgen
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; // Your Account SID from www.twilio.com/console
var authToken = 'your_auth_token';   // Your Auth Token from www.twilio.com/console

var twilioLibrary = require('twilio');
var client = new twilioLibrary.Twilio(accountSid, authToken);

client.preview.wireless.devices('DEb8eff34b248d066a31c4a953134e183e')
  .usage().fetch(function(err, usage) {
    console.log(usage.period.start);
    console.log(usage.period.end);
    console.log(usage.dataCosts.total);
  });
github TwilioDevEd / api-snippets / sync / rest / streams / update-stream / update-stream.3.x.js View on Github external
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const Twilio = require('twilio').Twilio;

const client = new Twilio(accountSid, authToken);
const service = client.sync.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');

service.syncStreams('MyStream')
  .update({
    ttl: 864000 // expires in 10 days
  })
  .then(stream => {
    console.log(stream.dateExpires);
  })
  .catch(error => {
    console.log(error);
  });
github TwilioDevEd / api-snippets / sync / rest / lists / delete-list / delete-list.3.x.js View on Github external
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = 'your_auth_token';
var Twilio = require('twilio').Twilio;

var client = new Twilio(accountSid, authToken);
var service = client.sync.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');

service.syncLists('MyFirstList').remove()
  .then(function(response) {
    console.log(response);
  }).catch(function(error) {
    console.log(error);
  });
github TwilioDevEd / api-snippets / ip-messaging / rest / members / remove-member / remove-member.3.x.js View on Github external
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = 'your_auth_token';
var Twilio = require('twilio').Twilio;

var client = new Twilio(accountSid, authToken);
var service = client.chat.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');

service.channels('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').members('MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').remove().then(function(response) {
    console.log(response);
}).catch(function(error) {
    console.log(error);
});
github TwilioDevEd / api-snippets / sync / rest / maps / query-map / query-map.3.x.js View on Github external
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = 'your_auth_token';
var Twilio = require('twilio').Twilio;

var client = new Twilio(accountSid, authToken);
var service = client.sync.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');

service.syncMaps('Players')
  .syncMapItems.list()
    .then(function(response) {
      console.log(response);
    }).catch(function(error) {
      console.log(error);
    });
github TwilioDevEd / api-snippets / sync / rest / maps / update-map-item / update-map-item.3.x.js View on Github external
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = 'your_auth_token';
var Twilio = require('twilio').Twilio;

var client = new Twilio(accountSid, authToken);
var service = client.sync.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');

service.syncMaps('Players')
  .syncMapItems('steph_curry').update({
    data: {
      level: 31,
      name: "Stephen Curry",
      username: "spicy_curry"
    }
  }).then(function(response) {
    console.log(response);
  }).catch(function(error) {
    console.log(error);
  });
github TwilioDevEd / api-snippets / ip-messaging / rest / users / list-users / list-users.3.x.js View on Github external
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = 'your_auth_token';
var Twilio = require('twilio').Twilio;

var client = new Twilio(accountSid, authToken);
var service = client.chat.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');

service.users.list().then(function(response) {
    console.log(response);
}).catch(function(error) {
    console.log(error);
});
github TwilioDevEd / api-snippets / ip-messaging / rest / credentials / create-credentials / create-credentials.3.x.js View on Github external
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = 'your_auth_token';
var Twilio = require('twilio').Twilio;

var client = new Twilio(accountSid, authToken);

client.chat.credentials.create({
    type: 'gcm',
    apiKey: '1234',
    friendlyName: 'My credential'
}).then(function(response) {
    console.log(response);
}).catch(function(error) {
    console.log(error);
});
github TwilioDevEd / api-snippets / sync / rest / services / create-service / create-service.3.x.js View on Github external
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = 'your_auth_token';
var Twilio = require('twilio').Twilio;

var client = new Twilio(accountSid, authToken);

client.sync.services.create({
  friendlyName: 'MySyncServiceInstance'
}).then(function(response) {
  console.log(response);
}).catch(function(error) {
  console.log(error);
});
github TwilioDevEd / api-snippets / deployed-devices / rest / deployments / retrieve-deployment / retrieve-deployment.3.x.js View on Github external
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const Twilio = require('twilio').Twilio;

const client = new Twilio(accountSid, authToken);
const fleet = client.preview.deployed_devices.fleets(
  'FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
);

fleet
  .deployments('DLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
  .fetch()
  .then(response => {
    console.log(response);
  })
  .catch(error => {
    console.log(error);
  });