@periskope/types 0.6.151 → 0.6.152

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,1083 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.variablesExclusionList = exports.editorVariables = exports.ActionNameMap = exports.RuleNameMap = exports.isSendMessageAction = exports.FilterConditionMap = exports.ReactionVariableNameMap = exports.TicketVariableNameMap = exports.ChatVariableNameMap = exports.SenderVariableNameMap = exports.MessageVariableNameMap = exports.FilterNameMap = exports.isFilter = void 0;
4
+ const isFilter = (filter) => {
5
+ return (typeof filter === 'object' &&
6
+ 'id' in filter &&
7
+ 'condition' in filter &&
8
+ 'variable' in filter &&
9
+ 'value' in filter);
10
+ };
11
+ exports.isFilter = isFilter;
12
+ exports.FilterNameMap = {
13
+ EQ: {
14
+ name: 'equals to',
15
+ input: true,
16
+ },
17
+ NEQ: {
18
+ name: 'not equals to',
19
+ input: true,
20
+ },
21
+ CONTAINS: {
22
+ name: 'contains',
23
+ input: true,
24
+ },
25
+ NCONTAINS: {
26
+ name: 'does not contain',
27
+ input: true,
28
+ },
29
+ LT: {
30
+ name: 'less than',
31
+ input: true,
32
+ },
33
+ LTE: {
34
+ name: 'less than or equals to',
35
+ input: true,
36
+ },
37
+ GT: {
38
+ name: 'greater than',
39
+ input: true,
40
+ },
41
+ GTE: {
42
+ name: 'greater than or equals to',
43
+ input: true,
44
+ },
45
+ KNOWN: {
46
+ name: 'is known',
47
+ input: false,
48
+ },
49
+ NKNOWN: {
50
+ name: 'is not known',
51
+ input: false,
52
+ },
53
+ IS: {
54
+ name: 'is',
55
+ input: true,
56
+ },
57
+ NIS: {
58
+ name: 'is not',
59
+ input: true,
60
+ },
61
+ ON: {
62
+ name: 'on',
63
+ input: true,
64
+ },
65
+ };
66
+ exports.MessageVariableNameMap = {
67
+ 'message.body': {
68
+ text: 'Message Body',
69
+ type: 'string',
70
+ filters: ['CONTAINS', 'NCONTAINS', 'EQ', 'NEQ', 'KNOWN', 'NKNOWN'],
71
+ placeholder: 'e.g. Test message',
72
+ variable_type: 'string',
73
+ },
74
+ 'message.sender_phone': {
75
+ text: 'Message Sender Phone',
76
+ type: 'string',
77
+ filters: ['EQ', 'NEQ'],
78
+ placeholder: 'e.g. 919876543210',
79
+ variable_type: 'string',
80
+ },
81
+ 'message.timestamp': {
82
+ text: 'Message receive timestamp',
83
+ type: 'day-time',
84
+ filters: {
85
+ LT: {
86
+ info: 'When message is received before mentioned time (UTC)',
87
+ },
88
+ LTE: {
89
+ info: 'When message is received before mentioned time (UTC)',
90
+ },
91
+ GT: {
92
+ info: 'When message is received after mentioned time (UTC)',
93
+ },
94
+ GTE: {
95
+ info: 'When message is received on or after mentioned time (UTC)',
96
+ },
97
+ ON: {
98
+ info: 'When message is received on mentioned days',
99
+ },
100
+ },
101
+ variable_type: 'day-time',
102
+ info: 'The timestamp when the message was received',
103
+ },
104
+ 'message.flag_status': {
105
+ text: 'Message Flag Status',
106
+ filters: ['IS'],
107
+ type: 'boolean',
108
+ variable_type: 'boolean',
109
+ },
110
+ 'message.has_quoted_msg': {
111
+ text: 'Quoted Message',
112
+ filters: ['IS'],
113
+ type: 'boolean',
114
+ variable_type: 'boolean',
115
+ },
116
+ 'message.media': {
117
+ text: 'Message Media',
118
+ type: 'boolean',
119
+ filters: ['KNOWN', 'NKNOWN'],
120
+ variable_type: 'boolean',
121
+ },
122
+ 'message.performed_by': {
123
+ text: 'Message Performed By',
124
+ type: 'dropdown',
125
+ value: 'org.members',
126
+ filters: ['EQ', 'NEQ'],
127
+ variable_type: 'string',
128
+ },
129
+ 'message.chat_id': {
130
+ text: 'Chat ID',
131
+ type: 'string',
132
+ filters: ['EQ', 'NEQ'],
133
+ hidden: true,
134
+ variable_type: 'string',
135
+ },
136
+ 'message.message_id': {
137
+ text: 'Message ID',
138
+ type: 'string',
139
+ filters: ['EQ', 'NEQ'],
140
+ hidden: true,
141
+ variable_type: 'string',
142
+ },
143
+ 'message.org_phone': {
144
+ text: 'Org Phone',
145
+ type: 'string',
146
+ filters: ['EQ', 'NEQ'],
147
+ hidden: true,
148
+ variable_type: 'string',
149
+ },
150
+ 'message.org_id': {
151
+ text: 'Org ID',
152
+ type: 'string',
153
+ filters: ['EQ', 'NEQ'],
154
+ hidden: true,
155
+ variable_type: 'string',
156
+ },
157
+ 'message.message_type': {
158
+ text: 'Message Type',
159
+ type: 'dropdown',
160
+ value: [
161
+ { id: 'text', value: 'chat', label: 'Text' },
162
+ { id: 'image', value: 'image', label: 'Image' },
163
+ { id: 'video', value: 'video', label: 'Video' },
164
+ { id: 'audio', value: 'audio', label: 'Audio' },
165
+ { id: 'audio', value: 'ptt', label: 'PTT (Audio voice message)' },
166
+ { id: 'document', value: 'document', label: 'Document' },
167
+ ],
168
+ filters: ['EQ', 'NEQ'],
169
+ variable_type: 'string',
170
+ },
171
+ 'message.author': {
172
+ text: 'Message Author',
173
+ type: 'string',
174
+ filters: ['EQ', 'NEQ'],
175
+ hidden: true,
176
+ variable_type: 'string',
177
+ },
178
+ };
179
+ exports.SenderVariableNameMap = {
180
+ 'sender.is_business': {
181
+ text: 'Sender is business',
182
+ type: 'boolean',
183
+ filters: ['IS'],
184
+ variable_type: 'boolean',
185
+ },
186
+ 'sender.is_enterprise': {
187
+ text: 'Sender is enterprise',
188
+ type: 'boolean',
189
+ filters: ['IS'],
190
+ variable_type: 'boolean',
191
+ },
192
+ 'sender.is_internal': {
193
+ text: 'Sender is internal',
194
+ type: 'boolean',
195
+ filters: ['IS'],
196
+ variable_type: 'boolean',
197
+ },
198
+ 'sender.contact_name': {
199
+ text: 'Sender Name',
200
+ type: 'string',
201
+ filters: ['EQ', 'NEQ', 'KNOWN', 'NKNOWN'],
202
+ placeholder: 'e.g. John Doe',
203
+ variable_type: 'string',
204
+ },
205
+ 'sender.contact_id': {
206
+ text: 'Sender Contact Phone',
207
+ type: 'string',
208
+ filters: ['EQ', 'NEQ'],
209
+ placeholder: 'e.g. 919876543210',
210
+ variable_type: 'string',
211
+ },
212
+ 'sender.labels': {
213
+ text: 'Sender Labels',
214
+ type: 'dropdown',
215
+ value: 'org.labels',
216
+ filters: ['CONTAINS', 'NCONTAINS'],
217
+ variable_type: 'string',
218
+ },
219
+ 'sender.org_id': {
220
+ text: 'Org ID',
221
+ type: 'string',
222
+ filters: ['EQ', 'NEQ'],
223
+ hidden: true,
224
+ variable_type: 'string',
225
+ },
226
+ 'sender.is_super_admin': {
227
+ text: 'Sender is super admin',
228
+ type: 'dropdown',
229
+ filters: ['EQ', 'NEQ'],
230
+ value: [
231
+ {
232
+ id: 'true',
233
+ value: 'true',
234
+ label: 'True',
235
+ },
236
+ {
237
+ id: 'false',
238
+ value: 'false',
239
+ label: 'False',
240
+ },
241
+ ],
242
+ variable_type: 'boolean',
243
+ },
244
+ 'sender.is_admin': {
245
+ text: 'Sender is admin',
246
+ type: 'dropdown',
247
+ filters: ['EQ', 'NEQ'],
248
+ value: [
249
+ {
250
+ id: 'true',
251
+ value: 'true',
252
+ label: 'True',
253
+ },
254
+ {
255
+ id: 'false',
256
+ value: 'false',
257
+ label: 'False',
258
+ },
259
+ ],
260
+ variable_type: 'boolean',
261
+ },
262
+ };
263
+ exports.ChatVariableNameMap = {
264
+ 'chat.assigned_to': {
265
+ text: 'Chat Assignee',
266
+ type: 'dropdown',
267
+ value: 'org.members',
268
+ filters: ['EQ', 'NEQ', 'KNOWN', 'NKNOWN'],
269
+ variable_type: 'string',
270
+ },
271
+ 'chat.chat_name': {
272
+ text: 'Chat Name',
273
+ type: 'string',
274
+ filters: ['EQ', 'NEQ', 'CONTAINS', 'NCONTAINS'],
275
+ placeholder: 'e.g. Support Chat',
276
+ variable_type: 'string',
277
+ },
278
+ 'chat.org_phone': {
279
+ text: 'Chat Org Phone',
280
+ type: 'dropdown',
281
+ value: 'org.org_phones',
282
+ filters: ['EQ', 'NEQ'],
283
+ variable_type: 'string',
284
+ },
285
+ 'chat.chat_type': {
286
+ text: 'Chat Type',
287
+ type: 'dropdown',
288
+ value: [
289
+ { id: 'user', value: 'user', label: 'User' },
290
+ { id: 'group', value: 'group', label: 'Group' },
291
+ ],
292
+ filters: ['EQ', 'NEQ'],
293
+ variable_type: 'string',
294
+ },
295
+ 'chat.members': {
296
+ text: 'Chat Members',
297
+ type: 'string',
298
+ filters: ['CONTAINS', 'NCONTAINS'],
299
+ placeholder: 'e.g. 919876543210',
300
+ variable_type: 'string',
301
+ },
302
+ 'chat.labels': {
303
+ text: 'Chat Labels',
304
+ type: 'dropdown',
305
+ value: 'org.labels',
306
+ filters: ['CONTAINS', 'NCONTAINS'],
307
+ variable_type: 'string',
308
+ },
309
+ 'chat.chat_id': {
310
+ text: 'Chat ID',
311
+ type: 'string',
312
+ filters: ['EQ', 'NEQ'],
313
+ placeholder: 'e.g. 12027747916749@c.us',
314
+ variable_type: 'string',
315
+ },
316
+ 'chat.chat_org_phones': {
317
+ text: 'Chat Org Phones',
318
+ type: 'dropdown',
319
+ filters: ['CONTAINS', 'NCONTAINS'],
320
+ hidden: true,
321
+ variable_type: 'string',
322
+ },
323
+ 'chat.org_id': {
324
+ text: 'Org ID',
325
+ type: 'string',
326
+ filters: [],
327
+ hidden: true,
328
+ variable_type: 'string',
329
+ },
330
+ 'chat.messages_admins_only': {
331
+ text: 'Chat Messages Admins Only',
332
+ type: 'boolean',
333
+ filters: ['EQ', 'NEQ'],
334
+ value: [
335
+ {
336
+ id: 'true',
337
+ value: 'true',
338
+ label: 'True',
339
+ },
340
+ {
341
+ id: 'false',
342
+ value: 'false',
343
+ label: 'False',
344
+ },
345
+ ],
346
+ variable_type: 'boolean',
347
+ },
348
+ 'chat.is_muted': {
349
+ text: 'Chat is muted',
350
+ type: 'boolean',
351
+ filters: ['EQ', 'NEQ'],
352
+ value: [
353
+ {
354
+ id: 'true',
355
+ value: 'true',
356
+ label: 'True',
357
+ },
358
+ {
359
+ id: 'false',
360
+ value: 'false',
361
+ label: 'False',
362
+ },
363
+ ],
364
+ variable_type: 'boolean',
365
+ },
366
+ 'chat.info_admins_only': {
367
+ text: 'Chat Info Admins Only',
368
+ type: 'boolean',
369
+ filters: ['EQ', 'NEQ'],
370
+ value: [
371
+ {
372
+ id: 'true',
373
+ value: 'true',
374
+ label: 'True',
375
+ },
376
+ {
377
+ id: 'false',
378
+ value: 'false',
379
+ label: 'False',
380
+ },
381
+ ],
382
+ variable_type: 'boolean',
383
+ },
384
+ 'chat.has_flagged_messages': {
385
+ text: 'Chat has flagged messages',
386
+ type: 'boolean',
387
+ filters: ['EQ', 'NEQ'],
388
+ value: [
389
+ {
390
+ id: 'true',
391
+ value: 'true',
392
+ label: 'True',
393
+ },
394
+ {
395
+ id: 'false',
396
+ value: 'false',
397
+ label: 'False',
398
+ },
399
+ ],
400
+ variable_type: 'boolean',
401
+ },
402
+ 'chat.group_description': {
403
+ text: 'Group Description',
404
+ type: 'string',
405
+ filters: ['CONTAINS', 'NCONTAINS', 'EQ', 'NEQ'],
406
+ placeholder: 'e.g. Group description',
407
+ variable_type: 'string',
408
+ },
409
+ 'chat.custom_properties': {
410
+ text: 'Chat Custom Properties',
411
+ type: 'dropdown',
412
+ value: 'org.custom_properties',
413
+ filters: ['EQ', 'NEQ'],
414
+ hidden: true,
415
+ variable_type: 'string',
416
+ },
417
+ 'chat.created_at': {
418
+ text: 'Chat Created At',
419
+ type: 'day-time',
420
+ filters: ['LT', 'LTE', 'GT', 'GTE', 'ON'],
421
+ variable_type: 'day-time',
422
+ },
423
+ };
424
+ exports.TicketVariableNameMap = {
425
+ 'ticket.subject': {
426
+ text: 'Ticket Subject',
427
+ type: 'string',
428
+ filters: ['CONTAINS', 'NCONTAINS', 'EQ', 'NEQ'],
429
+ placeholder: 'e.g. Test ticket',
430
+ variable_type: 'string',
431
+ },
432
+ 'ticket.status': {
433
+ text: 'Ticket Status',
434
+ type: 'dropdown',
435
+ value: [
436
+ { id: 'open', value: 'open', label: 'Open' },
437
+ { id: 'closed', value: 'closed', label: 'Closed' },
438
+ { id: 'inprogress', value: 'inprogress', label: 'In progress' },
439
+ ],
440
+ filters: ['EQ', 'NEQ'],
441
+ variable_type: 'string',
442
+ },
443
+ 'ticket.priority': {
444
+ text: 'Ticket Priority',
445
+ type: 'dropdown',
446
+ value: [
447
+ { id: '0', value: '0', label: 'No Prioriy' },
448
+ { id: '1', value: '1', label: 'Low' },
449
+ { id: '2', value: '2', label: 'Medium' },
450
+ { id: '3', value: '3', label: 'High' },
451
+ { id: '4', value: '4', label: 'Urgent' },
452
+ ],
453
+ filters: ['EQ', 'NEQ'],
454
+ variable_type: 'string',
455
+ },
456
+ 'ticket.assignee': {
457
+ text: 'Ticket Assignee',
458
+ type: 'dropdown',
459
+ value: 'org.members',
460
+ filters: ['EQ', 'NEQ', 'KNOWN', 'NKNOWN'],
461
+ variable_type: 'string',
462
+ },
463
+ 'ticket.labels': {
464
+ text: 'Ticket Labels',
465
+ type: 'dropdown',
466
+ value: 'org.labels',
467
+ filters: ['CONTAINS', 'NCONTAINS'],
468
+ variable_type: 'string',
469
+ },
470
+ 'ticket.is_deleted': {
471
+ text: 'Ticket is deleted',
472
+ type: 'boolean',
473
+ value: [
474
+ {
475
+ id: 'true',
476
+ value: 'true',
477
+ label: 'True',
478
+ },
479
+ {
480
+ id: 'false',
481
+ value: 'false',
482
+ label: 'False',
483
+ },
484
+ ],
485
+ filters: ['IS'],
486
+ variable_type: 'boolean',
487
+ },
488
+ 'ticket.raised_by': {
489
+ text: 'Ticket Raised By',
490
+ type: 'dropdown',
491
+ value: 'org.members',
492
+ filters: ['EQ', 'NEQ'],
493
+ variable_type: 'string',
494
+ },
495
+ 'ticket.due_date': {
496
+ text: 'Ticket Due Date',
497
+ type: 'date',
498
+ filters: ['KNOWN', 'NKNOWN'],
499
+ variable_type: 'date',
500
+ hidden: true,
501
+ },
502
+ 'ticket.ticket_id': {
503
+ text: 'Ticket ID',
504
+ type: 'string',
505
+ filters: ['EQ', 'NEQ'],
506
+ hidden: true,
507
+ variable_type: 'string',
508
+ },
509
+ 'ticket.org_id': {
510
+ text: 'Org ID',
511
+ type: 'string',
512
+ filters: ['EQ', 'NEQ'],
513
+ hidden: true,
514
+ variable_type: 'string',
515
+ },
516
+ 'ticket.custom_properties': {
517
+ text: 'Ticket Custom Properties',
518
+ type: 'dropdown',
519
+ value: 'org.custom_properties',
520
+ filters: ['EQ', 'NEQ'],
521
+ hidden: true,
522
+ variable_type: 'string',
523
+ },
524
+ 'ticket.created_at': {
525
+ text: 'Ticket Created At',
526
+ type: 'day-time',
527
+ filters: ['LT', 'LTE', 'GT', 'GTE', 'ON'],
528
+ variable_type: 'day-time',
529
+ },
530
+ 'ticket.chat_id': {
531
+ text: 'Chat ID',
532
+ type: 'string',
533
+ filters: ['EQ', 'NEQ'],
534
+ hidden: true,
535
+ variable_type: 'string',
536
+ },
537
+ };
538
+ exports.ReactionVariableNameMap = {
539
+ 'reaction.reaction': {
540
+ text: 'Reaction',
541
+ type: 'string',
542
+ filters: ['EQ', 'NEQ'],
543
+ placeholder: 'e.g. 👍',
544
+ variable_type: 'string',
545
+ },
546
+ 'reaction.sender_id': {
547
+ text: 'Reaction Sender Phone',
548
+ type: 'string',
549
+ filters: ['EQ', 'NEQ'],
550
+ placeholder: 'e.g. 919876543210',
551
+ variable_type: 'string',
552
+ },
553
+ 'reaction.message_id': {
554
+ text: 'Reaction Message ID',
555
+ type: 'string',
556
+ filters: ['EQ', 'NEQ'],
557
+ hidden: true,
558
+ variable_type: 'string',
559
+ },
560
+ 'reaction.chat_id': {
561
+ text: 'Chat ID',
562
+ type: 'string',
563
+ filters: ['EQ', 'NEQ'],
564
+ hidden: true,
565
+ variable_type: 'string',
566
+ },
567
+ 'reaction.reaction_id': {
568
+ text: 'Reaction ID',
569
+ type: 'string',
570
+ filters: ['EQ', 'NEQ'],
571
+ hidden: true,
572
+ variable_type: 'string',
573
+ },
574
+ };
575
+ var FilterConditionMap;
576
+ (function (FilterConditionMap) {
577
+ FilterConditionMap["CONTAINS"] = "contains";
578
+ FilterConditionMap["NCONTAINS"] = "does not contain";
579
+ FilterConditionMap["EQ"] = "=";
580
+ FilterConditionMap["NEQ"] = "<>";
581
+ FilterConditionMap["LT"] = "<";
582
+ FilterConditionMap["LTE"] = "<=";
583
+ FilterConditionMap["GT"] = ">";
584
+ FilterConditionMap["GTE"] = ">=";
585
+ FilterConditionMap["KNOWN"] = "is known";
586
+ FilterConditionMap["NKNOWN"] = "is not known";
587
+ FilterConditionMap["IS"] = "=";
588
+ FilterConditionMap["NIS"] = "<>";
589
+ FilterConditionMap["ON"] = "on";
590
+ })(FilterConditionMap || (exports.FilterConditionMap = FilterConditionMap = {}));
591
+ const isSendMessageAction = (action) => {
592
+ return action.type === 'send_message';
593
+ };
594
+ exports.isSendMessageAction = isSendMessageAction;
595
+ exports.RuleNameMap = {
596
+ 'message.created': {
597
+ title: 'New Message Received',
598
+ description: 'When a new message is received from an external contact',
599
+ base_conditions: {
600
+ org_phone: true,
601
+ },
602
+ },
603
+ 'chat.created': {
604
+ title: 'New Chat Created',
605
+ description: 'When a new chat is created',
606
+ base_conditions: {
607
+ org_phone: true,
608
+ },
609
+ },
610
+ 'ticket.created': {
611
+ title: 'New Ticket Created',
612
+ description: 'When a new ticket is created',
613
+ base_conditions: {
614
+ org_phone: false,
615
+ },
616
+ },
617
+ 'reaction.added': {
618
+ title: 'New Reaction Added',
619
+ description: 'When a reaction is added on a message',
620
+ base_conditions: {
621
+ org_phone: true,
622
+ },
623
+ },
624
+ 'message.updated': {
625
+ title: 'Message Updated',
626
+ description: 'When a message is updated',
627
+ base_conditions: {
628
+ org_phone: true,
629
+ },
630
+ },
631
+ 'ticket.updated': {
632
+ title: 'Ticket Updated',
633
+ description: 'When a ticket is updated',
634
+ base_conditions: {
635
+ org_phone: false,
636
+ },
637
+ },
638
+ 'chat.label.updated': {
639
+ title: 'Chat Label Added/Removed',
640
+ description: 'When labels on chats are updated',
641
+ base_conditions: {
642
+ org_phone: false,
643
+ },
644
+ },
645
+ 'message.flagged': {
646
+ title: 'Message Flagged',
647
+ description: 'When a message is flagged',
648
+ base_conditions: {
649
+ org_phone: true,
650
+ },
651
+ },
652
+ };
653
+ exports.ActionNameMap = {
654
+ send_message: {
655
+ title: 'Send Message',
656
+ description: 'Send a message',
657
+ inputs: {
658
+ message: {
659
+ id: 'message',
660
+ type: 'editor',
661
+ label: 'Message',
662
+ placeholder: 'Enter message',
663
+ value: null,
664
+ required: true,
665
+ },
666
+ media: {
667
+ id: 'media',
668
+ type: 'file',
669
+ label: 'Media',
670
+ placeholder: 'Upload media',
671
+ value: null,
672
+ required: false,
673
+ },
674
+ maintain_flag_status: {
675
+ id: 'maintain_flag_status',
676
+ type: 'dropdown',
677
+ label: 'Maintain Flag Status',
678
+ placeholder: 'Select...',
679
+ value: [
680
+ { id: 'true', value: 'true', label: 'True' },
681
+ { id: 'false', value: 'false', label: 'False' },
682
+ ],
683
+ required: true,
684
+ },
685
+ },
686
+ validTriggers: [
687
+ 'message.created',
688
+ 'message.updated',
689
+ 'chat.created',
690
+ 'ticket.updated',
691
+ 'ticket.created',
692
+ 'reaction.added',
693
+ 'message.flagged',
694
+ 'chat.label.updated',
695
+ ],
696
+ },
697
+ reply_to_message: {
698
+ title: 'Reply to message',
699
+ description: 'Send a message with the quoted message',
700
+ inputs: {
701
+ message: {
702
+ id: 'message',
703
+ type: 'editor',
704
+ label: 'Message',
705
+ placeholder: 'Enter message',
706
+ value: null,
707
+ required: true,
708
+ },
709
+ media: {
710
+ id: 'media',
711
+ type: 'file',
712
+ label: 'Media',
713
+ placeholder: 'Upload media',
714
+ value: null,
715
+ required: false,
716
+ },
717
+ maintain_flag_status: {
718
+ id: 'maintain_flag_status',
719
+ type: 'dropdown',
720
+ label: 'Maintain Flag Status',
721
+ placeholder: 'Select...',
722
+ value: [
723
+ { id: 'true', value: 'true', label: 'True' },
724
+ { id: 'false', value: 'false', label: 'False' },
725
+ ],
726
+ required: true,
727
+ },
728
+ },
729
+ validTriggers: [
730
+ 'message.created',
731
+ 'message.updated',
732
+ 'reaction.added',
733
+ 'message.flagged',
734
+ ],
735
+ },
736
+ notify_http: {
737
+ title: 'Notify HTTP',
738
+ description: 'Notify an HTTP endpoint',
739
+ inputs: {
740
+ url: {
741
+ id: 'url',
742
+ type: 'text',
743
+ label: 'URL',
744
+ placeholder: 'Enter URL',
745
+ value: null,
746
+ required: true,
747
+ },
748
+ },
749
+ validTriggers: [
750
+ 'message.created',
751
+ 'message.updated',
752
+ 'chat.created',
753
+ 'ticket.updated',
754
+ 'ticket.created',
755
+ 'reaction.added',
756
+ 'message.flagged',
757
+ 'chat.label.updated',
758
+ ],
759
+ },
760
+ create_ticket: {
761
+ title: 'Create Ticket',
762
+ description: 'Create a ticket',
763
+ inputs: {
764
+ assignee: {
765
+ id: 'assignee',
766
+ type: 'dropdown',
767
+ value: 'org.members',
768
+ label: 'Assignee',
769
+ placeholder: 'Select assignee',
770
+ required: false,
771
+ },
772
+ priority: {
773
+ id: 'priority',
774
+ type: 'dropdown',
775
+ value: [
776
+ { id: '0', value: '0', label: 'No Prioriy' },
777
+ { id: '1', value: '1', label: 'Low' },
778
+ { id: '2', value: '2', label: 'Medium' },
779
+ { id: '3', value: '3', label: 'High' },
780
+ { id: '4', value: '4', label: 'Urgent' },
781
+ ],
782
+ label: 'Priority',
783
+ placeholder: 'Select priority',
784
+ required: false,
785
+ },
786
+ label: {
787
+ id: 'label',
788
+ type: 'dropdown',
789
+ value: 'ticket.labels',
790
+ label: 'Label',
791
+ placeholder: 'Select label',
792
+ required: false,
793
+ },
794
+ },
795
+ validTriggers: [
796
+ 'message.created',
797
+ 'message.updated',
798
+ 'reaction.added',
799
+ 'message.flagged',
800
+ ],
801
+ },
802
+ flag_message: {
803
+ title: 'Update flag status',
804
+ description: 'Flag/Unflag a message',
805
+ inputs: {
806
+ flag: {
807
+ id: 'flag',
808
+ type: 'dropdown',
809
+ value: [
810
+ { id: 'flag', value: 'true', label: 'TRUE' },
811
+ { id: 'unflag', value: 'false', label: 'FALSE' },
812
+ ],
813
+ label: 'Flag status',
814
+ placeholder: 'Select flag',
815
+ required: true,
816
+ },
817
+ },
818
+ validTriggers: ['message.created', 'message.updated', 'reaction.added'],
819
+ },
820
+ assign_ticket: {
821
+ title: 'Assign Ticket',
822
+ description: 'Assign a ticket',
823
+ inputs: {
824
+ round_robin: {
825
+ id: 'round_robin',
826
+ type: 'dropdown',
827
+ value: [
828
+ { id: 'true', value: 'true', label: 'True' },
829
+ { id: 'false', value: 'false', label: 'False' },
830
+ ],
831
+ label: 'Enable Round Robin',
832
+ placeholder: 'Select...',
833
+ info: 'If enabled, the ticket will be assigned to the next available agent in the list',
834
+ required: false,
835
+ },
836
+ assignee: {
837
+ id: 'assignee',
838
+ type: 'dynamic',
839
+ value: 'org.members',
840
+ label: 'Assignee',
841
+ placeholder: 'Select assignee',
842
+ info: "If round robin is enabled, the ticket will be assigned to the next available agent in the list else it'll be assigned to the selected agent",
843
+ required: true,
844
+ },
845
+ },
846
+ validTriggers: ['ticket.updated', 'ticket.created'],
847
+ },
848
+ close_ticket: {
849
+ title: 'Close Ticket',
850
+ description: 'Close a ticket',
851
+ inputs: {
852
+ closing_note: {
853
+ id: 'closing_note',
854
+ type: 'textarea',
855
+ label: 'Closing Note',
856
+ placeholder: 'Enter closing note',
857
+ value: null,
858
+ required: false,
859
+ },
860
+ },
861
+ validTriggers: ['ticket.updated', 'ticket.created'],
862
+ },
863
+ add_chat_label: {
864
+ title: 'Add Chat Label',
865
+ description: 'Add a label to referred chat',
866
+ inputs: {
867
+ label: {
868
+ id: 'label',
869
+ type: 'dropdown',
870
+ value: 'chat.labels',
871
+ label: 'Label',
872
+ placeholder: 'Select label',
873
+ required: true,
874
+ },
875
+ },
876
+ validTriggers: [
877
+ 'message.created',
878
+ 'message.updated',
879
+ 'chat.created',
880
+ 'ticket.updated',
881
+ 'ticket.created',
882
+ 'reaction.added',
883
+ 'chat.label.updated',
884
+ ],
885
+ },
886
+ add_ticket_label: {
887
+ title: 'Add Ticket Label',
888
+ description: 'Add a label to referred ticket',
889
+ inputs: {
890
+ label: {
891
+ id: 'label',
892
+ type: 'dropdown',
893
+ value: 'ticket.labels',
894
+ label: 'Label',
895
+ placeholder: 'Select label',
896
+ required: true,
897
+ },
898
+ },
899
+ validTriggers: ['ticket.updated', 'ticket.created'],
900
+ },
901
+ update_custom_property: {
902
+ description: 'Update a chat custom property',
903
+ title: 'Update Chat Custom Property',
904
+ validTriggers: [
905
+ 'message.created',
906
+ 'message.updated',
907
+ 'chat.created',
908
+ 'ticket.updated',
909
+ 'ticket.created',
910
+ 'reaction.added',
911
+ 'message.flagged',
912
+ ],
913
+ inputs: {
914
+ property_id: {
915
+ id: 'property_id',
916
+ type: 'dropdown',
917
+ value: 'org.custom_properties',
918
+ label: 'Property',
919
+ placeholder: 'Select property',
920
+ required: true,
921
+ },
922
+ value: {
923
+ id: 'property_id',
924
+ type: 'dynamic',
925
+ label: 'Value',
926
+ placeholder: 'Enter value',
927
+ value: 'custom_property_values',
928
+ required: true,
929
+ },
930
+ },
931
+ },
932
+ assign_chat: {
933
+ title: 'Assign Chat',
934
+ description: 'Assign a chat',
935
+ inputs: {
936
+ round_robin: {
937
+ id: 'round_robin',
938
+ type: 'dropdown',
939
+ value: [
940
+ { id: 'true', value: 'true', label: 'True' },
941
+ { id: 'false', value: 'false', label: 'False' },
942
+ ],
943
+ label: 'Enable Round Robin',
944
+ placeholder: 'Select...',
945
+ info: 'If enabled, the chat will be assigned to the next available agent in the list',
946
+ required: false,
947
+ },
948
+ assignee: {
949
+ id: 'assignee',
950
+ type: 'dynamic',
951
+ value: 'org.members',
952
+ label: 'Assignee',
953
+ placeholder: 'Select assignee',
954
+ required: true,
955
+ },
956
+ },
957
+ validTriggers: [
958
+ 'message.created',
959
+ 'message.updated',
960
+ 'chat.created',
961
+ 'ticket.updated',
962
+ 'ticket.created',
963
+ 'reaction.added',
964
+ 'chat.label.updated',
965
+ ],
966
+ },
967
+ forward_message: {
968
+ title: 'Forward Message',
969
+ description: 'Forward a message',
970
+ inputs: {
971
+ chat_id: {
972
+ id: 'chat_id',
973
+ type: 'dropdown',
974
+ value: 'org.chats',
975
+ label: 'Chat',
976
+ placeholder: 'Select chat',
977
+ required: true,
978
+ },
979
+ },
980
+ validTriggers: [
981
+ 'message.created',
982
+ 'message.updated',
983
+ 'ticket.updated',
984
+ 'ticket.created',
985
+ 'reaction.added',
986
+ 'message.flagged',
987
+ ],
988
+ },
989
+ send_email: {
990
+ title: 'Send Email',
991
+ description: 'Send an email',
992
+ inputs: {
993
+ email: {
994
+ id: 'email',
995
+ type: 'text',
996
+ label: 'Email',
997
+ placeholder: 'Enter email',
998
+ value: null,
999
+ required: true,
1000
+ },
1001
+ subject: {
1002
+ id: 'subject',
1003
+ type: 'text',
1004
+ label: 'Subject',
1005
+ placeholder: 'Enter subject',
1006
+ value: null,
1007
+ required: true,
1008
+ },
1009
+ body: {
1010
+ id: 'body',
1011
+ type: 'editor',
1012
+ label: 'Body',
1013
+ placeholder: 'Enter body',
1014
+ value: null,
1015
+ required: true,
1016
+ },
1017
+ },
1018
+ validTriggers: [
1019
+ 'message.created',
1020
+ 'message.updated',
1021
+ 'chat.created',
1022
+ 'ticket.updated',
1023
+ 'ticket.created',
1024
+ 'reaction.added',
1025
+ 'message.flagged',
1026
+ 'chat.label.updated',
1027
+ ],
1028
+ },
1029
+ };
1030
+ exports.editorVariables = [
1031
+ {
1032
+ label: 'Message Body',
1033
+ value: 'message.body',
1034
+ validTriggers: [
1035
+ 'message.created',
1036
+ 'message.updated',
1037
+ 'reaction.added',
1038
+ 'message.flagged',
1039
+ ],
1040
+ },
1041
+ {
1042
+ label: 'Sender Name',
1043
+ value: 'sender.contact_name',
1044
+ validTriggers: [
1045
+ 'message.created',
1046
+ 'message.updated',
1047
+ 'reaction.added',
1048
+ 'message.flagged',
1049
+ ],
1050
+ },
1051
+ {
1052
+ label: 'Chat Name',
1053
+ value: 'chat.chat_name',
1054
+ validTriggers: [
1055
+ 'message.created',
1056
+ 'message.updated',
1057
+ 'reaction.added',
1058
+ 'message.flagged',
1059
+ 'chat.created',
1060
+ 'chat.label.updated',
1061
+ ],
1062
+ },
1063
+ {
1064
+ label: 'Ticket ID',
1065
+ value: 'ticket.ticket_id',
1066
+ validTriggers: ['ticket.updated', 'ticket.created'],
1067
+ },
1068
+ ];
1069
+ exports.variablesExclusionList = {
1070
+ 'ticket.created': ['ticket.is_deleted'],
1071
+ 'chat.created': ['chat.chat_id'],
1072
+ 'message.created': [
1073
+ 'message.author',
1074
+ 'message.performed_by',
1075
+ 'message.flag_status',
1076
+ 'sender.is_internal',
1077
+ ],
1078
+ 'ticket.updated': [],
1079
+ 'reaction.added': [],
1080
+ 'message.updated': [],
1081
+ 'message.flagged': [],
1082
+ 'chat.label.updated': [],
1083
+ };