@periskope/types 0.6.141 → 0.6.142

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