forked from raweee/node-red-contrib-whatsapp-link
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chats-in.html
178 lines (167 loc) · 8.12 KB
/
chats-in.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
<script type="text/javascript">
(function () {
let socketEventOptions = [
{ value : 'messages.upsert', lable : 'messages.upsert'},
{ value : 'connection.update', lable : 'connection.update'},
{ value : 'creds.update', lable : 'creds.update'},
{ value : 'messaging-history.set', lable : 'messaging-history.set'},
{ value : 'chats.upsert', lable : 'chats.upsert'},
{ value : 'chats.update', lable : 'chats.update'},
{ value : 'chats.delete', lable : 'chats.delete'},
{ value : 'presence.update', lable : 'presence.update'},
{ value : 'contacts.upsert', lable : 'contacts.upsert'},
{ value : 'contacts.update', lable : 'contacts.update'},
{ value : 'messages.delete', lable : 'messages.delete'},
{ value : 'messages.update', lable : 'messages.update'},
{ value : 'messages.media-update', lable : 'messages.media-update'},
{ value : 'messages.reaction', lable : 'messages.reaction'},
{ value : 'message-receipt.update', lable : 'message-receipt.update',},
{ value : 'groups.upsert', lable : 'groups.upsert'},
{ value : 'groups.update', lable : 'groups.update'},
{ value : 'group-participants.update', lable : 'group-participants.update'},
{ value : 'blocklist.set', lable : 'blocklist.set'},
{ value : 'blocklist.update', lable : 'blocklist.update'},
{ value : 'call', lable : 'call'}
];
let webEventOpstions = [
{ value : 'message', label : 'message'},
{ value : 'message_create', label : 'message_create'},
{ value : 'auth_failure', label : 'auth_failure'},
{ value : 'authenticated', label : 'authenticated'},
{ value : 'change_battery', label : 'change_battery'},
{ value : 'change_state', label : 'change_state'},
{ value : 'disconnected', label : 'disconnected'},
{ value : 'group_join', label : 'group_join'},
{ value : 'group_leave', label : 'group_leave'},
{ value : 'group_update', label : 'group_update'},
{ value : 'incoming_call', label : 'incoming_call'},
{ value : 'media_uploaded', label : 'media_uploaded'},
{ value : 'message_ack', label : 'message_ack'},
{ value : 'message_reaction', label : 'message_reaction'},
{ value : 'message_revoke_everyone', label : 'message_revoke_everyone'},
{ value : 'message_revoke_me', label : 'message_revoke_me'},
{ value : 'qr', label : 'qr'},
{ value : 'ready', label : 'ready'}
];
function setMyInputLable(myLable) {
return { "value": myLable, "label": myLable }
}
RED.nodes.registerType('chats-in',{
category: 'whatsapp',
color: '#25D366',
defaults: {
name: {value:"Chats In"},
whatsappLink: {value:"whatsapp-web", type:'whatsappLink'},
whatsappLiteevent : {},
whatsappWebevent : {}
},
outputs:1,
icon: 'whatsappLink.svg',
label: function() {
return this.name||"Chats In";
},
oneditprepare: function(){
$("#node-input-whatsappWebevent").typedInput({
types: [
{
value: "Select Client Type",
multiple: "true",
options: webEventOpstions
}
]
});
$("#node-input-whatsappLiteevent").typedInput({
types: [
{
value: "Select Client Type",
multiple: "true",
options: socketEventOptions
}
]
})
}
});
})();
</script>
<script type="text/html" data-template-name="chats-in">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-whatsappLink"><i class="fa fa-gear"></i> Client</label>
<input type="text" id="node-input-whatsappLink" placeholder="Name">
</div>
<hr>
<div>
<label for="node-input-whatsappLiteevent" ><i class="fa fa-envelope"></i> Socket Event : <input type="text" id="node-input-whatsappLiteevent"></label>
</div>
<div class="form-tips">
<p>waSocketClient only. Select <b>message.upsert</b> to recive all chats messages.
Multiple options are also avilable</p>
</div>
<hr>
<div>
<label for="node-input-whatsappWebevent" ><i class="fa fa-envelope"></i> Web Event : <input type="text" id="node-input-whatsappWebevent"></label>
</div>
<div class="form-tips">
<p>waWebClient only. Select <b>message</b> to recive all chats messages.
Multiple options are also avilable</p>
</div>
</script>
<script type="text/markdown" data-help-name="chats-in">
Node to recive all messages send to connected number.
- Simply deploy the node and wait for connected (green) status.
- After succesfully connection, Node is able to recive all messages.
| Output | Description |
|--------|-------------|
| `msg.paylod` | Recived message |
| `msg.from` | Sender Number |
| `msg.chatID` | Chat ID of Group chat / Personal chat |
| `msg.message` | Complete message object. <br />*Some extra details for advance users* |
Other Events options for waWebClient --
| waWebClient | Description |
|-------------|-------------|
| `message`
| `message_create`
| `auth_failure`
| `authenticated`
| `change_battery`
| `change_state`
| `disconnected`
| `group_join`
| `group_leave`
| `group_update`
| `incoming_call`
| `media_uploaded`
| `message_ack`
| `message_reaction`
| `message_revoke_everyone`
| `message_revoke_me`
| `qr`
| `ready`
Other Events options for waSocketClient --
| waSocketClient | Description |
|-------------|----------------|
| `messages.upsert`
| `connection.update`
| `creds.update`
| `messaging-history.set`
| `chats.upsert`
| `chats.update`
| `chats.delete`
| `presence.update`
| `contacts.upsert`
| `contacts.update`
| `messages.delete`
| `messages.update`
| `messages.media-update`
| `messages.reaction`
| `message-receipt.update`
| `groups.upsert`
| `groups.update`
| `group-participants.update`
| `blocklist.set`
| `blocklist.update`
| `call`
</script>