getricky 0.1.40 → 0.1.42
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.
|
@@ -3296,6 +3296,134 @@ export type BusinessHours = {
|
|
|
3296
3296
|
*/
|
|
3297
3297
|
weekdays: Array<number>;
|
|
3298
3298
|
};
|
|
3299
|
+
/**
|
|
3300
|
+
* A yes-or-no question: a comparison of one field, or a group. Each trigger offers its own fields; a `decision` also reads `variable`.
|
|
3301
|
+
*/
|
|
3302
|
+
export type Condition = {
|
|
3303
|
+
kind: 'compare';
|
|
3304
|
+
field: 'assignee';
|
|
3305
|
+
/**
|
|
3306
|
+
* `is` holds for any of `values`; `is_not` for none.
|
|
3307
|
+
*/
|
|
3308
|
+
operator: 'is' | 'is_not';
|
|
3309
|
+
/**
|
|
3310
|
+
* Who has the conversation: a member, an agent or nobody.
|
|
3311
|
+
*/
|
|
3312
|
+
values: Array<{
|
|
3313
|
+
kind: 'person';
|
|
3314
|
+
/**
|
|
3315
|
+
* A member. See `GET /members`.
|
|
3316
|
+
*/
|
|
3317
|
+
user_id: string;
|
|
3318
|
+
} | {
|
|
3319
|
+
kind: 'agent';
|
|
3320
|
+
/**
|
|
3321
|
+
* An AI agent.
|
|
3322
|
+
*/
|
|
3323
|
+
agent_id: string;
|
|
3324
|
+
} | {
|
|
3325
|
+
kind: 'nobody';
|
|
3326
|
+
}>;
|
|
3327
|
+
} | {
|
|
3328
|
+
kind: 'compare';
|
|
3329
|
+
field: 'conversation_status';
|
|
3330
|
+
/**
|
|
3331
|
+
* `is` holds for any of `values`; `is_not` for none.
|
|
3332
|
+
*/
|
|
3333
|
+
operator: 'is' | 'is_not';
|
|
3334
|
+
/**
|
|
3335
|
+
* Open or closed.
|
|
3336
|
+
*/
|
|
3337
|
+
values: Array<'open' | 'closed'>;
|
|
3338
|
+
} | {
|
|
3339
|
+
kind: 'compare';
|
|
3340
|
+
field: 'ai';
|
|
3341
|
+
/**
|
|
3342
|
+
* `is` holds for any of `values`; `is_not` for none.
|
|
3343
|
+
*/
|
|
3344
|
+
operator: 'is' | 'is_not';
|
|
3345
|
+
/**
|
|
3346
|
+
* `on` while an AI agent answers the conversation, as its assignee or with the AI on in it.
|
|
3347
|
+
*/
|
|
3348
|
+
values: Array<'on' | 'off'>;
|
|
3349
|
+
} | {
|
|
3350
|
+
kind: 'compare';
|
|
3351
|
+
field: 'channel';
|
|
3352
|
+
/**
|
|
3353
|
+
* `is` holds for any of `values`; `is_not` for none.
|
|
3354
|
+
*/
|
|
3355
|
+
operator: 'is' | 'is_not';
|
|
3356
|
+
/**
|
|
3357
|
+
* Channels. See `GET /channels`.
|
|
3358
|
+
*/
|
|
3359
|
+
values: Array<string>;
|
|
3360
|
+
} | {
|
|
3361
|
+
kind: 'compare';
|
|
3362
|
+
field: 'time';
|
|
3363
|
+
/**
|
|
3364
|
+
* Whether the moment of evaluation is within the hours or outside them.
|
|
3365
|
+
*/
|
|
3366
|
+
operator: 'within' | 'outside';
|
|
3367
|
+
business_hours: BusinessHours;
|
|
3368
|
+
} | {
|
|
3369
|
+
kind: 'compare';
|
|
3370
|
+
field: 'message_first';
|
|
3371
|
+
/**
|
|
3372
|
+
* `is` when the contact wrote first in the conversation, before any message from the business.
|
|
3373
|
+
*/
|
|
3374
|
+
operator: 'is' | 'is_not';
|
|
3375
|
+
} | {
|
|
3376
|
+
kind: 'compare';
|
|
3377
|
+
field: 'message_type';
|
|
3378
|
+
/**
|
|
3379
|
+
* `is` holds for any of `values`; `is_not` for none.
|
|
3380
|
+
*/
|
|
3381
|
+
operator: 'is' | 'is_not';
|
|
3382
|
+
/**
|
|
3383
|
+
* The kind of message; `button` is a tapped button or list option on any channel.
|
|
3384
|
+
*/
|
|
3385
|
+
values: Array<'text' | 'button' | 'image' | 'audio' | 'video' | 'document' | 'location' | 'sticker' | 'other'>;
|
|
3386
|
+
} | {
|
|
3387
|
+
kind: 'compare';
|
|
3388
|
+
field: 'message_text';
|
|
3389
|
+
operator: 'contains' | 'not_contains';
|
|
3390
|
+
/**
|
|
3391
|
+
* Compared ignoring case, accents and repeated spaces.
|
|
3392
|
+
*/
|
|
3393
|
+
value: string;
|
|
3394
|
+
} | {
|
|
3395
|
+
kind: 'compare';
|
|
3396
|
+
field: 'message_sender';
|
|
3397
|
+
/**
|
|
3398
|
+
* `is` holds for any of `values`; `is_not` for none.
|
|
3399
|
+
*/
|
|
3400
|
+
operator: 'is' | 'is_not';
|
|
3401
|
+
/**
|
|
3402
|
+
* Who sent the message: `person` (the team), `ai` (an AI agent and its tools), `automation` (a workflow), `broadcast` or `external_app` (another app connected to the channel).
|
|
3403
|
+
*/
|
|
3404
|
+
values: Array<'person' | 'ai' | 'automation' | 'broadcast' | 'external_app'>;
|
|
3405
|
+
} | {
|
|
3406
|
+
kind: 'compare';
|
|
3407
|
+
field: 'variable';
|
|
3408
|
+
/**
|
|
3409
|
+
* The `answer_key` an earlier `ask_question` step saved.
|
|
3410
|
+
*/
|
|
3411
|
+
name: string;
|
|
3412
|
+
operator: 'is' | 'is_not' | 'contains' | 'not_contains' | 'exists' | 'not_exists';
|
|
3413
|
+
/**
|
|
3414
|
+
* Compared ignoring case and accents; absent for `exists` and `not_exists`.
|
|
3415
|
+
*/
|
|
3416
|
+
value?: string;
|
|
3417
|
+
} | {
|
|
3418
|
+
/**
|
|
3419
|
+
* `all` holds when every condition holds; `any` when at least one does.
|
|
3420
|
+
*/
|
|
3421
|
+
kind: 'all' | 'any';
|
|
3422
|
+
/**
|
|
3423
|
+
* Comparisons or groups, three levels deep at most.
|
|
3424
|
+
*/
|
|
3425
|
+
conditions: Array<Condition>;
|
|
3426
|
+
};
|
|
3299
3427
|
/**
|
|
3300
3428
|
* An automation Ricky runs for the organization.
|
|
3301
3429
|
*/
|
|
@@ -3318,61 +3446,39 @@ export type Workflow = {
|
|
|
3318
3446
|
type: 'conversation' | 'scheduled';
|
|
3319
3447
|
definition: {
|
|
3320
3448
|
/**
|
|
3321
|
-
* `conversation_opened` runs when a conversation opens; `first_message_received` when the contact writes first in a conversation, before any message from the business; `message_received` on every incoming message; `message_sent` within 15 minutes of an outgoing message
|
|
3322
|
-
*/
|
|
3323
|
-
trigger: 'assigned_to' | 'conversation_inactive' | 'conversation_opened' | 'first_message_received' | 'message_received' | 'message_sent' | 'team_message_unanswered' | 'call_received';
|
|
3324
|
-
/**
|
|
3325
|
-
* Channels it listens to. See `GET /channels`.
|
|
3326
|
-
*/
|
|
3327
|
-
channel_ids: Array<string>;
|
|
3328
|
-
/**
|
|
3329
|
-
* Seconds without activity before starting the flow: since the last team reply for team_message_unanswered, or the last message or reaction from either side for conversation_inactive.
|
|
3449
|
+
* The event that starts the workflow; `condition` decides whether that occurrence runs it. `conversation_opened` runs when a conversation opens; `first_message_received` when the contact writes first in a conversation, before any message from the business; `message_received` on every incoming message; `message_sent` within 15 minutes of an outgoing message, unless the contact replied first; `conversation_inactive` and `team_message_unanswered` after `inactivity_seconds`. `schedule` runs at each of its `schedule.times` on each conversation assigned then to a member its `condition` names with `assignee` `is`, which it requires. `conversation_assigned` runs when a conversation is assigned to a member; the assignment an AI handoff makes does not run it. Both take only `turn_on_ai`, `turn_off_ai`, `decision` and `end` steps, and only they take `turn_on_ai` and `turn_off_ai`. `call_received` decides who answers a WhatsApp call on the WhatsApp numbers with AI calls on that its `condition` names: its flow takes only `answer_call`, `decline_call` and `decision`s on `channel` and `time`, and the first active one that reaches a call step decides, over whoever holds the conversation.
|
|
3330
3450
|
*/
|
|
3331
|
-
|
|
3451
|
+
trigger: 'conversation_opened' | 'first_message_received' | 'message_received' | 'message_sent' | 'conversation_inactive' | 'team_message_unanswered' | 'schedule' | 'conversation_assigned' | 'call_received';
|
|
3332
3452
|
/**
|
|
3333
|
-
*
|
|
3453
|
+
* Whether an occurrence of the trigger runs the workflow; null runs every occurrence on every channel.
|
|
3334
3454
|
*/
|
|
3335
|
-
|
|
3336
|
-
/**
|
|
3337
|
-
* Match the contact writing first, before any message from the business, OR only_unassigned. Neither selected matches every message.
|
|
3338
|
-
*/
|
|
3339
|
-
first_message?: boolean;
|
|
3340
|
-
/**
|
|
3341
|
-
* Match while nobody has the conversation; OR first_message when selected.
|
|
3342
|
-
*/
|
|
3343
|
-
only_unassigned: boolean;
|
|
3344
|
-
/**
|
|
3345
|
-
* Not when the customer taps a button.
|
|
3346
|
-
*/
|
|
3347
|
-
skip_buttons: boolean;
|
|
3348
|
-
};
|
|
3455
|
+
condition: Condition | null;
|
|
3349
3456
|
/**
|
|
3350
|
-
*
|
|
3457
|
+
* When a `schedule` workflow runs; required for it and only for it.
|
|
3351
3458
|
*/
|
|
3352
|
-
|
|
3459
|
+
schedule?: {
|
|
3353
3460
|
/**
|
|
3354
|
-
*
|
|
3461
|
+
* IANA time zone of every time.
|
|
3355
3462
|
*/
|
|
3356
|
-
|
|
3463
|
+
timezone: string;
|
|
3357
3464
|
/**
|
|
3358
|
-
*
|
|
3465
|
+
* Each time and its days; each time of each day at most once.
|
|
3359
3466
|
*/
|
|
3360
|
-
|
|
3467
|
+
times: Array<{
|
|
3468
|
+
/**
|
|
3469
|
+
* Quarter hour it runs, `HH:MM`.
|
|
3470
|
+
*/
|
|
3471
|
+
time: string;
|
|
3472
|
+
/**
|
|
3473
|
+
* Days it runs at that time, 0 for Sunday to 6 for Saturday.
|
|
3474
|
+
*/
|
|
3475
|
+
weekdays: Array<number>;
|
|
3476
|
+
}>;
|
|
3361
3477
|
};
|
|
3362
3478
|
/**
|
|
3363
|
-
*
|
|
3364
|
-
*/
|
|
3365
|
-
assigned_user_ids?: Array<string>;
|
|
3366
|
-
/**
|
|
3367
|
-
* When it runs; null runs at any hour.
|
|
3479
|
+
* Seconds without activity before starting the flow: since the last team reply for team_message_unanswered, or the last message or reaction from either side for conversation_inactive.
|
|
3368
3480
|
*/
|
|
3369
|
-
|
|
3370
|
-
kind: 'inside_business_hours';
|
|
3371
|
-
business_hours: BusinessHours;
|
|
3372
|
-
} | {
|
|
3373
|
-
kind: 'outside_business_hours';
|
|
3374
|
-
business_hours: BusinessHours;
|
|
3375
|
-
} | null;
|
|
3481
|
+
inactivity_seconds?: number;
|
|
3376
3482
|
/**
|
|
3377
3483
|
* The steps and how they connect.
|
|
3378
3484
|
*/
|
|
@@ -3382,7 +3488,7 @@ export type Workflow = {
|
|
|
3382
3488
|
*/
|
|
3383
3489
|
entry: string;
|
|
3384
3490
|
/**
|
|
3385
|
-
* One step. `close_conversation`, `end`, `answer_call`, `decline_call` and `
|
|
3491
|
+
* One step. `close_conversation`, `end`, `answer_call`, `decline_call`, `turn_on_ai` and `turn_off_ai` finish the flow; every other step continues at its target.
|
|
3386
3492
|
*/
|
|
3387
3493
|
steps: Array<{
|
|
3388
3494
|
/**
|
|
@@ -3413,7 +3519,7 @@ export type Workflow = {
|
|
|
3413
3519
|
*/
|
|
3414
3520
|
text: string;
|
|
3415
3521
|
/**
|
|
3416
|
-
* Name the answer is kept under, for a later `
|
|
3522
|
+
* Name the answer is kept under, for a later `decision` to compare as a `variable`.
|
|
3417
3523
|
*/
|
|
3418
3524
|
answer_key: string;
|
|
3419
3525
|
/**
|
|
@@ -3450,31 +3556,29 @@ export type Workflow = {
|
|
|
3450
3556
|
* Step ID: letters, digits, `_` or `-`, up to 64.
|
|
3451
3557
|
*/
|
|
3452
3558
|
id: string;
|
|
3559
|
+
kind: 'decision';
|
|
3453
3560
|
/**
|
|
3454
|
-
*
|
|
3561
|
+
* Branches in the order they are checked; the first that holds is taken.
|
|
3455
3562
|
*/
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
* Holds while the business is open at the moment the step runs. Send it instead of `answer_key`, `operator` and `value`.
|
|
3472
|
-
*/
|
|
3473
|
-
business_hours?: BusinessHours;
|
|
3563
|
+
branches: Array<{
|
|
3564
|
+
/**
|
|
3565
|
+
* Step ID: letters, digits, `_` or `-`, up to 64.
|
|
3566
|
+
*/
|
|
3567
|
+
id: string;
|
|
3568
|
+
/**
|
|
3569
|
+
* Branch name, unique in the decision.
|
|
3570
|
+
*/
|
|
3571
|
+
name: string;
|
|
3572
|
+
condition: Condition;
|
|
3573
|
+
/**
|
|
3574
|
+
* Step to run when this branch is the first whose condition holds.
|
|
3575
|
+
*/
|
|
3576
|
+
next: string | null;
|
|
3577
|
+
}>;
|
|
3474
3578
|
/**
|
|
3475
|
-
* Step to run when
|
|
3579
|
+
* Step to run when no branch holds («Si no»); null ends the flow.
|
|
3476
3580
|
*/
|
|
3477
|
-
|
|
3581
|
+
next: string | null;
|
|
3478
3582
|
} | {
|
|
3479
3583
|
/**
|
|
3480
3584
|
* Step ID: letters, digits, `_` or `-`, up to 64.
|
|
@@ -3580,9 +3684,19 @@ export type Workflow = {
|
|
|
3580
3684
|
next: string | null;
|
|
3581
3685
|
kind: 'turn_on_ai';
|
|
3582
3686
|
/**
|
|
3583
|
-
*
|
|
3687
|
+
* Turns the AI on in the conversation with this AI agent; the conversation stays assigned to its member. If the contact wrote last, the agent answers at once. It turns off when a member writes in the conversation.
|
|
3584
3688
|
*/
|
|
3585
3689
|
agent_id: string;
|
|
3690
|
+
} | {
|
|
3691
|
+
/**
|
|
3692
|
+
* Step ID: letters, digits, `_` or `-`, up to 64.
|
|
3693
|
+
*/
|
|
3694
|
+
id: string;
|
|
3695
|
+
/**
|
|
3696
|
+
* Step to run next; null ends the flow.
|
|
3697
|
+
*/
|
|
3698
|
+
next: string | null;
|
|
3699
|
+
kind: 'turn_off_ai';
|
|
3586
3700
|
}>;
|
|
3587
3701
|
};
|
|
3588
3702
|
} | {
|
|
@@ -4971,6 +5085,134 @@ export type BusinessHoursInput = {
|
|
|
4971
5085
|
*/
|
|
4972
5086
|
weekdays?: Array<number>;
|
|
4973
5087
|
};
|
|
5088
|
+
/**
|
|
5089
|
+
* A yes-or-no question: a comparison of one field, or a group. Each trigger offers its own fields; a `decision` also reads `variable`.
|
|
5090
|
+
*/
|
|
5091
|
+
export type ConditionInput = {
|
|
5092
|
+
kind: 'compare';
|
|
5093
|
+
field: 'assignee';
|
|
5094
|
+
/**
|
|
5095
|
+
* `is` holds for any of `values`; `is_not` for none.
|
|
5096
|
+
*/
|
|
5097
|
+
operator: 'is' | 'is_not';
|
|
5098
|
+
/**
|
|
5099
|
+
* Who has the conversation: a member, an agent or nobody.
|
|
5100
|
+
*/
|
|
5101
|
+
values: Array<{
|
|
5102
|
+
kind: 'person';
|
|
5103
|
+
/**
|
|
5104
|
+
* A member. See `GET /members`.
|
|
5105
|
+
*/
|
|
5106
|
+
user_id: string;
|
|
5107
|
+
} | {
|
|
5108
|
+
kind: 'agent';
|
|
5109
|
+
/**
|
|
5110
|
+
* An AI agent.
|
|
5111
|
+
*/
|
|
5112
|
+
agent_id: string;
|
|
5113
|
+
} | {
|
|
5114
|
+
kind: 'nobody';
|
|
5115
|
+
}>;
|
|
5116
|
+
} | {
|
|
5117
|
+
kind: 'compare';
|
|
5118
|
+
field: 'conversation_status';
|
|
5119
|
+
/**
|
|
5120
|
+
* `is` holds for any of `values`; `is_not` for none.
|
|
5121
|
+
*/
|
|
5122
|
+
operator: 'is' | 'is_not';
|
|
5123
|
+
/**
|
|
5124
|
+
* Open or closed.
|
|
5125
|
+
*/
|
|
5126
|
+
values: Array<'open' | 'closed'>;
|
|
5127
|
+
} | {
|
|
5128
|
+
kind: 'compare';
|
|
5129
|
+
field: 'ai';
|
|
5130
|
+
/**
|
|
5131
|
+
* `is` holds for any of `values`; `is_not` for none.
|
|
5132
|
+
*/
|
|
5133
|
+
operator: 'is' | 'is_not';
|
|
5134
|
+
/**
|
|
5135
|
+
* `on` while an AI agent answers the conversation, as its assignee or with the AI on in it.
|
|
5136
|
+
*/
|
|
5137
|
+
values: Array<'on' | 'off'>;
|
|
5138
|
+
} | {
|
|
5139
|
+
kind: 'compare';
|
|
5140
|
+
field: 'channel';
|
|
5141
|
+
/**
|
|
5142
|
+
* `is` holds for any of `values`; `is_not` for none.
|
|
5143
|
+
*/
|
|
5144
|
+
operator: 'is' | 'is_not';
|
|
5145
|
+
/**
|
|
5146
|
+
* Channels. See `GET /channels`.
|
|
5147
|
+
*/
|
|
5148
|
+
values: Array<string>;
|
|
5149
|
+
} | {
|
|
5150
|
+
kind: 'compare';
|
|
5151
|
+
field: 'time';
|
|
5152
|
+
/**
|
|
5153
|
+
* Whether the moment of evaluation is within the hours or outside them.
|
|
5154
|
+
*/
|
|
5155
|
+
operator: 'within' | 'outside';
|
|
5156
|
+
business_hours: BusinessHoursInput;
|
|
5157
|
+
} | {
|
|
5158
|
+
kind: 'compare';
|
|
5159
|
+
field: 'message_first';
|
|
5160
|
+
/**
|
|
5161
|
+
* `is` when the contact wrote first in the conversation, before any message from the business.
|
|
5162
|
+
*/
|
|
5163
|
+
operator: 'is' | 'is_not';
|
|
5164
|
+
} | {
|
|
5165
|
+
kind: 'compare';
|
|
5166
|
+
field: 'message_type';
|
|
5167
|
+
/**
|
|
5168
|
+
* `is` holds for any of `values`; `is_not` for none.
|
|
5169
|
+
*/
|
|
5170
|
+
operator: 'is' | 'is_not';
|
|
5171
|
+
/**
|
|
5172
|
+
* The kind of message; `button` is a tapped button or list option on any channel.
|
|
5173
|
+
*/
|
|
5174
|
+
values: Array<'text' | 'button' | 'image' | 'audio' | 'video' | 'document' | 'location' | 'sticker' | 'other'>;
|
|
5175
|
+
} | {
|
|
5176
|
+
kind: 'compare';
|
|
5177
|
+
field: 'message_text';
|
|
5178
|
+
operator: 'contains' | 'not_contains';
|
|
5179
|
+
/**
|
|
5180
|
+
* Compared ignoring case, accents and repeated spaces.
|
|
5181
|
+
*/
|
|
5182
|
+
value: string;
|
|
5183
|
+
} | {
|
|
5184
|
+
kind: 'compare';
|
|
5185
|
+
field: 'message_sender';
|
|
5186
|
+
/**
|
|
5187
|
+
* `is` holds for any of `values`; `is_not` for none.
|
|
5188
|
+
*/
|
|
5189
|
+
operator: 'is' | 'is_not';
|
|
5190
|
+
/**
|
|
5191
|
+
* Who sent the message: `person` (the team), `ai` (an AI agent and its tools), `automation` (a workflow), `broadcast` or `external_app` (another app connected to the channel).
|
|
5192
|
+
*/
|
|
5193
|
+
values: Array<'person' | 'ai' | 'automation' | 'broadcast' | 'external_app'>;
|
|
5194
|
+
} | {
|
|
5195
|
+
kind: 'compare';
|
|
5196
|
+
field: 'variable';
|
|
5197
|
+
/**
|
|
5198
|
+
* The `answer_key` an earlier `ask_question` step saved.
|
|
5199
|
+
*/
|
|
5200
|
+
name: string;
|
|
5201
|
+
operator: 'is' | 'is_not' | 'contains' | 'not_contains' | 'exists' | 'not_exists';
|
|
5202
|
+
/**
|
|
5203
|
+
* Compared ignoring case and accents; absent for `exists` and `not_exists`.
|
|
5204
|
+
*/
|
|
5205
|
+
value?: string;
|
|
5206
|
+
} | {
|
|
5207
|
+
/**
|
|
5208
|
+
* `all` holds when every condition holds; `any` when at least one does.
|
|
5209
|
+
*/
|
|
5210
|
+
kind: 'all' | 'any';
|
|
5211
|
+
/**
|
|
5212
|
+
* Comparisons or groups, three levels deep at most.
|
|
5213
|
+
*/
|
|
5214
|
+
conditions: Array<ConditionInput>;
|
|
5215
|
+
};
|
|
4974
5216
|
/**
|
|
4975
5217
|
* Creates a conversation workflow as a `draft`. Activating it is a separate call.
|
|
4976
5218
|
*/
|
|
@@ -4980,23 +5222,55 @@ export type CreateWorkflow = {
|
|
|
4980
5222
|
*/
|
|
4981
5223
|
name: string;
|
|
4982
5224
|
/**
|
|
4983
|
-
* Reacts to a conversation with messages, questions, waits and assignments.
|
|
5225
|
+
* Reacts to a conversation with messages, questions, decisions, waits and assignments.
|
|
4984
5226
|
*/
|
|
4985
5227
|
definition: {
|
|
4986
5228
|
/**
|
|
4987
|
-
* `conversation_opened` runs when a conversation opens; `first_message_received` when the contact writes first in a conversation, before any message from the business; `message_received` on every incoming message; `message_sent` within 15 minutes of an outgoing message
|
|
5229
|
+
* The event that starts the workflow; `condition` decides whether that occurrence runs it. `conversation_opened` runs when a conversation opens; `first_message_received` when the contact writes first in a conversation, before any message from the business; `message_received` on every incoming message; `message_sent` within 15 minutes of an outgoing message, unless the contact replied first; `conversation_inactive` and `team_message_unanswered` after `inactivity_seconds`. `schedule` runs at each of its `schedule.times` on each conversation assigned then to a member its `condition` names with `assignee` `is`, which it requires. `conversation_assigned` runs when a conversation is assigned to a member; the assignment an AI handoff makes does not run it. Both take only `turn_on_ai`, `turn_off_ai`, `decision` and `end` steps, and only they take `turn_on_ai` and `turn_off_ai`. `call_received` decides who answers a WhatsApp call on the WhatsApp numbers with AI calls on that its `condition` names: its flow takes only `answer_call`, `decline_call` and `decision`s on `channel` and `time`, and the first active one that reaches a call step decides, over whoever holds the conversation. `at_time` is deprecated: read as `schedule`.
|
|
4988
5230
|
*/
|
|
4989
|
-
trigger: '
|
|
5231
|
+
trigger: 'conversation_opened' | 'first_message_received' | 'message_received' | 'message_sent' | 'conversation_inactive' | 'team_message_unanswered' | 'schedule' | 'conversation_assigned' | 'call_received' | 'at_time';
|
|
4990
5232
|
/**
|
|
4991
|
-
*
|
|
5233
|
+
* Whether an occurrence of the trigger runs the workflow; null runs every occurrence on every channel.
|
|
4992
5234
|
*/
|
|
4993
|
-
|
|
5235
|
+
condition: ConditionInput | {
|
|
5236
|
+
kind: 'inside_business_hours';
|
|
5237
|
+
business_hours: BusinessHoursInput;
|
|
5238
|
+
} | {
|
|
5239
|
+
kind: 'outside_business_hours';
|
|
5240
|
+
business_hours: BusinessHoursInput;
|
|
5241
|
+
} | null;
|
|
5242
|
+
/**
|
|
5243
|
+
* When a `schedule` workflow runs; required for it and only for it.
|
|
5244
|
+
*/
|
|
5245
|
+
schedule?: {
|
|
5246
|
+
/**
|
|
5247
|
+
* IANA time zone of every time.
|
|
5248
|
+
*/
|
|
5249
|
+
timezone: string;
|
|
5250
|
+
/**
|
|
5251
|
+
* Each time and its days; each time of each day at most once.
|
|
5252
|
+
*/
|
|
5253
|
+
times: Array<{
|
|
5254
|
+
/**
|
|
5255
|
+
* Quarter hour it runs, `HH:MM`.
|
|
5256
|
+
*/
|
|
5257
|
+
time: string;
|
|
5258
|
+
/**
|
|
5259
|
+
* Days it runs at that time, 0 for Sunday to 6 for Saturday.
|
|
5260
|
+
*/
|
|
5261
|
+
weekdays: Array<number>;
|
|
5262
|
+
}>;
|
|
5263
|
+
};
|
|
4994
5264
|
/**
|
|
4995
5265
|
* Seconds without activity before starting the flow: since the last team reply for team_message_unanswered, or the last message or reaction from either side for conversation_inactive.
|
|
4996
5266
|
*/
|
|
4997
5267
|
inactivity_seconds?: number;
|
|
4998
5268
|
/**
|
|
4999
|
-
*
|
|
5269
|
+
* Deprecated: read as a `channel` comparison in `condition`.
|
|
5270
|
+
*/
|
|
5271
|
+
channel_ids?: Array<string>;
|
|
5272
|
+
/**
|
|
5273
|
+
* Deprecated, requests only: read as `condition` comparisons on `message_first`, `assignee` (nobody) and `message_type` (not `button`).
|
|
5000
5274
|
*/
|
|
5001
5275
|
message_filters?: {
|
|
5002
5276
|
/**
|
|
@@ -5013,7 +5287,7 @@ export type CreateWorkflow = {
|
|
|
5013
5287
|
skip_buttons: boolean;
|
|
5014
5288
|
};
|
|
5015
5289
|
/**
|
|
5016
|
-
*
|
|
5290
|
+
* Deprecated, requests only: read as `condition` comparisons on `message_sender` and `message_text`.
|
|
5017
5291
|
*/
|
|
5018
5292
|
sent_message_filters?: {
|
|
5019
5293
|
/**
|
|
@@ -5026,19 +5300,35 @@ export type CreateWorkflow = {
|
|
|
5026
5300
|
text_contains?: string;
|
|
5027
5301
|
};
|
|
5028
5302
|
/**
|
|
5029
|
-
*
|
|
5303
|
+
* Deprecated, requests only: an `at_time` workflow is read as `schedule` with this one time.
|
|
5030
5304
|
*/
|
|
5031
|
-
|
|
5305
|
+
at_time?: {
|
|
5306
|
+
/**
|
|
5307
|
+
* Quarter hour it runs, `HH:MM`.
|
|
5308
|
+
*/
|
|
5309
|
+
time: string;
|
|
5310
|
+
/**
|
|
5311
|
+
* IANA time zone of `time` and `weekdays`.
|
|
5312
|
+
*/
|
|
5313
|
+
timezone: string;
|
|
5314
|
+
/**
|
|
5315
|
+
* Days it runs, 0 for Sunday to 6 for Saturday. Each at most once.
|
|
5316
|
+
*/
|
|
5317
|
+
weekdays: Array<number>;
|
|
5318
|
+
};
|
|
5032
5319
|
/**
|
|
5033
|
-
*
|
|
5320
|
+
* Deprecated, requests only: read as `condition` comparisons on `assignee` and `conversation_status`.
|
|
5034
5321
|
*/
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5322
|
+
conversation_filters?: {
|
|
5323
|
+
/**
|
|
5324
|
+
* Members the conversation is assigned to. Required for `at_time`; omitted on `conversation_assigned`, any member. See `GET /members`.
|
|
5325
|
+
*/
|
|
5326
|
+
assigned_user_ids?: Array<string>;
|
|
5327
|
+
/**
|
|
5328
|
+
* Only open conversations.
|
|
5329
|
+
*/
|
|
5330
|
+
only_open: boolean;
|
|
5331
|
+
};
|
|
5042
5332
|
/**
|
|
5043
5333
|
* The steps and how they connect.
|
|
5044
5334
|
*/
|
|
@@ -5048,7 +5338,7 @@ export type CreateWorkflow = {
|
|
|
5048
5338
|
*/
|
|
5049
5339
|
entry: string;
|
|
5050
5340
|
/**
|
|
5051
|
-
* One step. `close_conversation`, `end`, `answer_call`, `decline_call` and `
|
|
5341
|
+
* One step. `close_conversation`, `end`, `answer_call`, `decline_call`, `turn_on_ai` and `turn_off_ai` finish the flow; every other step continues at its target.
|
|
5052
5342
|
*/
|
|
5053
5343
|
steps: Array<{
|
|
5054
5344
|
/**
|
|
@@ -5079,7 +5369,7 @@ export type CreateWorkflow = {
|
|
|
5079
5369
|
*/
|
|
5080
5370
|
text: string;
|
|
5081
5371
|
/**
|
|
5082
|
-
* Name the answer is kept under, for a later `
|
|
5372
|
+
* Name the answer is kept under, for a later `decision` to compare as a `variable`.
|
|
5083
5373
|
*/
|
|
5084
5374
|
answer_key: string;
|
|
5085
5375
|
/**
|
|
@@ -5111,6 +5401,34 @@ export type CreateWorkflow = {
|
|
|
5111
5401
|
* Step to run when the answer matches no option.
|
|
5112
5402
|
*/
|
|
5113
5403
|
on_invalid: string | null;
|
|
5404
|
+
} | {
|
|
5405
|
+
/**
|
|
5406
|
+
* Step ID: letters, digits, `_` or `-`, up to 64.
|
|
5407
|
+
*/
|
|
5408
|
+
id: string;
|
|
5409
|
+
kind: 'decision';
|
|
5410
|
+
/**
|
|
5411
|
+
* Branches in the order they are checked; the first that holds is taken.
|
|
5412
|
+
*/
|
|
5413
|
+
branches: Array<{
|
|
5414
|
+
/**
|
|
5415
|
+
* Step ID: letters, digits, `_` or `-`, up to 64.
|
|
5416
|
+
*/
|
|
5417
|
+
id: string;
|
|
5418
|
+
/**
|
|
5419
|
+
* Branch name, unique in the decision.
|
|
5420
|
+
*/
|
|
5421
|
+
name: string;
|
|
5422
|
+
condition: ConditionInput;
|
|
5423
|
+
/**
|
|
5424
|
+
* Step to run when this branch is the first whose condition holds.
|
|
5425
|
+
*/
|
|
5426
|
+
next: string | null;
|
|
5427
|
+
}>;
|
|
5428
|
+
/**
|
|
5429
|
+
* Step to run when no branch holds («Si no»); null ends the flow.
|
|
5430
|
+
*/
|
|
5431
|
+
next: string | null;
|
|
5114
5432
|
} | {
|
|
5115
5433
|
/**
|
|
5116
5434
|
* Step ID: letters, digits, `_` or `-`, up to 64.
|
|
@@ -5122,7 +5440,7 @@ export type CreateWorkflow = {
|
|
|
5122
5440
|
next: string | null;
|
|
5123
5441
|
kind: 'branch';
|
|
5124
5442
|
/**
|
|
5125
|
-
* Name the answer is kept under, for a later `
|
|
5443
|
+
* Name the answer is kept under, for a later `decision` to compare as a `variable`.
|
|
5126
5444
|
*/
|
|
5127
5445
|
answer_key?: string;
|
|
5128
5446
|
/**
|
|
@@ -5246,9 +5564,19 @@ export type CreateWorkflow = {
|
|
|
5246
5564
|
next: string | null;
|
|
5247
5565
|
kind: 'turn_on_ai';
|
|
5248
5566
|
/**
|
|
5249
|
-
*
|
|
5567
|
+
* Turns the AI on in the conversation with this AI agent; the conversation stays assigned to its member. If the contact wrote last, the agent answers at once. It turns off when a member writes in the conversation.
|
|
5250
5568
|
*/
|
|
5251
5569
|
agent_id: string;
|
|
5570
|
+
} | {
|
|
5571
|
+
/**
|
|
5572
|
+
* Step ID: letters, digits, `_` or `-`, up to 64.
|
|
5573
|
+
*/
|
|
5574
|
+
id: string;
|
|
5575
|
+
/**
|
|
5576
|
+
* Step to run next; null ends the flow.
|
|
5577
|
+
*/
|
|
5578
|
+
next: string | null;
|
|
5579
|
+
kind: 'turn_off_ai';
|
|
5252
5580
|
}>;
|
|
5253
5581
|
};
|
|
5254
5582
|
};
|
|
@@ -5266,19 +5594,51 @@ export type UpdateWorkflow = {
|
|
|
5266
5594
|
*/
|
|
5267
5595
|
definition?: {
|
|
5268
5596
|
/**
|
|
5269
|
-
* `conversation_opened` runs when a conversation opens; `first_message_received` when the contact writes first in a conversation, before any message from the business; `message_received` on every incoming message; `message_sent` within 15 minutes of an outgoing message
|
|
5597
|
+
* The event that starts the workflow; `condition` decides whether that occurrence runs it. `conversation_opened` runs when a conversation opens; `first_message_received` when the contact writes first in a conversation, before any message from the business; `message_received` on every incoming message; `message_sent` within 15 minutes of an outgoing message, unless the contact replied first; `conversation_inactive` and `team_message_unanswered` after `inactivity_seconds`. `schedule` runs at each of its `schedule.times` on each conversation assigned then to a member its `condition` names with `assignee` `is`, which it requires. `conversation_assigned` runs when a conversation is assigned to a member; the assignment an AI handoff makes does not run it. Both take only `turn_on_ai`, `turn_off_ai`, `decision` and `end` steps, and only they take `turn_on_ai` and `turn_off_ai`. `call_received` decides who answers a WhatsApp call on the WhatsApp numbers with AI calls on that its `condition` names: its flow takes only `answer_call`, `decline_call` and `decision`s on `channel` and `time`, and the first active one that reaches a call step decides, over whoever holds the conversation. `at_time` is deprecated: read as `schedule`.
|
|
5270
5598
|
*/
|
|
5271
|
-
trigger: '
|
|
5599
|
+
trigger: 'conversation_opened' | 'first_message_received' | 'message_received' | 'message_sent' | 'conversation_inactive' | 'team_message_unanswered' | 'schedule' | 'conversation_assigned' | 'call_received' | 'at_time';
|
|
5272
5600
|
/**
|
|
5273
|
-
*
|
|
5601
|
+
* Whether an occurrence of the trigger runs the workflow; null runs every occurrence on every channel.
|
|
5274
5602
|
*/
|
|
5275
|
-
|
|
5603
|
+
condition: ConditionInput | {
|
|
5604
|
+
kind: 'inside_business_hours';
|
|
5605
|
+
business_hours: BusinessHoursInput;
|
|
5606
|
+
} | {
|
|
5607
|
+
kind: 'outside_business_hours';
|
|
5608
|
+
business_hours: BusinessHoursInput;
|
|
5609
|
+
} | null;
|
|
5610
|
+
/**
|
|
5611
|
+
* When a `schedule` workflow runs; required for it and only for it.
|
|
5612
|
+
*/
|
|
5613
|
+
schedule?: {
|
|
5614
|
+
/**
|
|
5615
|
+
* IANA time zone of every time.
|
|
5616
|
+
*/
|
|
5617
|
+
timezone: string;
|
|
5618
|
+
/**
|
|
5619
|
+
* Each time and its days; each time of each day at most once.
|
|
5620
|
+
*/
|
|
5621
|
+
times: Array<{
|
|
5622
|
+
/**
|
|
5623
|
+
* Quarter hour it runs, `HH:MM`.
|
|
5624
|
+
*/
|
|
5625
|
+
time: string;
|
|
5626
|
+
/**
|
|
5627
|
+
* Days it runs at that time, 0 for Sunday to 6 for Saturday.
|
|
5628
|
+
*/
|
|
5629
|
+
weekdays: Array<number>;
|
|
5630
|
+
}>;
|
|
5631
|
+
};
|
|
5276
5632
|
/**
|
|
5277
5633
|
* Seconds without activity before starting the flow: since the last team reply for team_message_unanswered, or the last message or reaction from either side for conversation_inactive.
|
|
5278
5634
|
*/
|
|
5279
5635
|
inactivity_seconds?: number;
|
|
5280
5636
|
/**
|
|
5281
|
-
*
|
|
5637
|
+
* Deprecated: read as a `channel` comparison in `condition`.
|
|
5638
|
+
*/
|
|
5639
|
+
channel_ids?: Array<string>;
|
|
5640
|
+
/**
|
|
5641
|
+
* Deprecated, requests only: read as `condition` comparisons on `message_first`, `assignee` (nobody) and `message_type` (not `button`).
|
|
5282
5642
|
*/
|
|
5283
5643
|
message_filters?: {
|
|
5284
5644
|
/**
|
|
@@ -5295,7 +5655,7 @@ export type UpdateWorkflow = {
|
|
|
5295
5655
|
skip_buttons: boolean;
|
|
5296
5656
|
};
|
|
5297
5657
|
/**
|
|
5298
|
-
*
|
|
5658
|
+
* Deprecated, requests only: read as `condition` comparisons on `message_sender` and `message_text`.
|
|
5299
5659
|
*/
|
|
5300
5660
|
sent_message_filters?: {
|
|
5301
5661
|
/**
|
|
@@ -5308,19 +5668,35 @@ export type UpdateWorkflow = {
|
|
|
5308
5668
|
text_contains?: string;
|
|
5309
5669
|
};
|
|
5310
5670
|
/**
|
|
5311
|
-
*
|
|
5671
|
+
* Deprecated, requests only: an `at_time` workflow is read as `schedule` with this one time.
|
|
5312
5672
|
*/
|
|
5313
|
-
|
|
5673
|
+
at_time?: {
|
|
5674
|
+
/**
|
|
5675
|
+
* Quarter hour it runs, `HH:MM`.
|
|
5676
|
+
*/
|
|
5677
|
+
time: string;
|
|
5678
|
+
/**
|
|
5679
|
+
* IANA time zone of `time` and `weekdays`.
|
|
5680
|
+
*/
|
|
5681
|
+
timezone: string;
|
|
5682
|
+
/**
|
|
5683
|
+
* Days it runs, 0 for Sunday to 6 for Saturday. Each at most once.
|
|
5684
|
+
*/
|
|
5685
|
+
weekdays: Array<number>;
|
|
5686
|
+
};
|
|
5314
5687
|
/**
|
|
5315
|
-
*
|
|
5688
|
+
* Deprecated, requests only: read as `condition` comparisons on `assignee` and `conversation_status`.
|
|
5316
5689
|
*/
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5690
|
+
conversation_filters?: {
|
|
5691
|
+
/**
|
|
5692
|
+
* Members the conversation is assigned to. Required for `at_time`; omitted on `conversation_assigned`, any member. See `GET /members`.
|
|
5693
|
+
*/
|
|
5694
|
+
assigned_user_ids?: Array<string>;
|
|
5695
|
+
/**
|
|
5696
|
+
* Only open conversations.
|
|
5697
|
+
*/
|
|
5698
|
+
only_open: boolean;
|
|
5699
|
+
};
|
|
5324
5700
|
/**
|
|
5325
5701
|
* The steps and how they connect.
|
|
5326
5702
|
*/
|
|
@@ -5330,7 +5706,7 @@ export type UpdateWorkflow = {
|
|
|
5330
5706
|
*/
|
|
5331
5707
|
entry: string;
|
|
5332
5708
|
/**
|
|
5333
|
-
* One step. `close_conversation`, `end`, `answer_call`, `decline_call` and `
|
|
5709
|
+
* One step. `close_conversation`, `end`, `answer_call`, `decline_call`, `turn_on_ai` and `turn_off_ai` finish the flow; every other step continues at its target.
|
|
5334
5710
|
*/
|
|
5335
5711
|
steps: Array<{
|
|
5336
5712
|
/**
|
|
@@ -5361,7 +5737,7 @@ export type UpdateWorkflow = {
|
|
|
5361
5737
|
*/
|
|
5362
5738
|
text: string;
|
|
5363
5739
|
/**
|
|
5364
|
-
* Name the answer is kept under, for a later `
|
|
5740
|
+
* Name the answer is kept under, for a later `decision` to compare as a `variable`.
|
|
5365
5741
|
*/
|
|
5366
5742
|
answer_key: string;
|
|
5367
5743
|
/**
|
|
@@ -5393,6 +5769,34 @@ export type UpdateWorkflow = {
|
|
|
5393
5769
|
* Step to run when the answer matches no option.
|
|
5394
5770
|
*/
|
|
5395
5771
|
on_invalid: string | null;
|
|
5772
|
+
} | {
|
|
5773
|
+
/**
|
|
5774
|
+
* Step ID: letters, digits, `_` or `-`, up to 64.
|
|
5775
|
+
*/
|
|
5776
|
+
id: string;
|
|
5777
|
+
kind: 'decision';
|
|
5778
|
+
/**
|
|
5779
|
+
* Branches in the order they are checked; the first that holds is taken.
|
|
5780
|
+
*/
|
|
5781
|
+
branches: Array<{
|
|
5782
|
+
/**
|
|
5783
|
+
* Step ID: letters, digits, `_` or `-`, up to 64.
|
|
5784
|
+
*/
|
|
5785
|
+
id: string;
|
|
5786
|
+
/**
|
|
5787
|
+
* Branch name, unique in the decision.
|
|
5788
|
+
*/
|
|
5789
|
+
name: string;
|
|
5790
|
+
condition: ConditionInput;
|
|
5791
|
+
/**
|
|
5792
|
+
* Step to run when this branch is the first whose condition holds.
|
|
5793
|
+
*/
|
|
5794
|
+
next: string | null;
|
|
5795
|
+
}>;
|
|
5796
|
+
/**
|
|
5797
|
+
* Step to run when no branch holds («Si no»); null ends the flow.
|
|
5798
|
+
*/
|
|
5799
|
+
next: string | null;
|
|
5396
5800
|
} | {
|
|
5397
5801
|
/**
|
|
5398
5802
|
* Step ID: letters, digits, `_` or `-`, up to 64.
|
|
@@ -5404,7 +5808,7 @@ export type UpdateWorkflow = {
|
|
|
5404
5808
|
next: string | null;
|
|
5405
5809
|
kind: 'branch';
|
|
5406
5810
|
/**
|
|
5407
|
-
* Name the answer is kept under, for a later `
|
|
5811
|
+
* Name the answer is kept under, for a later `decision` to compare as a `variable`.
|
|
5408
5812
|
*/
|
|
5409
5813
|
answer_key?: string;
|
|
5410
5814
|
/**
|
|
@@ -5528,9 +5932,19 @@ export type UpdateWorkflow = {
|
|
|
5528
5932
|
next: string | null;
|
|
5529
5933
|
kind: 'turn_on_ai';
|
|
5530
5934
|
/**
|
|
5531
|
-
*
|
|
5935
|
+
* Turns the AI on in the conversation with this AI agent; the conversation stays assigned to its member. If the contact wrote last, the agent answers at once. It turns off when a member writes in the conversation.
|
|
5532
5936
|
*/
|
|
5533
5937
|
agent_id: string;
|
|
5938
|
+
} | {
|
|
5939
|
+
/**
|
|
5940
|
+
* Step ID: letters, digits, `_` or `-`, up to 64.
|
|
5941
|
+
*/
|
|
5942
|
+
id: string;
|
|
5943
|
+
/**
|
|
5944
|
+
* Step to run next; null ends the flow.
|
|
5945
|
+
*/
|
|
5946
|
+
next: string | null;
|
|
5947
|
+
kind: 'turn_off_ai';
|
|
5534
5948
|
}>;
|
|
5535
5949
|
};
|
|
5536
5950
|
};
|