1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Attempt to clarify Info text for new Twilio features.

This commit is contained in:
Dave C-J 2014-12-06 16:42:59 +00:00
parent 49e9edaf39
commit 139dcd67bc
2 changed files with 28 additions and 30 deletions

View File

@ -54,8 +54,11 @@
<script type="text/x-red" data-help-name="twilio out"> <script type="text/x-red" data-help-name="twilio out">
<p>Sends an SMS message or makes a call using the Twilio service.</p> <p>Sends an SMS message or makes a call using the Twilio service.</p>
<p><code>msg.payload</code> is used as either the body of the SMS message or the URL of the TWiML to create the call. The node can be configured with the number <p><code>msg.payload</code> can either contain the text of the SMS message,
to send the message to. Alternatively, if the number is left blank, it can be set using <code>msg.topic</code>. If the node is configured to make a call then the URL can be entered into the node or if left blank then the <code>msg.payload</code> is used.</p> <i>or</i> the URL of the <a href="https://www.twilio.com/docs/api/twiml" target = "_new">TWiML</a> used to create the call.
The node can be configured with the number to send the message to.
Alternatively, if the number is left blank, it can be set using <code>msg.topic</code>.
If the node is configured to make a call then the TWiML URL must be publically accessible.
<p>You must have an account with Twilio to use this node. You can register for one <a href="https://www.twilio.com/">here</a>.</p> <p>You must have an account with Twilio to use this node. You can register for one <a href="https://www.twilio.com/">here</a>.</p>
<p>You can either set your account details within the node, or provide it globally using either the settings file or a file <p>You can either set your account details within the node, or provide it globally using either the settings file or a file
called 'twiliokey.js' located in the directory above node-red.</p> called 'twiliokey.js' located in the directory above node-red.</p>
@ -85,16 +88,12 @@
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
(function() { (function() {
var hasGlobal = false; var hasGlobal = false;
$.getJSON('twilio-api/global',function(data) { $.getJSON('twilio-api/global',function(data) {
hasGlobal = data.hasToken; hasGlobal = data.hasToken;
}); });
RED.nodes.registerType('twilio-api',{ RED.nodes.registerType('twilio-api',{
category: 'config', category: 'config',
defaults: { defaults: {
@ -206,5 +205,4 @@
} }
}); });
})(); })();
</script> </script>

View File

@ -107,7 +107,7 @@ module.exports = function(RED) {
var twimlurl = node.url || msg.payload; var twimlurl = node.url || msg.payload;
node.twilioClient.makeCall( {to: tonum, from: node.fromNumber, url: twimlurl}, function(err, response) { node.twilioClient.makeCall( {to: tonum, from: node.fromNumber, url: twimlurl}, function(err, response) {
if (err) { if (err) {
node.error(err); node.error(err.message);
} }
//console.log(response); //console.log(response);
}); });
@ -115,7 +115,7 @@ module.exports = function(RED) {
// Send SMS // Send SMS
node.twilioClient.sendMessage( {to: tonum, from: node.fromNumber, body: msg.payload}, function(err, response) { node.twilioClient.sendMessage( {to: tonum, from: node.fromNumber, body: msg.payload}, function(err, response) {
if (err) { if (err) {
node.error(err); node.error(err.message);
} }
//console.log(response); //console.log(response);
}); });