UNPKG

prisme-flow

Version:

prisme platform flow engine

181 lines (166 loc) 5.73 kB
<!-- Created by prisme.io on 09/06/2017. @author <a href="mailto:hello@prisme.io">savane vamara</a> (prisme.io) --> <script type="text/javascript"> RED.nodes.registerType('bot-facebook-node', { category: 'config', defaults: { botname: { value: '', required: true }, usernames: { value: '', required: false }, log: { value: null } }, paletteName: 'facebook bot', credentials: { token: { type: 'text' }, verify_token: { type: 'text' }, app_secret: { type: 'text' } }, label: function () { return this.botname; } }); </script> <script type="text/x-red" data-template-name="bot-facebook-node"> <div class="form-row"> <label for="node-config-input-botname"><i class="icon-bookmark"></i> Bot-Name</label> <input type="text" id="node-config-input-botname"> </div> <div class="form-row"> <label for="node-config-input-token"><i class="icon-cog"></i> Token</label> <input type="text" id="node-config-input-token" placeholder="Access Token"> <div style="max-width: 460px;font-size: 12px;color: #999999;line-height: 14px;margin-top:5px;"> The access token that is generated when the Facebook app is connected to a Facebook page </div> </div> <div class="form-row"> <label for="node-config-input-app_secret"><i class="icon-cog"></i> App Secret</label> <input type="text" id="node-config-input-app_secret" placeholder="App secret"> <div style="max-width: 460px;font-size: 12px;color: #999999;line-height: 14px;margin-top:5px;"> This is the app secret, find it in the "dashboard" section of the Facebook app </div> </div> <div class="form-row"> <label for="node-config-input-verify_token"><i class="icon-random"></i> Verify</label> <input type="text" id="node-config-input-verify_token" placeholder="Verify token"> <div style="max-width: 460px;font-size: 12px;color: #999999;line-height: 14px;margin-top:5px;"> The verify token is an arbitrary string, must match the same string in the "Webhooks" section in the Facebook app </div> </div> <div class="form-row"> <label for="node-config-input-usernames"><i class="icon-user"></i> Users</label> <input type="text" id="node-config-input-usernames" placeholder="Authorized users"> <div style="max-width: 460px;font-size: 12px;color: #999999;line-height: 14px;margin-top:5px;"> Comma separated list of userId authorized to use the chatBot </div> </div> <div class="form-row"> <label for="node-config-input-log"><i class="icon-file"></i> Log file</label> <input type="text" id="node-config-input-log"> <div style="max-width: 460px;font-size: 12px;color: #999999;line-height: 14px;margin-top:5px;"> Store inbound and outbound messages to file </div> </div> </script> <script type="text/x-red" data-help-name="bot-facebook-node"> <p> Configure the Facebook chat bot </p> </script> <script type="text/javascript"> RED.nodes.registerType('bot-facebook-receive', { category: 'bot-platforms', color: '#FFCC66', defaults: { bot: { value: '', type: 'bot-facebook-node', required: true } }, inputs: 0, outputs: 1, icon: 'facebook-receive.png', paletteLabel: 'facebook in', label: function () { return "facebook receiver"; } }); </script> <script type="text/x-red" data-template-name="bot-facebook-receive"> <div class="form-row"> <label for="node-input-bot"><i class="icon-bookmark"></i> Bot</label> <input type="text" id="node-input-bot" placeholder="Bot"> </div> </script> <script type="text/x-red" data-help-name="chatbot-facebook-receive"> <p>Receive a message (text, audio, video, image, etc) from a Facebook Messenger bot.</p> <p>The message is stored in <code>msg.payload</code>, this node also stores in the context flow: <code>username</code>, <code>firstName</code>, <code>lastName</code>, <code>chatId</code>, <code>authorized</code>, <code>transport</code> and <code>messageId</code>. </p> </script> <script type="text/javascript"> RED.nodes.registerType('bot-facebook-send', { category: 'bot-platforms', color: '#FFCC66', defaults: { bot: { value: "", type: 'bot-facebook-node', required: true }, track: { value: false }, outputs: { value: 0 } }, inputs: 1, outputs: 0, icon: 'facebook-receive.png', paletteLabel: 'facebook out', label: function () { return "Facebook Sender"; }, oneditsave: function() { var track = $('#node-input-track').is(':checked'); this.outputs = track ? 1 : 0; } }); </script> <script type="text/x-red" data-template-name="bot-facebook-send"> <div class="form-row"> <label for="node-input-bot"><i class="icon-bookmark"></i> Bot</label> <input type="text" id="node-input-bot" placeholder="Bot"> </div> <div class="form-row"> <label for="node-input-track"><i class="icon-envelope"></i> Track</label> <input type="checkbox" value="true" id="node-input-track"> <div style="max-width: 460px;font-size: 12px;color: #999999;line-height: 14px;margin-top:5px;"> Track response of the user for this message, any further answer will be redirect to the output pin. </div> </div> </script> <script type="text/x-red" data-help-name="bot-facebook-send"> <p> Send a message (text, audio, video, image, etc) from a Facebook Messenger bot. In order to create complex conversations, it can track answers from the user using output pin. </p> </script>