forked from guidone/node-red-contrib-chatbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchatbot-conversation.html
70 lines (66 loc) · 2.32 KB
/
chatbot-conversation.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
<script type="text/javascript">
RED.nodes.registerType('chatbot-conversation', {
category: 'RedBot',
color: '#FFCC66',
defaults: {
name: {
value: ''
},
chatId: {
value: ''
},
transport: {
value: ''
}
},
inputs: 1,
outputs: 1,
paletteLabel: 'Conversation',
icon: 'chatbot-conversation.png',
label: function() {
return this.name || 'Conversation';
}
});
</script>
<script type="text/x-red" data-template-name="chatbot-conversation">
<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-transport"><i class="icon-plane"></i> Transport</label>
<select id="node-input-transport">
<option value="">Select transport</option>
<option value="facebook">Facebook Messenger</option>
<option value="slack">Slack</option>
<option value="smooch">Smooch</option>
<option value="telegram">Telegram</option>
</select>
</div>
<div class="form-row">
<label for="node-input-name"><i class="icon-user"></i> ChatId</label>
<input type="text" id="node-input-chatId" placeholder="Chat id">
<div style="max-width: 460px;font-size: 12px;color: #999999;line-height: 14px;clear:both;">
The <code>chatId</code> is needed to initiate the conversation (you can grab the chatId from the logs or a debug node),
the <code>chatId</code> is unique per user across the different platforms (Telegram, Facebook, Slack).
</div>
</div>
</script>
<script type="text/x-red" data-help-name="chatbot-conversation">
<p>
Start a chat bot conversation, for example to initiate a conversation (sending a message) to a user in response of a
Node Red event, chain this node to a Message node (or Image, Location, etc) <em>[Telegram, Facebook, Smooch, Slack]</em>
</p>
<p>
The <code>chatId</code> is needed to initiate the conversation (you can grab the chatId from the logs or a debug node),
the <code>chatId</code> is unique per user across the different platforms (Telegram, Facebook, Slack).
</p>
<p>The parameters <code>chatId</code> and <code>transport</code> can be passed through the payload by the upstream node:</p>
<pre>
msg.payload = {
chatId: '42',
transport: 'telegram'
};
return msg;
</pre>
</script>