UNPKG

node-red-contrib-line-messaging-api

Version:

Node-RED nodes for LINE Messaging API integration. Build LINE Bots easily with visual programming.

60 lines (58 loc) 2.04 kB
<script type="text/javascript"> RED.nodes.registerType('Webhook', { category: 'LINE', color: '#01B301', defaults: { name: { value: '' }, url: { value: '', required: true } }, inputs: 0, outputs: 1, outputLabels: ['msg.line'], icon: 'inject.svg', paletteLabel: 'Webhook', label: function () { if (this.name) { return this.name; } else if (this.url) { let root = RED.settings.httpNodeRoot; if (root.slice(-1) != '/') { root = root + '/'; } if (this.url.charAt(0) == '/') { root += this.url.slice(1); } else { root += this.url; } return root; } else { return 'Webhook'; } }, oneditprepare: function () { let root = RED.settings.httpNodeRoot; if (root.slice(-1) == '/') { root = root.slice(0, -1); } if (root == '') { $('#node-input-tip').hide(); } else { $('#node-input-path').html(root); $('#node-input-tip').show(); } } }); </script> <script type="text/x-red" data-template-name="Webhook"> <div class="form-row"> <label for="node-input-url"><i class="fa fa-globe"></i> <span data-i18n="Webhook.label.path">パス</span></label> <input id="node-input-url" type="text" placeholder="/webhook"> </div> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="Webhook.label.name">名前</span></label> <input id="node-input-name" type="text" placeholder="Name"> </div> </script> <script type="text/x-red" data-help-name="Webhook"> <p>A webhook endpoint node that receives from LINE platform when fire any events occurred.</p> </script>