mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Upgrade to Twilio sdk v3 (#411)
This commit is contained in:
committed by
Dave Conway-Jones
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user