From 9ea27f94ef0bafec6c9a9646414633e4ef568b0c Mon Sep 17 00:00:00 2001 From: Marc Buils Date: Thu, 29 Mar 2018 09:50:51 +0200 Subject: [PATCH] Upgrade to Twilio sdk v3 (#411) --- social/twilio/56-twilio.js | 14 ++++---------- social/twilio/package.json | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/social/twilio/56-twilio.js b/social/twilio/56-twilio.js index 75d47823..48403ba5 100644 --- a/social/twilio/56-twilio.js +++ b/social/twilio/56-twilio.js @@ -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); }); } } diff --git a/social/twilio/package.json b/social/twilio/package.json index 43b86383..4c0c4e12 100644 --- a/social/twilio/package.json +++ b/social/twilio/package.json @@ -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",