-
Notifications
You must be signed in to change notification settings - Fork 21
/
bizwechat.html
executable file
·409 lines (384 loc) · 12.6 KB
/
bizwechat.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
<script type="text/javascript">
RED.nodes.registerType('bizwechat-input', {
category: '企业微信',
color: '#7ac6cb',
paletteLabel: '服务端',
label () {
return this.name || '服务端'
},
defaults: {
name: {
value: ''
},
bizwechat: {
value: '',
type: 'bizwechat-configurator'
}
},
inputs: 0,
outputs: 1,
icon: 'white-globe.png'
})
RED.nodes.registerType('bizwechat-output', {
category: '企业微信',
color: '#7ac6cb',
paletteLabel: '输出',
label () {
return this.name || '输出'
},
defaults: {
name: {
value: ''
},
bizwechat: {
value: '',
type: 'bizwechat-configurator'
}
},
inputs: 1,
outputs: 0,
icon: 'white-globe.png',
align: 'right'
})
RED.nodes.registerType('bizwechat-push', {
category: '企业微信',
color: '#7ac6cb',
paletteLabel: '高级推送',
label () {
return this.name || '高级推送'
},
defaults: {
name: {
value: ''
},
bizwechat: {
value: '',
type: 'bizwechat-configurator'
}
},
inputs: 1,
outputs: 1,
icon: 'white-globe.png',
})
RED.nodes.registerType('bizwechat-upload', {
category: '企业微信',
color: '#7ac6cb',
paletteLabel: '上传临时素材',
label () {
return this.name || '上传临时素材'
},
defaults: {
name: {
value: ''
},
bizwechat: {
value: '',
type: 'bizwechat-configurator'
}
},
inputs: 1,
outputs: 1,
icon: 'white-globe.png',
})
RED.nodes.registerType('bizwechat-pushbear', {
category: '企业微信',
color: '#7ac6cb',
paletteLabel: '推送',
label () {
return this.name || '推送'
},
defaults: {
name: {
value: ''
},
bizwechat: {
value: '',
type: 'bizwechat-configurator'
},
touser: {
value: ''
},
toparty: {
value: ''
},
title: {
value: ''
},
description: {
value: ''
},
longPath: {
value: false
}
},
inputs: 1,
outputs: 1,
icon: 'white-globe.png'
})
RED.nodes.registerType('bizwechat-template', {
category: '企业微信',
color: '#7ac6cb',
paletteLabel: '推送网页内容',
label () {
return this.name || '推送网页内容'
},
defaults: {
name: {
value: ''
},
bizwechat: {
value: '',
type: 'bizwechat-configurator'
},
title: {
value: ''
},
description: {
value: ''
},
longPath: {
value: false
}
},
inputs: 1,
outputs: 1,
icon: 'white-globe.png'
})
</script>
<script type="text/x-red" data-template-name="bizwechat-input">
<div class="form-row">
<label for="node-input-bizwechat"><i class="icon-tag"></i>配置</label>
<input type="text" id="node-input-bizwechat">
</div>
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i>名称</label>
<input type="text" id="node-input-name">
</div>
</script>
<script type="text/x-red" data-help-name="bizwechat-input">
<p>企业微信服务器节点,用于接收企业微信发过来的消息</p>
<p>接收到企业微信发布的消息必须在30s内回复,不然企业微信会重复发送三次防止失败</p>
<h3>输出</h3>
<dl class="message-properties">
<dt>config
<span class="property-type">object</span>
</dt>
<dd>服务器节点配置信息</dd>
<dt class="message-properties">message
<span class="property-type">object</span>
</dt>
<dd>企业微信发过来的消息</dd>
<dl class="message-properties">
<dt>ToUserName
<span class="property-type">string</span>
</dt>
<dd>接收者账号</dd>
<dt class="message-properties">FromUserName
<span class="property-type">string</span>
</dt>
<dd>发送人账号</dd>
<dt class="message-properties">CreateTime
<span class="property-type">long</span>
</dt>
<dd>发送时间</dd>
<dt class="message-properties">MsgType
<span class="property-type">string</span>
</dt>
<dd>消息类型</dd>
<dt class="message-properties">AgentID
<span class="property-type">long</span>
</dt>
<dd>应用id</dd>
<dd>消息类型</dd>
<dt class="message-properties">Event
<span class="property-type">long</span>
</dt>
<dd>事件类型</dd>
</dl>
<dt class="message-properties">req
<span class="property-type">Object</span>
</dt>
<dd>http请求的request</dd>
<dt class="message-properties">res
<span class="property-type">Object</span>
</dt>
<dd>http请求的response</dd>
</dl>
</script>
<script type="text/x-red" data-template-name="bizwechat-output">
<div class="form-row">
<label for="node-input-bizwechat"><i class="icon-tag"></i>配置</label>
<input type="text" id="node-input-bizwechat">
</div>
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i>名称</label>
<input type="text" id="node-input-name">
</div>
</script>
<script type="text/x-red" data-help-name="bizwechat-output">
<p>回复企业微信发布的信息</p>
<h3>输入</h3>
<p>其余输入信息参考<strong>服务器节点的输出</strong>,此节点只能是服务器节点的后续节点,且中间处理流程不能影响<strong>msg.res</strong>,否则造成消息无法回复</p>
<dl class="message-properties">
<dt>payload
<span class="property-type">string</span>
</dt>
<dd>回复消息文本,文本为空即:'',则为响应企业微信</dd>
</dl>
</script>
<script type="text/x-red" data-template-name="bizwechat-pushbear">
<div class="form-row">
<label for="node-input-bizwechat"><i class="icon-tag"></i>配置</label>
<input type="text" id="node-input-bizwechat">
</div>
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i>名称</label>
<input type="text" id="node-input-name">
</div>
<div class="form-row">
<label for="node-input-touser"><i class="icon-tag"></i>接收者</label>
<input type="text" id="node-input-touser" placeholder="接收者账号,多个使用|分割,不填写默认全部接收">
</div>
<div class="form-row">
<label for="node-input-title"><i class="icon-tag"></i>标题</label>
<input type="text" id="node-input-title" placeholder="发送信息的标题">
</div>
<div class="form-row">
<label for="node-input-description"><i class="icon-tag"></i>内容</label>
<textarea id="node-input-description" placeholder="发送信息的内容(MarkDown语法)" style="width: 70%; height:200px;"></textarea>
</div>
<div class="form-row">
<label for="node-input-longPath"><i class="icon-tag"></i>长链接</label>
<input type="checkbox" style="width: 20px; " id="node-input-longPath"></input>
<label style="width: auto;text-align: right;padding-right: 12px;margin: 4px 0 0;" >
<a href="https://wx.zsxq.com/dweb2/index/group/51288182451214" target="_blank">勾选将会生成由小爱服务器穿透访问的长连接地址</a>
</label>
</div>
</script>
<script type="text/x-red" data-help-name="bizwechat-pushbear">
<p>推送信息到企业微信,目前仅支持卡片类型的消息</p>
<h3>输入</h3>
<dl class="message-properties">
<dt>payload
<span class="property-type">string</span>
</dt>
<dd>推送消息文本</dd>
<dt class="optional">touser <span class="property-type">string</span>
</dt>
<dd>消息接收的用户,多个可以使用|分开,例如:xxx|xxx|xxx,不填写默认推送所有人</dd>
<dt class="optional">introduction <span class="property-type">string</span>
</dt>
<dd>卡片上面的描述,用户一些从正文正提取信息不还好看的情况下</dd>
</dl>
<h3>输出</h3>
<p>输入信心合并配置信息输出</p>
</script>
<script type="text/x-red" data-template-name="bizwechat-push">
<div class="form-row">
<label for="node-input-bizwechat"><i class="icon-tag"></i>配置</label>
<input type="text" id="node-input-bizwechat">
</div>
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i>名称</label>
<input type="text" id="node-input-name">
</div>
</script>
<script type="text/x-red" data-help-name="bizwechat-push">
<p>高级推送</p>
<h3>输入</h3>
<p>发送自定义消息,具体信息格式<a href="https://work.weixin.qq.com/api/doc#90000/90135/90236">参考企业微信</a>,
企业应用的id和token程序自会动添加,其余信息需要自行填写</p>
<dl class="message-properties">
<dt>payload
<span class="property-type">object</span>
</dt>
<dd>需要发送的信息</dd>
</dl>
<dl class="message-properties">
<dt>image
<span class="property-type">object</span>
</dt>
<dd>临时媒体文件, 当使用高级节点时候,发现存在图片问下信息,将会自动上传,并把信息添加在对应消息体中,目前支持消息格式为: video 和mpnews</dd>
</dl>
<dl class="message-properties">
<dt> type
<span class="property-type">object</span>
</dt>
<dd> 文件类型,默认: image</dd>
</dl>
<dl class="message-properties">
<dt> filename
<span class="property-type">object</span>
</dt>
<dd>文件名称,默认: `${new Date().toLocaleString()}-${(Math.random() * 100).toFixed()}.jpg`</dd>
</dl>
<h3>输出</h3>
<p>企业微信返回信息完整返回</p>
</script>
<script type="text/x-red" data-template-name="bizwechat-upload">
<div class="form-row">
<label for="node-input-bizwechat"><i class="icon-tag"></i>配置</label>
<input type="text" id="node-input-bizwechat">
</div>
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i>名称</label>
<input type="text" id="node-input-name">
</div>
</script>
<script type="text/x-red" data-help-name="bizwechat-upload">
<p>上传临时素材</p>
<h3>输入</h3>
<p>素材上传得到media_id,该media_id仅三天内有效,所有文件size必须大于5个字节,
<a href="https://work.weixin.qq.com/api/doc#90000/90135/90253">上传的媒体文件限制</a>
</p>
<dl class="message-properties">
<dt>payload
<span class="property-type">buffer</span>
</dt>
<dd>需要上传的文件信息</dd>
<dt >type <span class="property-type">string</span>
</dt>
<dd>文件类型,参考上面链接</dd>
<dt >filename <span class="property-type">string</span>
</dt>
<dd>文件名称,随便填写,因为不知道你发送的文件格式</dd>
</dl>
<h3>输出</h3>
<p>企业微信返回信息完整返回</p>
</script>
<script type="text/x-red" data-template-name="bizwechat-template">
<div class="form-row">
<label for="node-input-bizwechat"><i class="icon-tag"></i>配置</label>
<input type="text" id="node-input-bizwechat">
</div>
<div class="form-row">
<label for="node-input-title"><i class="icon-tag"></i>标题</label>
<input type="text" id="node-input-title" placeholder="网页内容的标题">
</div>
<div class="form-row">
<label for="node-input-description"><i class="icon-tag"></i>内容</label>
<textarea id="node-input-description" placeholder="网页内容的文本(MarkDown语法)" style="width: 70%; height:200px;"></textarea>
</div>
<div class="form-row">
<label for="node-input-longPath"><i class="icon-tag"></i>长链接</label>
<input type="checkbox" style="width: 20px; " id="node-input-longPath"></input>
<label style="width: auto;text-align: right;padding-right: 12px;margin: 4px 0 0;" >
<a href="https://wx.zsxq.com/dweb2/index/group/51288182451214" target="_blank">勾选将会生成由小爱服务器穿透访问的长连接地址</a>
</label>
</div>
</script>
<script type="text/x-red" data-help-name="bizwechat-template">
<p>使用pushbear 存储推送信息详情</p>
<h3>输入</h3>
<dl class="message-properties">
<dt>payload
<span class="property-type">string</span>
</dt>
<dd>网页内容的文本</dd>
<dt class="optional">title <span class="property-type">string</span>
</dt>
<dd>网页内容的标题</dd>
</dl>
<h3>输出</h3>
<p>原始内容里面添加网页的url</p>
</script>