mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Upgrade to Twilio sdk v3 (#411)
This commit is contained in:
parent
da96f9e869
commit
9ea27f94ef
@ -58,20 +58,14 @@ module.exports = function(RED) {
|
||||
if ( this.twilioType == "call" ) {
|
||||
// Make a call
|
||||
var twimlurl = node.url || msg.payload;
|
||||
node.twilioClient.makeCall( {to: tonum, from: node.fromNumber, url: twimlurl}, function(err, response) {
|
||||
if (err) {
|
||||
node.error(err.message,msg);
|
||||
}
|
||||
//console.log(response);
|
||||
node.twilioClient.calls.create({to: tonum, from: node.fromNumber, url: twimlurl}).catch(function(err) {
|
||||
node.error(err.message,msg);
|
||||
});
|
||||
}
|
||||
else {
|
||||
// Send SMS
|
||||
node.twilioClient.sendMessage( {to: tonum, from: node.fromNumber, body: msg.payload}, function(err, response) {
|
||||
if (err) {
|
||||
node.error(err.message,msg);
|
||||
}
|
||||
//console.log(response);
|
||||
node.twilioClient.messages.create({to: tonum, from: node.fromNumber, body: msg.payload}).catch( function(err) {
|
||||
node.error(err.message,msg);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
"version" : "0.0.15",
|
||||
"description" : "A Node-RED node to send SMS messages via the Twilio service.",
|
||||
"dependencies" : {
|
||||
"twilio" : "^2.11.1"
|
||||
"twilio" : "^3.11.3"
|
||||
},
|
||||
"repository" : {
|
||||
"type":"git",
|
||||
|
Loading…
Reference in New Issue
Block a user