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
60 lines (55 loc) • 1.94 kB
HTML
<script type="text/javascript">
$.RedBot.registerType('chatbot-sticker', {
category: $.RedBot.config.name,
color: '#FFCC66',
defaults: {
sticker: {
value: ''
}
},
inputs: 1,
outputs: 1,
icon: 'chatbot-sticker.png',
paletteLabel: 'Sticker',
label: function() {
return this.name || 'Sticker';
}
});
</script>
<script type="text/x-red" data-template-name="chatbot-sticker">
<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-sticker">Sticker</label>
<input type="text" id="node-input-sticker" placeholder="Sticker id or URL">
</div>
</script>
<script type="text/x-red" data-help-name="chatbot-sticker"><p>The <code>Sticker node</code> allows to send a sticker to a <strong>Telegram</strong> client.</p>
<p>A sticker can be a image file (only <em><em>.webp</em> format is allowed) or the id of an already loaded image on</em> Telegram*’s server.</p>
<p>In order to get the id of a sticker, use <a href="https://telegram.me/GetStickerIdBot">GetStickerIdBot</a></p>
<p>To use this node programmatically, just connect the input to the output of a <code>File node</code> or send the file name or URL from a upstream <code>Function node</code></p>
<pre><code class="language-javascript">msg.payload = '/my_dir/my_file.webp'
</code></pre>
<p>or</p>
<pre><code class="language-plain">msg.payload = {
sticker: 'http://www.my_host.com/my_dir/my_file.webp'
}
</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>sticker</td>
<td>string or buffer</td>
<td>The sticker string could be the sticker id, the path for a local file or a URL</td>
</tr>
</tbody></table>
</script>