This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Download the 'Preview Release' version of the Python helper library from | |
# twilio.com/docs/python/install | |
from twilio.rest import Client | |
# Your Account Sid and Auth Token from twilio.com/user/account | |
account = 'AC421124bfab3052ad108f3e8c7a119cfb' | |
token = 'AUTH_TOKEN' | |
client = Client(account, token) | |
# Delete the service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load user year data | |
$.ajax('/ga/users').then(function(data) { | |
// Populate raw numbers | |
var usersYearFormatted = humanize.numberFormat(data.usersThisYear, 0); | |
var usersQuarterFormatted = humanize.numberFormat(data.usersThisQuarter, | |
0); | |
$('.users-year').text(usersYearFormatted); | |
$('.users-quarter').text(usersQuarterFormatted); | |
// Populate progress bar | |
$quarterGoal = $('.progress.current-goal .progress-bar'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var express = require('express'); | |
var bodyParser = require('body-parser'); | |
var KeenClient = require('keen-js'); | |
// 1.) create an authenticated Keen analytics client | |
var keen = new KeenClient({ | |
projectId: 'your project ID here', | |
writeKey: 'your write key here' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var client = new Twilio.Conversations.Client('token'); | |
var convo = client.conversation('myCall'); | |
convo.display('#them', '#me').then(function() { | |
console.log('now your local media is showing, as is theirs!'); | |
}).catch(function(err) { | |
console.log('oops, something bad happened') | |
}); | |
convo.on('participantJoined', function(participant) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var client = new Twilio.IPMessaging.Client('token'); | |
// Creates a reference to a channel that may or may not exist | |
var channel = client.channel('general'); | |
// If there's such a thing as an online/offline channel, this serves as the way the channel | |
// gets updated when it's reconnected from an offline state. It could also serve as a way | |
// to get updated when the channel information is initially fetched from the server | |
// | |
// Fired when: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var client = new Twilio.IPMessaging.Client('token'); | |
var channel = client.getOrCreateChannelByUniqueName('general'); | |
channel.join(); | |
channel.listMessages().then(function(messages) { | |
console.log(messages); | |
}).catch(function(err) { | |
console.log(err); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var map = client.sync.map('uniqueName'); | |
map.set('foo', { bar: 42 }).then(function() { | |
console.log('set it!'); | |
}).catch(function(err) { | |
console.log('dang it, dont have access'); | |
}); | |
// same as above... | |
map.set('foo', { bar: 42 }, function(err) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var channel = client.channel('uniqueName'); | |
channel.listMessages().then(function(messages) { | |
console.log(messages); | |
}).catch(function(err) { | |
console.log('whoops! I dont have access to this channel'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var client = twilio.sync('jwt token here'); | |
// Example Document interaction | |
var doc = client.Document('uniqueName'); | |
doc.set({ | |
foo: 'bar' | |
}); | |
doc.on('update', function(e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var client = require('twilio')('sid', 'token'); | |
var pager = client.messages.each({ pageSize: 100 }); | |
pager.on('data', function(message) { | |
console.log(message.sid); | |
}); | |
pager.on('end', function() { | |
console.log('no more messages!'); |