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) • 2.47 kB
HTML
<script type="text/javascript">
RED.nodes.registerType('chatbot-document', {
category: 'RedBot',
color: '#FFCC66',
defaults: {
name: {
value: ''
},
filename: {
value: ''
},
caption: {
value: '',
required: false
}
},
inputs: 1,
outputs: 1,
icon: 'chatbot-document.png',
paletteLabel: 'Document',
label: function() {
return this.name || 'Document';
},
oneditprepare: function() {
$.RB_Legend();
}
});
</script>
<script type="text/x-red" data-template-name="chatbot-document">
<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-filename">Filename</label>
<input type="text" id="node-input-filename" placeholder="Filename">
</div>
<div class="form-row">
<label for="node-input-caption">Caption</label>
<input type="text" id="node-input-caption" class="platform-telegram-slack" placeholder="Caption">
</div>
<div class="redbot-form-legend"></div>
</script>
<script type="text/x-red" data-help-name="chatbot-document"><p>Send a document, automatically zip it if the used platform doesn't support the file format [Telegram, Facebook].</p>
<p>The <code>Document node</code> can send a file from the local filesystem or from a Buffer payload from the upstream node or
from a <code>File node</code>.</p>
<p>Some file types are not supported by a specific platform, for example <em>Telegram</em> only supports <em>.zip</em>, <em>.pdf</em>, <em>.gif</em>. A file not supported is automatically zipped.</p>
<p>To programmatically send a document, in the upstream <code>Function node</code></p>
<pre><code>msg.payload.file = new Buffer(<my-buffer>);
msg.payload.filename = 'my-file-name.pdf';
return msg;
</code></pre><p><code>.file</code> is a <code>Buffer</code> type. To pass the path of a local file from the upstream node</p>
<pre><code>msg.filename = '/my/local/file.pdf';
return msg;
</code></pre><p><img src="https://img.shields.io/badge/platform-Telegram-blue.svg?colorB=7cbaea" alt="Telegram">
<img src="https://img.shields.io/badge/platform-Facebook-blue.svg" alt="Facebook">
<img src="https://img.shields.io/badge/platform-Slack-green.svg" alt="Slack">
<img src="https://img.shields.io/badge/platform-Viber-8079d0.svg" alt="Viber"></p>
</script>