How to use the twilio.IpMessagingClient 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 / ip-messaging / rest / credentials / list-credentials / list-credentials.2.x.js View on Github external
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = 'your_auth_token';
var IpMessagingClient = require('twilio').IpMessagingClient;

var client = new IpMessagingClient(accountSid, authToken);

client.credentials.list().then(function(response) {
    console.log(response);
}).fail(function(error) {
    console.log(error);
});
github TwilioDevEd / api-snippets / ip-messaging / rest / channels / delete-channels / delete-channels.2.x.js View on Github external
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = 'your_auth_token';
var IpMessagingClient = require('twilio').IpMessagingClient;

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

service.channels('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete().then(function(response) {
    console.log(response);
}).fail(function(error) {
    console.log(error);
});
github TwilioDevEd / api-snippets / ip-messaging / rest / credentials / delete-credentials / delete-credentials.2.x.js View on Github external
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = 'your_auth_token';
var IpMessagingClient = require('twilio').IpMessagingClient;

var client = new IpMessagingClient(accountSid, authToken);

client.credentials('CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete().then(function(response) {
    console.log(response);
}).fail(function(error) {
    console.log(error);
});
github TwilioDevEd / api-snippets / ip-messaging / rest / channels / update-channels / update-channels.2.x.js View on Github external
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = 'your_auth_token';
var IpMessagingClient = require('twilio').IpMessagingClient;

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

service.channels('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').post({
    friendlyName: 'channel_name'
}).then(function(response) {
    console.log(response);
}).fail(function(error) {
    console.log(error);
});
github TwilioDevEd / api-snippets / ip-messaging / rest / services / create-service / create-service.2.x.js View on Github external
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = 'your_auth_token';
var IpMessagingClient = require('twilio').IpMessagingClient;

var client = new IpMessagingClient(accountSid, authToken);

client.services.create({
    friendlyName: 'friendly_name'
}).then(function(response) {
    console.log(response);
}).fail(function(error) {
    console.log(error);
});
github TwilioDevEd / api-snippets / ip-messaging / rest / members / list-members / list-members.2.x.js View on Github external
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = 'your_auth_token';
var IpMessagingClient = require('twilio').IpMessagingClient;

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

service.channels('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').members.list().then(function(response) {
    console.log(response);
}).fail(function(error) {
    console.log(error);
});
github TwilioDevEd / api-snippets / ip-messaging / rest / users / update-user / update-user.2.x.js View on Github external
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = 'your_auth_token';
var IpMessagingClient = require('twilio').IpMessagingClient;

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

service.users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update({
    roleSID: 'IDENTITY'
}).then(function(response) {
    console.log(response);
}).fail(function(error) {
    console.log(error);
});
github TwilioDevEd / api-snippets / ip-messaging / rest / members / retrieve-member / retrieve-member.2.x.js View on Github external
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = 'your_auth_token';
var IpMessagingClient = require('twilio').IpMessagingClient;

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

service.channels('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').members('MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').get().then(function(response) {
    console.log(response);
}).fail(function(error) {
    console.log(error);
});
github TwilioDevEd / api-snippets / ip-messaging / rest / messages / update-messages / update-messages.2.x.js View on Github external
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = 'your_auth_token';
var IpMessagingClient = require('twilio').IpMessagingClient;

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

service.channels('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').messages('IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').post({
    body: 'New body content.'
}).then(function(response) {
    console.log(response);
}).fail(function(error) {
    console.log(error);
});
github VirgilSecurity / demo-twilio-backend-nodejs / ip-messaging / server / app.ts View on Github external
app.get('/history', (request, response, next) => {
    
    let identity = request.query.identity;
    let channelSid = request.query.channelSid;   
         
    var client = new Twilio.IpMessagingClient(process.env.TWILIO_API_KEY, process.env.TWILIO_API_SECRET);
    let service = client.services(process.env.TWILIO_IPM_SERVICE_SID);
    
    Promise.all([
        virgil.cards.search({ value: identity, type: 'chat_member' }),
        service.channels(channelSid).messages.list()
    ])
    .then(bundle => {
        let latestCard: any = _.last(_.sortBy(bundle[0], 'created_at'));
        let messages: Array = bundle[1].messages;
        let chatAdminPrivateKey = new Buffer(process.env.APP_CHANNEL_ADMIN_PRIVATE_KEY, 'base64').toString();    
        
        _.forEach(messages, m => {           
            let decryptedBody = virgil.crypto.decryptStringFromBase64(
                m.body, 
                process.env.APP_CHANNEL_ADMIN_CARD_ID, 
                chatAdminPrivateKey);