node-red-contrib-chatbot
Version:
REDBot a Chat bot for a full featured chat bot for Telegram, Facebook Messenger and Slack. Almost no coding skills required
91 lines (86 loc) • 2.65 kB
HTML
<script type="text/javascript">
$.RedBot.registerType('chatbot-location', {
category: $.RedBot.config.name,
color: '#FFCC66',
defaults: {
name: {
value: ''
},
latitude: {
value: '',
validate: function(value) {
return value == null || $.trim(value) == '' || RED.validators.number()(value);
}
},
longitude: {
value: '',
validate: function(value) {
return value == null || $.trim(value) == '' || RED.validators.number()(value);
}
},
place: {
value: '',
required: false
}
},
inputs: 1,
outputs: 1,
paletteLabel: 'Location',
icon: 'chatbot-location.png',
label: function() {
return this.name || 'Location';
}
});
</script>
<script type="text/x-red" data-template-name="chatbot-location">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-name">Latitude</label>
<input type="text" id="node-input-latitude" placeholder="Latitude" style="width: 30%;">
<input type="text" id="node-input-longitude" placeholder="Longitude" style="width: 30%;">
</div>
<div class="form-row">
<label for="node-input-place">Place</label>
<input type="text" id="node-input-place" placeholder="Place">
<div style="max-width: 460px;font-size: 12px;color: #999999;line-height: 14px;margin-top:5px;">
Label next the map (for example the physical address <i>"corso Sempione, 12 Milano"</i>), only available for
transport <b>Facebook</b>
</div>
</div>
</script>
<script type="text/x-red" data-help-name="chatbot-location"><p>Send a position message to the chatbot (a tiny clicable map).</p>
<p>It’s possible to programmatically send a location node by passing the parameters from a upstream <code>Function node</code>:</p>
<pre><code class="language-javascript">msg.payload.latitude = 45.00;
msg.payload.longitude = 23.00;
return msg;
</code></pre>
<p>Available parameters for the <code>msg.payload</code></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody><tr>
<td>latitude</td>
<td>float</td>
<td>The position latitude</td>
</tr>
<tr>
<td>longitude</td>
<td>float</td>
<td>The position longitude</td>
</tr>
<tr>
<td>place</td>
<td>string</td>
<td>The position description</td>
</tr>
</tbody></table>
<p>Platform exceptions - <strong>Telegram</strong> only supports live location when using the <em>webHook</em> connection mode and not <em>polling</em></p>
</script>