UNPKG

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

84 lines (81 loc) 2.83 kB
<script type="text/javascript"> $.RedBot.registerType('chatbot-video', { category: $.RedBot.config.name, color: '#FFCC66', defaults: { name: { value: '' }, filename: { value: '' }, video: { value: '' }, caption: { value: '', required: false } }, inputs: 1, outputs: 1, icon: 'chatbot-video.png', paletteLabel: 'Video', label: function() { return this.name || 'Video'; }, oneditprepare: function() { $.RedBot.fetchPlatforms() .done(function(platforms) { $('#dialog-form').RB_Platforms(); }); } }); </script> <script type="text/x-red" data-template-name="chatbot-video"> <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-video">Video</label> <input type="text" id="node-input-video" placeholder="Video file or URL"> </div> <div class="form-row"> <label for="node-input-caption">Caption</label> <input type="text" id="node-input-caption" placeholder="Caption"> <div class="redbot-platforms telegram slack whatsapp"/> </div> </script> <script type="text/x-red" data-help-name="chatbot-video"><p>The <code>Video node</code> sends a 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>Some file types are not supported by a specific platform, for example <em>Telegram</em> and <em>Facebook Messenger</em> only supports <em>.mp4</em>. Different video format che be sent with the <code>Document node</code>.</p> <p>To programmatically send a video, in the upstream <code>Function node</code></p> <pre><code class="language-javascript">msg.video = &#39;/my/local/my-video.mp4&#39;; return msg; </code></pre> <p>Or using a <code>Buffer</code>:</p> <pre><code class="language-javascript">msg.payload.document = new Buffer(&lt;my-video-buffer&gt;); msg.payload.filename = &#39;my-video.mp3&#39;; return msg; </code></pre> <p>In case the upstream node pass through a <code>Buffer</code>, the node tries to extract a proper file name (visible to user in the chat client) using the payload of the upstream <code>File node</code> or the name of the node itself.</p> <table> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody><tr> <td>video</td> <td>string or buffer</td> <td>The video 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 video. Only for Telegram, Slack and Viber</td> </tr> </tbody></table> </script>