Comparing version 1.1.4 to 1.2.0
//require the Twilio module and create a REST client | ||
var client = require('../lib')('ACCOUNT_SID', 'AUTH_TOKEN'); | ||
//Send an SMS text message | ||
client.sendSms({ | ||
//Send an text message | ||
client.sendMessage({ | ||
to:'+16515556677', // Any number Twilio can deliver to | ||
to: '+16515556677', // Any number Twilio can deliver to | ||
from: '+14506667788', // A number you bought from Twilio and can use for outbound communication | ||
@@ -23,8 +23,23 @@ body: 'word to your mother.' // body of the SMS message | ||
} | ||
}); | ||
//Send a message with content (MMS) | ||
client.messages.post({ | ||
to: '+16515556677', // Any number Twilio can deliver to | ||
from: '+14506667788', // A number you bought from Twilio and can use for outbound communication | ||
body: 'Kind sir, won\'t you instruct me how to douglas?', | ||
contentUrls: 'http://cdn.memegenerator.co/images/200x/42.jpg' | ||
}, function (err, responseData) { | ||
console.log(responseData); | ||
}); | ||
//Place a phone call, and respond with TwiML instructions from the given URL | ||
client.makeCall({ | ||
to:'+16515556677', // Any number Twilio can call | ||
to: '+16515556677', // Any number Twilio can call | ||
from: '+14506667788', // A number you bought from Twilio and can use for outbound communication | ||
@@ -38,2 +53,2 @@ url: 'http://www.example.com/twiml.php' // A URL that produces an XML document (TwiML) which contains instructions for the call | ||
}); | ||
}); |
@@ -23,2 +23,7 @@ /** | ||
incomingPhoneNumbers:require('./IncomingPhoneNumbers')(client, sid), | ||
messages: require('./Messages')(client, sid), | ||
media:ListInstanceResource(client, sid, 'Media', | ||
['GET', 'DELETE'], | ||
['GET'] | ||
), | ||
sms:{ | ||
@@ -51,3 +56,3 @@ messages:ListInstanceResource(client, sid, 'SMS/Messages', | ||
transcriptions:ListInstanceResource(client, sid, 'Transcriptions', | ||
['GET'], | ||
['GET', 'DELETE'], | ||
['GET'] | ||
@@ -65,3 +70,9 @@ ), | ||
) | ||
}, | ||
sip:{ | ||
domains:require('./sip/Domains')(client, sid), | ||
ipAccessControlLists:require('./sip/IpAccessControlLists')(client,sid), | ||
credentialLists:require('./sip/CredentialLists')(client,sid) | ||
} | ||
}; | ||
@@ -68,0 +79,0 @@ |
@@ -10,3 +10,4 @@ /** | ||
//Dependencies | ||
var request = require('request'), | ||
var querystring = require('querystring'), | ||
request = require('request'), | ||
moduleinfo = require('../package.json'), | ||
@@ -60,2 +61,4 @@ _ = require('underscore'); | ||
this.sendSms = this.accounts.sms.messages.post; | ||
this.sendMms = this.accounts.messages.post; | ||
this.sendMessage = this.accounts.messages.post; | ||
this.listSms = this.accounts.sms.messages.get; | ||
@@ -84,4 +87,4 @@ this.getSms = function(messageSid, callback) { | ||
/** | ||
Make an authenticated request against the Twilio backend. Uses the request library, | ||
and largely passes through to its API for options: | ||
Make an authenticated request against the Twilio backend. Uses the request | ||
library, and largely passes through to its API for options: | ||
@@ -106,2 +109,12 @@ https://github.com/mikeal/request | ||
// Manually create POST body if there's a form object. Sadly, request | ||
// turns multiple key parameters into array-ified queries, like this: | ||
// MediaUrl[0]=foo&MediaUrl[1]=bar. Node querystring does the right thing so | ||
// we use that here. Also see https://github.com/mikeal/request/issues/644 | ||
if (options.form) { | ||
options.body = querystring.stringify(options.form).toString('utf-8'); | ||
options.headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8'; | ||
options.form = null; | ||
} | ||
//Initiate HTTP request | ||
@@ -108,0 +121,0 @@ request(options, function (err, response, body) { |
@@ -36,2 +36,3 @@ var _ = require('underscore'); | ||
case 'Dial': legalNodes = ['Number','Client','Conference','Queue','Sip']; break; | ||
case 'Message': legalNodes = ['Media', 'Body']; break; | ||
default: break; | ||
@@ -125,4 +126,4 @@ } | ||
name:'Response', | ||
legalNodes:['Say', 'Play', 'Gather', 'Record', 'Sms', 'Dial', 'Enqueue', 'Leave', 'Hangup', 'Redirect', 'Reject', 'Pause'] | ||
legalNodes:['Say', 'Play', 'Gather', 'Record', 'Sms', 'Dial', 'Enqueue', 'Leave', 'Hangup', 'Redirect', 'Reject', 'Pause', 'Message'] | ||
}); | ||
}; | ||
}; |
{ | ||
"name":"twilio", | ||
"description":"A Twilio helper library", | ||
"version":"1.1.4", | ||
"author":"Kevin Whinnery <kevin.whinnery@gmail.com>", | ||
"contributors":[ | ||
{ | ||
"name":"Carter Rabasa", | ||
"email":"carter@twilio.com" | ||
}, | ||
{ | ||
"name":"Stephen Walters", | ||
"email":"stephenwalters@gmail.com" | ||
} | ||
], | ||
"repository":{ | ||
"type":"git", | ||
"url":"https://github.com/twilio/twilio-node.git" | ||
"name": "twilio", | ||
"description": "A Twilio helper library", | ||
"version": "1.2.0", | ||
"author": "Kevin Whinnery <kevin.whinnery@gmail.com>", | ||
"contributors": [ | ||
{ | ||
"name": "Carter Rabasa", | ||
"email": "carter@twilio.com" | ||
}, | ||
"dependencies":{ | ||
"request":"2.x", | ||
"underscore":"1.x", | ||
"jwt-simple": "0.1.x" | ||
}, | ||
"devDependencies": { | ||
"express":"2.x", | ||
"connect":"2.x", | ||
"ejs": "0.8.x" | ||
}, | ||
"scripts":{ | ||
"test":"jasmine-node spec" | ||
}, | ||
"main":"./lib", | ||
"engines":{ | ||
"node":">=0.6.0" | ||
{ | ||
"name": "Stephen Walters", | ||
"email": "stephenwalters@gmail.com" | ||
} | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/twilio/twilio-node.git" | ||
}, | ||
"dependencies": { | ||
"request": "2.x", | ||
"underscore": "1.x", | ||
"jwt-simple": "0.1.x" | ||
}, | ||
"devDependencies": { | ||
"express": "2.x", | ||
"connect": "2.x", | ||
"ejs": "0.8.x" | ||
}, | ||
"scripts": { | ||
"test": "jasmine-node spec" | ||
}, | ||
"main": "./lib", | ||
"engines": { | ||
"node": ">=0.6.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48822
27
949