n8n-nodes-zalo-custom 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,524 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.zaloCommunicationFields = exports.zaloCommunicationOperations = void 0;
4
+
5
+ exports.zaloCommunicationOperations = [
6
+ {
7
+ displayName: 'Resource',
8
+ name: 'resource',
9
+ type: 'options',
10
+ noDataExpression: true,
11
+ options: [
12
+ {
13
+ name: 'Sticker',
14
+ value: 'sticker',
15
+ description: 'Quản lý và gửi sticker Zalo',
16
+ },
17
+ {
18
+ name: 'Poll',
19
+ value: 'poll',
20
+ description: 'Quản lý bình chọn Zalo',
21
+ },
22
+ {
23
+ name: 'Tag',
24
+ value: 'tag',
25
+ description: 'Quản lý thẻ (tag) trong Zalo',
26
+ },
27
+ ],
28
+ default: 'sticker',
29
+ },
30
+ // Operations for Sticker Resource
31
+ {
32
+ displayName: 'Operation',
33
+ name: 'operation',
34
+ type: 'options',
35
+ noDataExpression: true,
36
+ displayOptions: {
37
+ show: {
38
+ resource: ['sticker'],
39
+ },
40
+ },
41
+ options: [
42
+ {
43
+ name: 'Gửi Sticker',
44
+ value: 'sendSticker',
45
+ action: 'Gửi Sticker',
46
+ },
47
+ {
48
+ name: 'Lấy Danh Sách Sticker',
49
+ value: 'getStickers',
50
+ action: 'Lấy Danh Sách Sticker',
51
+ },
52
+ {
53
+ name: 'Lấy Chi Tiết Sticker',
54
+ value: 'getStickerDetail',
55
+ action: 'Lấy Chi Tiết Sticker',
56
+ },
57
+ {
58
+ name: 'Tìm Kiếm Sticker Theo Từ Khoá',
59
+ value: 'searchStickers',
60
+ action: 'Tìm Kiếm Sticker Theo Từ Khoá',
61
+ },
62
+ ],
63
+ default: 'sendSticker',
64
+ },
65
+ // Operations for Poll Resource
66
+ {
67
+ displayName: 'Operation',
68
+ name: 'operation',
69
+ type: 'options',
70
+ noDataExpression: true,
71
+ displayOptions: {
72
+ show: {
73
+ resource: ['poll'],
74
+ },
75
+ },
76
+ options: [
77
+ {
78
+ name: 'Tạo bình chọn',
79
+ value: 'createPoll',
80
+ description: 'Tạo một bình chọn mới',
81
+ action: 'Tạo bình chọn',
82
+ },
83
+ {
84
+ name: 'Lấy thông tin bình chọn',
85
+ value: 'getPoll',
86
+ description: 'Lấy thông tin bình chọn',
87
+ action: 'Lấy thông tin bình chọn',
88
+ },
89
+ {
90
+ name: 'Khóa bình chọn',
91
+ value: 'lockPoll',
92
+ description: 'Khóa bình chọn',
93
+ action: 'Khóa bình chọn',
94
+ },
95
+ ],
96
+ default: 'createPoll',
97
+ },
98
+ // Operations for Tag Resource
99
+ {
100
+ displayName: 'Operation',
101
+ name: 'operation',
102
+ type: 'options',
103
+ noDataExpression: true,
104
+ displayOptions: {
105
+ show: {
106
+ resource: ['tag'],
107
+ },
108
+ },
109
+ options: [
110
+ {
111
+ name: 'Danh Sách Thẻ',
112
+ value: 'list',
113
+ description: 'Liệt kê tất cả các thẻ',
114
+ action: 'List'
115
+ },
116
+ {
117
+ name: 'Tạo Thẻ Mới',
118
+ value: 'create',
119
+ description: 'Tạo một thẻ mới',
120
+ action: 'Create'
121
+ },
122
+ {
123
+ name: 'Cập Nhật Thẻ',
124
+ value: 'update',
125
+ description: 'Cập nhật thông tin thẻ',
126
+ action: 'Update'
127
+ },
128
+ {
129
+ name: 'Gắn Thẻ Cho User',
130
+ value: 'tagUser',
131
+ description: 'Gắn thẻ cho một người dùng',
132
+ action: 'Tag user'
133
+ },
134
+ {
135
+ name: 'Bỏ Thẻ Khỏi User',
136
+ value: 'untagUser',
137
+ description: 'Bỏ thẻ khỏi một người dùng',
138
+ action: 'Untag user'
139
+ },
140
+ {
141
+ name: 'Gắn Thẻ Cho Group',
142
+ value: 'tagGroup',
143
+ description: 'Gắn thẻ cho một nhóm',
144
+ action: 'Tag group'
145
+ },
146
+ {
147
+ name: 'Bỏ Thẻ Khỏi Group',
148
+ value: 'untagGroup',
149
+ description: 'Bỏ thẻ khỏi một nhóm',
150
+ action: 'Untag group'
151
+ },
152
+ ],
153
+ default: 'list',
154
+ },
155
+ ];
156
+
157
+ exports.zaloCommunicationFields = [
158
+ // --- Fields for Sticker Resource ---
159
+ {
160
+ displayName: 'Tên Sticker',
161
+ name: 'name',
162
+ type: 'string',
163
+ required: true,
164
+ displayOptions: {
165
+ show: {
166
+ resource: ['sticker'], // Cập nhật resource
167
+ operation: ['getStickers'],
168
+ },
169
+ },
170
+ default: '',
171
+ description: 'Tên hoặc từ khóa để lấy sticker (để trống để lấy tất cả)',
172
+ },
173
+ {
174
+ displayName: 'Sticker ID',
175
+ name: 'stickerId',
176
+ type: 'string',
177
+ required: true,
178
+ displayOptions: {
179
+ show: {
180
+ resource: ['sticker'], // Cập nhật resource
181
+ operation: ['getStickerDetail', 'sendSticker'], // Thêm sendSticker
182
+ },
183
+ },
184
+ default: '',
185
+ description: 'ID của sticker cần lấy thông tin chi tiết hoặc gửi',
186
+ },
187
+ {
188
+ displayName: 'Từ Khóa Tìm Kiếm',
189
+ name: 'query',
190
+ type: 'string',
191
+ required: true,
192
+ displayOptions: {
193
+ show: {
194
+ resource: ['sticker'], // Cập nhật resource
195
+ operation: ['searchStickers'],
196
+ },
197
+ },
198
+ default: '',
199
+ description: 'Từ khóa để tìm kiếm sticker',
200
+ },
201
+ {
202
+ displayName: 'Thread Type',
203
+ name: 'threadType',
204
+ type: 'options',
205
+ displayOptions: {
206
+ show: {
207
+ resource: ['sticker'], // Cập nhật resource
208
+ operation: ['sendSticker'],
209
+ },
210
+ },
211
+ options: [
212
+ { name: 'User', value: 'User' }, // Sử dụng string 'User' và 'Group' để khớp với ThreadType.User/Group
213
+ { name: 'Group', value: 'Group' },
214
+ ],
215
+ default: 'User',
216
+ description: 'Loại cuộc trò chuyện (người dùng hoặc nhóm)',
217
+ },
218
+ {
219
+ displayName: 'Thread ID',
220
+ name: 'threadId',
221
+ type: 'string',
222
+ required: true,
223
+ displayOptions: {
224
+ show: {
225
+ resource: ['sticker'], // Cập nhật resource
226
+ operation: ['sendSticker'],
227
+ },
228
+ },
229
+ default: '',
230
+ description: 'ID của người dùng hoặc nhóm để gửi sticker',
231
+ },
232
+
233
+ // --- Fields for Poll Resource ---
234
+ {
235
+ displayName: 'ID Nhóm',
236
+ name: 'groupId',
237
+ type: 'string',
238
+ default: '',
239
+ required: true,
240
+ displayOptions: {
241
+ show: {
242
+ resource: ['poll'], // Cập nhật resource
243
+ operation: ['createPoll'],
244
+ },
245
+ },
246
+ description: 'ID của nhóm để tạo poll (chỉ hoạt động với nhóm)',
247
+ },
248
+ {
249
+ displayName: 'Chủ đề bình chọn',
250
+ name: 'question',
251
+ type: 'string',
252
+ required: true,
253
+ default: '',
254
+ displayOptions: {
255
+ show: {
256
+ resource: ['poll'], // Cập nhật resource
257
+ operation: ['createPoll'],
258
+ },
259
+ },
260
+ description: 'Đặt câu hỏi bình chọn',
261
+ },
262
+ {
263
+ displayName: 'Kiểu nhập lựa chọn',
264
+ name: 'optionInputType',
265
+ type: 'options',
266
+ options: [
267
+ {
268
+ name: 'Danh sách',
269
+ value: 'list',
270
+ description: 'Nhập từng lựa chọn riêng biệt',
271
+ },
272
+ {
273
+ name: 'Văn bản',
274
+ value: 'text',
275
+ description: 'Nhập tất cả lựa chọn trong một ô, phân tách bằng dấu phẩy',
276
+ },
277
+ ],
278
+ default: 'list',
279
+ displayOptions: {
280
+ show: {
281
+ resource: ['poll'], // Cập nhật resource
282
+ operation: ['createPoll'],
283
+ },
284
+ },
285
+ },
286
+ {
287
+ displayName: 'Các lựa chọn',
288
+ name: 'pollOptionsCollection',
289
+ type: 'fixedCollection',
290
+ placeholder: 'Thêm lựa chọn',
291
+ typeOptions: {
292
+ multipleValues: true,
293
+ sortable: true
294
+ },
295
+ default: {
296
+ options: [
297
+ { option: '' },
298
+ { option: '' },
299
+ ],
300
+ },
301
+ displayOptions: {
302
+ show: {
303
+ resource: ['poll'], // Cập nhật resource
304
+ operation: ['createPoll'],
305
+ optionInputType: ['list'],
306
+ },
307
+ },
308
+ options: [
309
+ {
310
+ name: 'options',
311
+ displayName: 'Lựa chọn',
312
+ values: [
313
+ {
314
+ displayName: 'Lựa chọn',
315
+ name: 'option',
316
+ type: 'string',
317
+ default: '',
318
+ placeholder: 'Nhập lựa chọn...',
319
+ description: 'Nội dung của lựa chọn',
320
+ required: true,
321
+ },
322
+ ],
323
+ },
324
+ ],
325
+ description: 'Thêm các lựa chọn cho bình chọn',
326
+ },
327
+ {
328
+ displayName: 'Các lựa chọn',
329
+ name: 'optionsString',
330
+ type: 'string',
331
+ default: 'Lựa chọn 1, Lựa chọn 2, Lựa chọn 3',
332
+ placeholder: 'Nhập các lựa chọn, phân tách bằng dấu phẩy...',
333
+ displayOptions: {
334
+ show: {
335
+ resource: ['poll'], // Cập nhật resource
336
+ operation: ['createPoll'],
337
+ optionInputType: ['text'],
338
+ },
339
+ },
340
+ description: 'Nhập các lựa chọn, mỗi lựa chọn phân tách bằng dấu phẩy',
341
+ },
342
+ {
343
+ displayName: 'Thời hạn bình chọn',
344
+ name: 'expiredTime',
345
+ type: 'dateTime',
346
+ required: false,
347
+ default: '',
348
+ displayOptions: {
349
+ show: {
350
+ resource: ['poll'], // Cập nhật resource
351
+ operation: ['createPoll'],
352
+ },
353
+ },
354
+ description: 'Thời hạn bình chọn (Để trống nếu không có thời hạn)',
355
+ },
356
+ {
357
+ displayName: 'Ghim lên đầu trò chuyện',
358
+ name: 'pinAct',
359
+ type: 'boolean',
360
+ required: false,
361
+ default: false,
362
+ displayOptions: {
363
+ show: {
364
+ resource: ['poll'], // Cập nhật resource
365
+ operation: ['createPoll'],
366
+ },
367
+ },
368
+ description: 'Tạo ghim lên đầu trò chuyện',
369
+ },
370
+ {
371
+ displayName: 'Chọn nhiều phương án',
372
+ name: 'allowMultiChoices',
373
+ type: 'boolean',
374
+ required: true,
375
+ default: true,
376
+ displayOptions: {
377
+ show: {
378
+ resource: ['poll'], // Cập nhật resource
379
+ operation: ['createPoll'],
380
+ },
381
+ },
382
+ description: 'Người tham gia có thể bình chọn nhiều phương án khác nhau',
383
+ },
384
+ {
385
+ displayName: 'Có thể thêm phương án',
386
+ name: 'allowAddNewOption',
387
+ type: 'boolean',
388
+ required: true,
389
+ default: true,
390
+ displayOptions: {
391
+ show: {
392
+ resource: ['poll'], // Cập nhật resource
393
+ operation: ['createPoll'],
394
+ },
395
+ },
396
+ description: 'Người tham gia có thể thêm phương án mới',
397
+ },
398
+ {
399
+ displayName: 'Ẩn kết quả khi chưa bình chọn',
400
+ name: 'hideVotePreview',
401
+ type: 'boolean',
402
+ required: true,
403
+ default: false,
404
+ displayOptions: {
405
+ show: {
406
+ resource: ['poll'], // Cập nhật resource
407
+ operation: ['createPoll'],
408
+ },
409
+ },
410
+ description: 'Người tham gia chỉ thấy kết quả sau khi bình chọn',
411
+ },
412
+ {
413
+ displayName: 'Ẩn người bình chọn',
414
+ name: 'isAnonymous',
415
+ type: 'boolean',
416
+ required: true,
417
+ default: false,
418
+ displayOptions: {
419
+ show: {
420
+ resource: ['poll'], // Cập nhật resource
421
+ operation: ['createPoll'],
422
+ },
423
+ },
424
+ description: 'Người tham gia không thể thấy người khác bình chọn',
425
+ },
426
+ {
427
+ displayName: 'ID bình chọn',
428
+ name: 'poll_id',
429
+ type: 'number',
430
+ default: '',
431
+ required: true,
432
+ displayOptions: {
433
+ show: {
434
+ resource: ['poll'], // Cập nhật resource
435
+ operation: ['getPoll', 'lockPoll'], // Thêm lockPoll
436
+ },
437
+ },
438
+ description: 'ID của bình chọn',
439
+ },
440
+
441
+ // --- Fields for Tag Resource ---
442
+ {
443
+ displayName: 'Tên Thẻ',
444
+ name: 'labelName',
445
+ type: 'string',
446
+ displayOptions: {
447
+ show: {
448
+ resource: ['tag'],
449
+ operation: ['create']
450
+ }
451
+ },
452
+ default: '',
453
+ description: 'Tên của thẻ mới',
454
+ required: true,
455
+ },
456
+ {
457
+ displayName: 'Màu Sắc',
458
+ name: 'labelColor',
459
+ type: 'color',
460
+ displayOptions: {
461
+ show: {
462
+ resource: ['tag'],
463
+ operation: ['create', 'update']
464
+ }
465
+ },
466
+ default: '#FF6B6B',
467
+ description: 'Màu sắc của thẻ (hex color)',
468
+ },
469
+ {
470
+ displayName: 'Emoji',
471
+ name: 'labelEmoji',
472
+ type: 'string',
473
+ displayOptions: {
474
+ show: {
475
+ resource: ['tag'],
476
+ operation: ['create', 'update']
477
+ }
478
+ },
479
+ default: '🏷️',
480
+ description: 'Emoji cho thẻ',
481
+ },
482
+ {
483
+ displayName: 'ID Thẻ',
484
+ name: 'labelId',
485
+ type: 'number',
486
+ displayOptions: {
487
+ show: {
488
+ resource: ['tag'],
489
+ operation: ['update', 'tagUser', 'tagGroup', 'untagUser', 'untagGroup']
490
+ }
491
+ },
492
+ default: 0,
493
+ description: 'ID của thẻ cần thao tác',
494
+ required: true,
495
+ },
496
+ {
497
+ displayName: 'User ID',
498
+ name: 'userId',
499
+ type: 'string',
500
+ displayOptions: {
501
+ show: {
502
+ resource: ['tag'],
503
+ operation: ['tagUser', 'untagUser']
504
+ }
505
+ },
506
+ default: '',
507
+ description: 'ID của người dùng',
508
+ required: true,
509
+ },
510
+ {
511
+ displayName: 'Group ID',
512
+ name: 'groupId',
513
+ type: 'string',
514
+ displayOptions: {
515
+ show: {
516
+ resource: ['tag'],
517
+ operation: ['tagGroup', 'untagGroup']
518
+ }
519
+ },
520
+ default: '',
521
+ description: 'ID của nhóm',
522
+ required: true,
523
+ },
524
+ ];