forked from guidone/node-red-contrib-chatbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chatbot-image.html
62 lines (58 loc) · 1.66 KB
/
chatbot-image.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
<script type="text/javascript">
RED.nodes.registerType('chatbot-image', {
category: 'RedBot',
color: '#FFCC66',
defaults: {
name: {
value: ''
},
filename: {
value: ''
},
caption: {
value: '',
required: false
}
},
inputs: 1,
outputs: 1,
icon: 'chatbot-image.png',
paletteLabel: 'Image',
label: function() {
return this.name || 'Image';
}
});
</script>
<script type="text/x-red" data-template-name="chatbot-image">
<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-caption"><i class="fa fa-tag"></i> Caption</label>
<input type="text" id="node-input-caption" placeholder="Caption">
</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>
</script>
<script type="text/x-red" data-help-name="chatbot-image">
<p>
Send image, prepares the payload to send an image to the chat sender using the <code>Buffer</code> as input or
loading the file if specified in the node config <em>[Telegram, Facebook, Slack, Smooch]</em>.
</p>
<p>The image can be passed through the payload by the upstream node:</p>
<br/>
<pre>
msg.payload = {
caption: 'I am the caption',
image: msg.payload // an instance of Buffer
}
return msg;
</pre>
<p>
It's also possible to wire directly a file or http node (choosing "binary buffer" in the "return" drop down)
to the <code>Image node</code>.
</p>
</script>