forked from guidone/node-red-contrib-chatbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chatbot-document.html
75 lines (71 loc) · 2.53 KB
/
chatbot-document.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
<script type="text/javascript">
RED.nodes.registerType('chatbot-document', {
category: 'RedBot',
color: '#FFCC66',
defaults: {
name: {
value: ''
},
filename: {
value: ''
},
caption: {
value: '',
required: false
}
},
inputs: 1,
outputs: 1,
icon: 'chatbot-document.png',
paletteLabel: 'Document',
label: function() {
return this.name || 'Document';
}
});
</script>
<script type="text/x-red" data-template-name="chatbot-document">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-filename"><i class="fa fa-file"></i> Filename</label>
<input type="text" id="node-input-filename" placeholder="Filename">
</div>
<div class="form-row">
<label for="node-input-caption"><i class="fa fa-tag"></i> Caption</label>
<input type="text" id="node-input-caption" class="platform-telegram" placeholder="Caption">
</div>
<div style="max-width: 460px;font-size: 12px;color: #999999;line-height: 14px;clear:both;margin-top:5px;margin-bottom:10px;">
Some attributes apply for specific platform:<br>
<span class="icon-platform-facebook"></span> = <span style="font-size:10px">Facebook</span>
<span class="icon-platform-telegram"></span> = <span style="font-size:10px">Telegram</span>
<span class="icon-platform-smooch"></span> = <span style="font-size:10px">Smooch</span>
<span class="icon-platform-slack"></span> = <span style="font-size:10px">Slack</span>
</div>
</script>
<script type="text/x-red" data-help-name="chatbot-document">
<p>
Send a document, automatically zip it if the used platform doesn't support the file format <em>[Telegram, Facebook]</em>.
</p>
<p>
The <code>Document node</code> can send a file from the local filesystem or from a Buffer payload from the upstream node or
from a <code>File node</code>.
</p>
<p>
Some file types are not supported by a specific platform, for example <em>Telegram</em> only supports <em>.zip</em>, <em>.pdf</em>, <em>.gif</em>. A file not supported is automatically zipped.<br>
</p>
<p>
To programmatically send a document, in the upstream <code>Function node</code>
<pre>
msg.payload.file = new Buffer(<my-buffer>);
msg.payload.filename = 'my-file-name.pdf';
return msg;
</pre>
<code>.file</code> is a <code>Buffer</code> type. To pass the path of a local file from the upstream node
<pre>
msg.filename = '/my/local/file.pdf';
return msg;
</pre>
</p>
</script>