mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Updates to Twilio Node
Fixes #28 Make edit panel work, and then fix it so the things edited do what they say. Slight tweak to shrink icon to similar size as others.
This commit is contained in:
parent
e5af41ba2b
commit
f64358262a
@ -15,15 +15,16 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<script type="text/x-red" data-template-name="twilio">
|
<script type="text/x-red" data-template-name="twilio out">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-title"><i class="icon-flag"></i> Title</label>
|
<label for="node-input-number"><i class="icon-envelope"></i> SMS to</label>
|
||||||
<input type="text" id="node-input-title" placeholder="Node-RED">
|
<input type="text" id="node-input-number" placeholder="01234 5678901">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-tips">Tip - leave Number blank to use <b>msg.topic</b> to set the number.</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/x-red" data-help-name="twilio out">
|
<script type="text/x-red" data-help-name="twilio out">
|
||||||
@ -39,7 +40,7 @@
|
|||||||
RED.nodes.registerType('twilio out',{
|
RED.nodes.registerType('twilio out',{
|
||||||
category: 'output',
|
category: 'output',
|
||||||
defaults: {
|
defaults: {
|
||||||
title: {value:""},
|
number: {value:""},
|
||||||
name: {value:""}
|
name: {value:""}
|
||||||
},
|
},
|
||||||
color:"#ed1c24",
|
color:"#ed1c24",
|
||||||
@ -48,7 +49,7 @@
|
|||||||
icon: "twilio.png",
|
icon: "twilio.png",
|
||||||
align: "right",
|
align: "right",
|
||||||
label: function() {
|
label: function() {
|
||||||
return this.name||this.title||"twilio out";
|
return this.name||this.title||"twilio";
|
||||||
},
|
},
|
||||||
labelStyle: function() {
|
labelStyle: function() {
|
||||||
return this.name?"node_label_italic":"";
|
return this.name?"node_label_italic":"";
|
||||||
|
@ -37,7 +37,7 @@ if (twiliokey) {
|
|||||||
|
|
||||||
function TwilioOutNode(n) {
|
function TwilioOutNode(n) {
|
||||||
RED.nodes.createNode(this,n);
|
RED.nodes.createNode(this,n);
|
||||||
this.title = n.title;
|
this.number = n.number;
|
||||||
var node = this;
|
var node = this;
|
||||||
this.on("input",function(msg) {
|
this.on("input",function(msg) {
|
||||||
if (typeof(msg.payload) == 'object') {
|
if (typeof(msg.payload) == 'object') {
|
||||||
@ -46,7 +46,8 @@ function TwilioOutNode(n) {
|
|||||||
if (twiliokey) {
|
if (twiliokey) {
|
||||||
try {
|
try {
|
||||||
// Send SMS
|
// Send SMS
|
||||||
twilioClient.sendMessage( {to: msg.topic, from: fromNumber, body: msg.payload}, function(err, response) {
|
var tonum = node.number || msg.topic;
|
||||||
|
twilioClient.sendMessage( {to: tonum, from: fromNumber, body: msg.payload}, function(err, response) {
|
||||||
if (err) node.error(err);
|
if (err) node.error(err);
|
||||||
//console.log(response);
|
//console.log(response);
|
||||||
});
|
});
|
||||||
@ -60,5 +61,4 @@ function TwilioOutNode(n) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
RED.nodes.registerType("twilio out",TwilioOutNode);
|
RED.nodes.registerType("twilio out",TwilioOutNode);
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 717 B After Width: | Height: | Size: 553 B |
Loading…
x
Reference in New Issue
Block a user