Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
});
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);
});
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);
});
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);
});
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);
});
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);
});
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);
});
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);
});
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);
});
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);