node-red-contrib-feishu
Version:
Node-RED节点用于发送飞书消息
108 lines (100 loc) • 5.04 kB
HTML
<!-- 节点类型注册脚本 -->
<script type="text/javascript">
RED.nodes.registerType('wecom-app',{
category: 'social', // 节点分类:社交类
color: '#1AAD19', // 节点颜色
defaults: { // 默认配置项
name: {value:""}, // 节点名称,可选
corpId: {value:"", required:true}, // 企业ID,必填
agentId: {value:"", required:true}, // 应用ID,必填
agentSecret: {value:"", required:true}, // 应用Secret,必填
toUser: {value:""}, // 接收消息的用户,可选
toParty: {value:""}, // 接收消息的部门,可选
toTag: {value:""}, // 接收消息的标签,可选
messageType: {value:"text"} // 消息类型,默认为text
},
inputs:1, // 输入连接点数量
outputs:1, // 输出连接点数量
icon: "font-awesome/fa-weixin", // 节点图标
label: function() { // 节点标签显示函数
return this.name||"企业微信应用消息";
},
paletteLabel: "企业微信应用消息" // 面板中显示的节点名称
});
</script>
<!-- 节点配置界面模板 -->
<script type="text/html" data-template-name="wecom-app">
<!-- 节点名称配置 -->
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> 名称</label>
<input type="text" id="node-input-name" placeholder="节点显示名称(可选)">
</div>
<!-- 企业ID配置 -->
<div class="form-row">
<label for="node-input-corpId"><i class="fa fa-building"></i> 企业ID</label>
<input type="text" id="node-input-corpId" placeholder="企业微信的企业ID">
</div>
<!-- 应用ID配置 -->
<div class="form-row">
<label for="node-input-agentId"><i class="fa fa-id-card"></i> 应用ID</label>
<input type="text" id="node-input-agentId" placeholder="企业微信应用的AgentId">
</div>
<!-- 应用Secret配置 -->
<div class="form-row">
<label for="node-input-agentSecret"><i class="fa fa-key"></i> 应用Secret</label>
<input type="password" id="node-input-agentSecret" placeholder="企业微信应用的Secret">
</div>
<!-- 接收用户配置 -->
<div class="form-row">
<label for="node-input-toUser"><i class="fa fa-user"></i> 接收用户</label>
<input type="text" id="node-input-toUser" placeholder="接收消息的用户ID,多个用户用|分隔">
</div>
<!-- 接收部门配置 -->
<div class="form-row">
<label for="node-input-toParty"><i class="fa fa-users"></i> 接收部门</label>
<input type="text" id="node-input-toParty" placeholder="接收消息的部门ID,多个部门用|分隔">
</div>
<!-- 接收标签配置 -->
<div class="form-row">
<label for="node-input-toTag"><i class="fa fa-tags"></i> 接收标签</label>
<input type="text" id="node-input-toTag" placeholder="接收消息的标签ID,多个标签用|分隔">
</div>
<!-- 消息类型配置 -->
<div class="form-row">
<label for="node-input-messageType"><i class="fa fa-envelope"></i> 消息类型</label>
<select id="node-input-messageType">
<option value="text">文本</option>
<option value="markdown">Markdown</option>
<option value="textcard">文本卡片</option>
</select>
</div>
</script>
<!-- 节点帮助信息 -->
<script type="text/html" data-help-name="wecom-app">
<p>企业微信应用消息节点,用于发送应用消息到指定的用户、部门或标签组。</p>
<h3>输入</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">string | object</span></dt>
<dd>要发送的消息内容。</dd>
<dt class="optional">title <span class="property-type">string</span></dt>
<dd>消息标题,在发送文本卡片类型消息时使用。</dd>
<dt class="optional">description <span class="property-type">string</span></dt>
<dd>消息描述,在发送文本卡片类型消息时使用。</dd>
<dt class="optional">url <span class="property-type">string</span></dt>
<dd>点击消息跳转的链接,在发送文本卡片类型消息时使用。</dd>
</dl>
<h3>输出</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">object</span></dt>
<dd>包含发送结果的响应对象。</dd>
</dl>
<h3>详细信息</h3>
<p>该节点支持以下功能:</p>
<ul>
<li>支持发送文本、Markdown和文本卡片三种类型的消息</li>
<li>可以指定接收消息的用户、部门和标签</li>
<li>支持动态配置消息接收者</li>
<li>提供发送状态的实时反馈</li>
<li>包含详细的错误处理机制</li>
</ul>
</script>