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
64 lines (59 loc) • 1.92 kB
HTML
<script type="text/javascript">
$.RedBot.registerType('chatbot-animation', {
category: $.RedBot.config.name,
color: '#FFCC66',
defaults: {
animation: {
value: ''
}
},
inputs: 1,
outputs: 1,
icon: 'chatbot-sticker.png',
paletteLabel: 'Animation',
label: function() {
return this.name || 'Animation';
}
});
</script>
<script type="text/x-red" data-template-name="chatbot-animation">
<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-animation">Animation</label>
<input type="text" id="node-input-animation" placeholder="Animation id or URL">
</div>
</script>
<script type="text/x-red" data-help-name="chatbot-animation"><p>The <code>Animation node</code> sends an animated GIF or video to the chatbot from a local file or from a URL or from a Buffer passed by an upstream node (the simplest way to use it to chain with to <code>File node</code> or a <code>Http node</code>).</p>
<p>To programmatically send an animation with a <code>Function node</code></p>
<pre><code class="language-javascript">msg.payload = '/my_dir/my_image.gif';
</code></pre>
<p>or</p>
<pre><code class="language-javascript">msg.payload = {
caption: 'I am the caption',
image: 'http://www.my_host.com/my_dir/my_image.gif'
};
</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>animation</td>
<td>string or buffer</td>
<td>The image string could be a path for a local file or a URL (context variables can be used)</td>
</tr>
<tr>
<td>caption</td>
<td>string</td>
<td>Caption of the image. Only for Telegram, Slack and Viber</td>
</tr>
</tbody></table>
</script>