UNPKG

node-red-contrib-tekosbot

Version:

Tekos bot based on matrix

141 lines (130 loc) 5.65 kB
<script type="text/x-red" data-template-name="tekos-slack"> <div class="form-row"> <label for="node-input-channelURL"><i class="fa fa-slack"></i> WebHook URL</label> <input type="text" id="node-input-channelURL" placeholder="channelURL" style=" vertical-align: top;"> </div> <div class="form-row"> <label for="node-input-username"><i class="fa fa-user"></i> Posting UserName</label> <input type="text" id="node-input-username" placeholder="username" style=" vertical-align: top;"> </div> <div class="form-row"> <label for="node-input-emojiIcon"><i class="fa fa-smile-o"></i> Emoji Icon</label> <input type="text" id="node-input-emojiIcon" placeholder=":emojiIcon:" style=" vertical-align: top;"> </div> <div class="form-row"> <label for="node-input-channel"><i class="fa fa-random"></i> Channel</label> <input type="text" id="node-input-channel" placeholder="optional channel override"> </div> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <input type="text" id="node-input-name" placeholder="Name"> </div> </script> <script type="text/x-red" data-help-name="tekos-slack"> <p>Sends the <b>msg.payload</b> to Slack.</p> <p>Simple way to post to a Slack channel.</p> <p>You can optionally override the destination channel if required - either in the edit dialogue or by setting <b>msg.channel</b>.</p> <p>You can also create <a href="https://api.slack.com/docs/attachments" target="_new">Slack attachments</a> by adding a <b>msg.attachments</b> property that must be an array.</p> </script> <!-- <script type="text/x-red" data-template-name="tekos-slack in""> <div class="form-row"> <label for="node-input-apiToken"><i class="fa fa-slack"></i> Bot API Token</label> <input type="text" id="node-input-apiToken" placeholder="apiToken" style=" vertical-align: top;"> </div> <div class="form-row"> <label for="node-input-channel"><i class="fa fa-random"></i> Channel</label> <input type="text" id="node-input-channel" placeholder="optional channel override"> </div> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <input type="text" id="node-input-name" placeholder="Name"> </div> </script> <script type="text/x-red" data-help-name="tekos-slack in"> <p>Provides a listener in any channel the Slack bot is a member of.</p> <p>Outputs the <b>msg.payload</b> as the incoming message.</p> <p>Outputs <b>msg.SlackObj</b> with full Slack message details.</p> <p>You can optionally limit the channel to listen to in the edit dialogue.</p> </script> <script type="text/x-red" data-template-name="tekos-slack out"> <div class="form-row"> <label for="node-input-apiToken"><i class="fa fa-slack"></i> Bot API Token</label> <input type="text" id="node-input-apiToken" placeholder="apiToken" style=" vertical-align: top;"> </div> <div class="form-row"> <label for="node-input-channel"><i class="fa fa-random"></i> Channel</label> <input type="text" id="node-input-channel" placeholder="optional channel override"> </div> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <input type="text" id="node-input-name" placeholder="Name"> </div> </script> <script type="text/x-red" data-help-name="tekos-slack out"> <p>Sends the <b>msg.payload</b> to Slack based on the Bot API token provided.</p> <p>You can optionally override the destination channel if required - either in the edit dialogue or by setting <b>msg.channel</b>.</p> </script> --> <script type="text/javascript"> RED.nodes.registerType('tekos-slack',{ category: 'Channels', color: '#009f9d', defaults: { name: {value:""}, channelURL: {value:"", required:true}, username: {value:""}, emojiIcon: {value:""}, channel: {value:""} }, icon: "hash.png", align: "left", inputs:1, outputs:0, paletteName: 'Slack', label: function() { return this.name||"slack"; }, labelStyle: function() { return this.name?"node_label_italic":""; } }); // RED.nodes.registerType('tekos-slack in',{ // category: 'Channels', // color: '#009f9d', // defaults: { // name: {value:""}, // apiToken: {value:"", required:true}, // channel: {value:""} // }, // icon: "hash.png", // align: "right", // inputs:0, // outputs:1, // paletteLabel: 'Slack In', // label: function() { // return this.name||"Slack In"; // }, // labelStyle: function() { // return this.name?"node_label_italic":""; // } // }); // RED.nodes.registerType('tekos-slack out',{ // category: 'Channels', // color: '#009f9d', // defaults: { // name: {value:""}, // apiToken: {value:"", required:true}, // channel: {value:""} // }, // icon: "hash.png", // align: "right", // inputs:1, // outputs:0, // paletteLabel: 'Slack Out', // label: function() { // return this.name||"Slack Out"; // }, // labelStyle: function() { // return this.name?"node_label_italic":""; // } // }); </script>