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

53 lines (48 loc) 2.41 kB
<script type="text/javascript"> RED.nodes.registerType('chatbot-command', { category: 'RedBot Parsers', color: '#FFCC66', defaults: { name: { value: '' }, command: { value: '/' } }, inputs: 1, outputs: 1, paletteLabel: 'Command', icon: 'chatbot-command.png', label: function() { var command = this.command; if (command != null && command.length > 0) { if (command[0] != '/') { command = '/' + command; } return command; } else { return 'Command'; } } }); </script> <script type="text/x-red" data-template-name="chatbot-command"> <div class="form-row"> <label for="node-input-command"><i class="icon-tag"></i> Command</label> <input type="text" id="node-input-command" placeholder="Command"> <div style="max-width: 460px;font-size: 12px;color: #999999;line-height: 14px;margin-top:5px;"> The command to listen to, should start with <code>/</code> </div> </div> </script> <script type="text/x-red" data-help-name="chatbot-command"><p>Listen for <em>Telegram</em>-like commands, for example <code>/my-command</code></p> <p>The node pass through the message to the output only if the message content equals the command.</p> <p>In <strong>Telegram</strong> are available shortcuts for commands (can be defined in <code>@BotFather</code>).</p> <p>Messages that starts with <code>/</code> are not parsed by nodes like <code>Listen node</code> and <code>Rivescript node</code>.</p> <p><strong>Slack:</strong> When the user executes a command in the <strong>Slack</strong> client a callback is triggered to the <strong>Node-RED</strong> server. Commands must be defined in the <a href="http://api.slack.com">Slack API</a>, as <em>Request URL</em> use the address <code>https://my-node-red-server.com/redbot/slack/command</code> (an <em>https</em> address is required, in development mode use <strong>ngrok</strong> <code>https://123466.ngrok.io/redbot/slack/command</code>) </p> <p><img src="https://img.shields.io/badge/platform-Telegram-blue.svg?colorB=7cbaea" alt="Telegram"> <img src="https://img.shields.io/badge/platform-Slack-green.svg" alt="Slack"> <img src="https://img.shields.io/badge/platform-Facebook-blue.svg" alt="Facebook"> <img src="https://img.shields.io/badge/platform-Smooch-orange.svg" alt="Smooch"></p> </script>