getricky 0.1.1 → 0.1.2

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.
@@ -600,6 +600,329 @@ export type WebhookTestResult = {
600
600
  */
601
601
  duration_ms: number;
602
602
  };
603
+ /**
604
+ * An automation Ricky runs for the organization.
605
+ */
606
+ export type Workflow = {
607
+ /**
608
+ * Workflow ID.
609
+ */
610
+ id: string;
611
+ /**
612
+ * Display name.
613
+ */
614
+ name: string;
615
+ /**
616
+ * `draft` until activated; `paused` runs nothing new; `active` runs.
617
+ */
618
+ status: 'draft' | 'active' | 'paused';
619
+ /**
620
+ * Which `definition` it has: a conversation flow or a daily template.
621
+ */
622
+ type: 'conversation' | 'scheduled';
623
+ definition: {
624
+ /**
625
+ * `conversation_opened` runs when a conversation opens; `first_message_received` when the first message from the contact in a conversation arrives.
626
+ */
627
+ trigger: 'conversation_opened' | 'first_message_received';
628
+ /**
629
+ * Channels it listens to. See `GET /channels`.
630
+ */
631
+ channel_ids: Array<string>;
632
+ /**
633
+ * When it runs; null runs at any hour.
634
+ */
635
+ condition: {
636
+ kind: 'inside_business_hours';
637
+ business_hours: {
638
+ /**
639
+ * Opening time, `HH:MM`.
640
+ */
641
+ start: string;
642
+ /**
643
+ * Closing time, `HH:MM`.
644
+ */
645
+ end: string;
646
+ /**
647
+ * IANA time zone, for example `America/Panama`.
648
+ */
649
+ timezone: string;
650
+ /**
651
+ * Open days, 0 for Sunday to 6 for Saturday.
652
+ */
653
+ weekdays: Array<number>;
654
+ };
655
+ } | {
656
+ kind: 'outside_business_hours';
657
+ business_hours: {
658
+ /**
659
+ * Opening time, `HH:MM`.
660
+ */
661
+ start: string;
662
+ /**
663
+ * Closing time, `HH:MM`.
664
+ */
665
+ end: string;
666
+ /**
667
+ * IANA time zone, for example `America/Panama`.
668
+ */
669
+ timezone: string;
670
+ /**
671
+ * Open days, 0 for Sunday to 6 for Saturday.
672
+ */
673
+ weekdays: Array<number>;
674
+ };
675
+ } | null;
676
+ /**
677
+ * The steps and how they connect.
678
+ */
679
+ flow: {
680
+ /**
681
+ * ID of the first step.
682
+ */
683
+ entry: string;
684
+ /**
685
+ * One step. `assign_user`, `assign_agent` and `close_conversation` end the flow after they run.
686
+ */
687
+ steps: Array<{
688
+ /**
689
+ * Step ID: letters, digits, `_` or `-`, up to 64.
690
+ */
691
+ id: string;
692
+ /**
693
+ * Step to run next; null ends the flow.
694
+ */
695
+ next: string | null;
696
+ kind: 'send_message';
697
+ /**
698
+ * Text sent to the contact.
699
+ */
700
+ text: string;
701
+ } | {
702
+ /**
703
+ * Step ID: letters, digits, `_` or `-`, up to 64.
704
+ */
705
+ id: string;
706
+ /**
707
+ * Step to run next; null ends the flow.
708
+ */
709
+ next: string | null;
710
+ kind: 'ask_question';
711
+ /**
712
+ * Text sent to the contact.
713
+ */
714
+ text: string;
715
+ /**
716
+ * Name the answer is kept under, for a later `branch`.
717
+ */
718
+ answer_key: string;
719
+ /**
720
+ * Buttons or list options, WhatsApp only. Empty for a free-text answer, which goes to `next`.
721
+ */
722
+ choices: Array<{
723
+ /**
724
+ * Step ID: letters, digits, `_` or `-`, up to 64.
725
+ */
726
+ id: string;
727
+ /**
728
+ * Button text, up to 20 characters.
729
+ */
730
+ label: string;
731
+ /**
732
+ * Step to run when the contact picks it.
733
+ */
734
+ next: string | null;
735
+ }>;
736
+ /**
737
+ * How long to wait for the answer, up to 7 days.
738
+ */
739
+ timeout_seconds: number;
740
+ /**
741
+ * Step to run when no answer arrives in time.
742
+ */
743
+ on_timeout: string | null;
744
+ /**
745
+ * Step to run when the answer matches no option.
746
+ */
747
+ on_invalid: string | null;
748
+ } | {
749
+ /**
750
+ * Step ID: letters, digits, `_` or `-`, up to 64.
751
+ */
752
+ id: string;
753
+ /**
754
+ * Step to run next; null ends the flow.
755
+ */
756
+ next: string | null;
757
+ kind: 'branch';
758
+ /**
759
+ * Name the answer is kept under, for a later `branch`.
760
+ */
761
+ answer_key: string;
762
+ operator: 'equals' | 'contains' | 'exists';
763
+ /**
764
+ * Value compared with the answer.
765
+ */
766
+ value: string;
767
+ /**
768
+ * Step to run when the condition does not hold; `next` when it does.
769
+ */
770
+ otherwise: string | null;
771
+ } | {
772
+ /**
773
+ * Step ID: letters, digits, `_` or `-`, up to 64.
774
+ */
775
+ id: string;
776
+ /**
777
+ * Step to run next; null ends the flow.
778
+ */
779
+ next: string | null;
780
+ kind: 'wait';
781
+ /**
782
+ * Delay, up to 7 days.
783
+ */
784
+ seconds: number;
785
+ } | {
786
+ /**
787
+ * Step ID: letters, digits, `_` or `-`, up to 64.
788
+ */
789
+ id: string;
790
+ /**
791
+ * Step to run next; null ends the flow.
792
+ */
793
+ next: string | null;
794
+ kind: 'assign_user';
795
+ /**
796
+ * Member who takes the conversation. See `GET /members`.
797
+ */
798
+ user_id: string;
799
+ } | {
800
+ /**
801
+ * Step ID: letters, digits, `_` or `-`, up to 64.
802
+ */
803
+ id: string;
804
+ /**
805
+ * Step to run next; null ends the flow.
806
+ */
807
+ next: string | null;
808
+ kind: 'assign_agent';
809
+ /**
810
+ * AI agent that answers the conversation.
811
+ */
812
+ agent_id: string;
813
+ } | {
814
+ /**
815
+ * Step ID: letters, digits, `_` or `-`, up to 64.
816
+ */
817
+ id: string;
818
+ /**
819
+ * Step to run next; null ends the flow.
820
+ */
821
+ next: string | null;
822
+ kind: 'close_conversation';
823
+ } | {
824
+ /**
825
+ * Step ID: letters, digits, `_` or `-`, up to 64.
826
+ */
827
+ id: string;
828
+ /**
829
+ * Step to run next; null ends the flow.
830
+ */
831
+ next: string | null;
832
+ kind: 'end';
833
+ }>;
834
+ };
835
+ } | {
836
+ trigger: {
837
+ kind: 'daily';
838
+ /**
839
+ * Time of day it runs, `HH:MM`.
840
+ */
841
+ time: string;
842
+ /**
843
+ * IANA time zone of `time`.
844
+ */
845
+ timezone: string;
846
+ };
847
+ /**
848
+ * Who it messages: Odoo appointments or Odoo birthdays.
849
+ */
850
+ source: {
851
+ kind: 'odoo_appointments';
852
+ /**
853
+ * Days before the appointment it reminds.
854
+ */
855
+ days_ahead: number;
856
+ /**
857
+ * Odoo appointment states it reminds; null for every state.
858
+ */
859
+ appointment_states: Array<string> | null;
860
+ } | {
861
+ kind: 'odoo_birthdays';
862
+ };
863
+ template: {
864
+ /**
865
+ * WhatsApp channel it sends from.
866
+ */
867
+ channel_id: string;
868
+ /**
869
+ * Template ID at Meta.
870
+ */
871
+ template_id: string;
872
+ /**
873
+ * Template name.
874
+ */
875
+ template_name: string;
876
+ /**
877
+ * Template language code.
878
+ */
879
+ language: string;
880
+ /**
881
+ * Value each template variable takes.
882
+ */
883
+ parameters: {
884
+ [key: string]: 'appointment_start' | 'branch_name' | 'customer_first_name';
885
+ };
886
+ /**
887
+ * Whether an image is stored for the header.
888
+ */
889
+ has_header_image: boolean;
890
+ };
891
+ };
892
+ /**
893
+ * Last change to the workflow.
894
+ */
895
+ updated_at: string;
896
+ };
897
+ /**
898
+ * One queued run of a workflow, or one template send of a scheduled workflow. Its status does not confirm each message's delivery.
899
+ */
900
+ export type WorkflowExecution = {
901
+ /**
902
+ * Execution ID.
903
+ */
904
+ id: string;
905
+ /**
906
+ * `pending` or `processing` while queued or retrying; `processed` when it ran; `failed` for good; `superseded` when a newer execution replaced it.
907
+ */
908
+ status: 'pending' | 'processing' | 'processed' | 'failed' | 'superseded';
909
+ /**
910
+ * Attempts so far.
911
+ */
912
+ attempts: number;
913
+ /**
914
+ * Error of the latest failed attempt.
915
+ */
916
+ last_error: string | null;
917
+ /**
918
+ * When it was queued.
919
+ */
920
+ created_at: string;
921
+ /**
922
+ * When it finished, failed or was superseded.
923
+ */
924
+ processed_at: string | null;
925
+ };
603
926
  /**
604
927
  * A contact needs at least a name, a phone or an email.
605
928
  */
@@ -941,123 +1264,924 @@ export type RotateWebhookSecret = {
941
1264
  expire_previous_after_hours?: number;
942
1265
  };
943
1266
  /**
944
- * Optional. A value you choose, unique per logical write, 8–200 characters: a UUID or an ID from your system such as `order-10482-ready`. Retrying with the same key and body replays the first response instead of repeating the write.
1267
+ * Creates a conversation workflow as a `draft`. Activating it is a separate call.
945
1268
  */
946
- export type IdempotencyKey = string;
947
- export type ListContactsData = {
948
- body?: never;
949
- path?: never;
950
- query?: {
951
- /**
952
- * Items per page.
953
- */
954
- page_size?: number;
955
- /**
956
- * `next_cursor` from the previous page. Use it unchanged.
957
- */
958
- cursor?: string;
959
- /**
960
- * Text contained in the name, phone, email or company.
961
- */
962
- query?: string;
963
- /**
964
- * Only contacts with this tag.
965
- */
966
- tag_id?: string;
967
- /**
968
- * Only contacts this member owns.
969
- */
970
- owner_user_id?: string;
971
- /**
972
- * Only contacts at this stage.
973
- */
974
- lifecycle_stage?: 'subscriber' | 'lead' | 'marketing_qualified' | 'sales_qualified' | 'opportunity' | 'customer' | 'evangelist' | 'other';
975
- /**
976
- * Only contacts reachable on this channel.
977
- */
978
- channel?: 'whatsapp' | 'instagram' | 'messenger';
979
- };
980
- url: '/contacts';
981
- };
982
- export type ListContactsErrors = {
983
- /**
984
- * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
985
- */
986
- 400: Error;
1269
+ export type CreateWorkflow = {
987
1270
  /**
988
- * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
989
- */
990
- 401: Error;
991
- /**
992
- * `insufficient_scope`: The key lacks the scope this operation requires.
993
- */
994
- 403: Error;
995
- /**
996
- * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
997
- */
998
- 429: Error;
999
- /**
1000
- * `internal_error`: Ricky failed. Retry a read. Before retrying a write, read the resource: the same `Idempotency-Key` answers `request_processing`.
1271
+ * Display name.
1001
1272
  */
1002
- 500: Error;
1003
- };
1004
- export type ListContactsError = ListContactsErrors[keyof ListContactsErrors];
1005
- export type ListContactsResponses = {
1273
+ name: string;
1006
1274
  /**
1007
- * Success.
1275
+ * Reacts to a conversation with messages, questions, waits and assignments.
1008
1276
  */
1009
- 200: {
1010
- data: Array<Contact>;
1277
+ definition: {
1011
1278
  /**
1012
- * Pass as `cursor` for the next page; null on the last page.
1279
+ * `conversation_opened` runs when a conversation opens; `first_message_received` when the first message from the contact in a conversation arrives.
1013
1280
  */
1014
- next_cursor: string | null;
1015
- };
1016
- };
1017
- export type ListContactsResponse = ListContactsResponses[keyof ListContactsResponses];
1018
- export type CreateContactData = {
1019
- body: CreateContact;
1020
- headers?: {
1281
+ trigger: 'conversation_opened' | 'first_message_received';
1021
1282
  /**
1022
- * Optional. A value you choose, unique per logical write, 8–200 characters: a UUID or an ID from your system such as `order-10482-ready`. Retrying with the same key and body replays the first response instead of repeating the write.
1283
+ * Channels it listens to. See `GET /channels`.
1023
1284
  */
1024
- 'Idempotency-Key'?: string;
1025
- };
1026
- path?: never;
1027
- query?: never;
1028
- url: '/contacts';
1029
- };
1030
- export type CreateContactErrors = {
1031
- /**
1032
- * `invalid_json`: The body is not valid JSON.
1033
- *
1034
- * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
1035
- */
1036
- 400: Error;
1037
- /**
1038
- * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
1039
- */
1040
- 401: Error;
1041
- /**
1042
- * `insufficient_scope`: The key lacks the scope this operation requires.
1043
- */
1044
- 403: Error;
1045
- /**
1046
- * `idempotency_conflict`: The `Idempotency-Key` was used for a different request.
1047
- *
1048
- * `request_processing`: A request with this `Idempotency-Key` is still processing or ended in an unknown state.
1049
- *
1050
- * `conflict`: The resource changed in a way that prevents the operation.
1051
- */
1052
- 409: Error;
1053
- /**
1054
- * `body_too_large`: The JSON body exceeds 64 KiB.
1055
- */
1056
- 413: Error;
1285
+ channel_ids: Array<string>;
1286
+ /**
1287
+ * When it runs; null runs at any hour.
1288
+ */
1289
+ condition: {
1290
+ kind: 'inside_business_hours';
1291
+ business_hours: {
1292
+ /**
1293
+ * Opening time, `HH:MM`.
1294
+ */
1295
+ start: string;
1296
+ /**
1297
+ * Closing time, `HH:MM`.
1298
+ */
1299
+ end: string;
1300
+ /**
1301
+ * IANA time zone, for example `America/Panama`.
1302
+ */
1303
+ timezone: string;
1304
+ /**
1305
+ * Open days, 0 for Sunday to 6 for Saturday.
1306
+ */
1307
+ weekdays: Array<number>;
1308
+ };
1309
+ } | {
1310
+ kind: 'outside_business_hours';
1311
+ business_hours: {
1312
+ /**
1313
+ * Opening time, `HH:MM`.
1314
+ */
1315
+ start: string;
1316
+ /**
1317
+ * Closing time, `HH:MM`.
1318
+ */
1319
+ end: string;
1320
+ /**
1321
+ * IANA time zone, for example `America/Panama`.
1322
+ */
1323
+ timezone: string;
1324
+ /**
1325
+ * Open days, 0 for Sunday to 6 for Saturday.
1326
+ */
1327
+ weekdays: Array<number>;
1328
+ };
1329
+ } | null;
1330
+ /**
1331
+ * The steps and how they connect.
1332
+ */
1333
+ flow: {
1334
+ /**
1335
+ * ID of the first step.
1336
+ */
1337
+ entry: string;
1338
+ /**
1339
+ * One step. `assign_user`, `assign_agent` and `close_conversation` end the flow after they run.
1340
+ */
1341
+ steps: Array<{
1342
+ /**
1343
+ * Step ID: letters, digits, `_` or `-`, up to 64.
1344
+ */
1345
+ id: string;
1346
+ /**
1347
+ * Step to run next; null ends the flow.
1348
+ */
1349
+ next: string | null;
1350
+ kind: 'send_message';
1351
+ /**
1352
+ * Text sent to the contact.
1353
+ */
1354
+ text: string;
1355
+ } | {
1356
+ /**
1357
+ * Step ID: letters, digits, `_` or `-`, up to 64.
1358
+ */
1359
+ id: string;
1360
+ /**
1361
+ * Step to run next; null ends the flow.
1362
+ */
1363
+ next: string | null;
1364
+ kind: 'ask_question';
1365
+ /**
1366
+ * Text sent to the contact.
1367
+ */
1368
+ text: string;
1369
+ /**
1370
+ * Name the answer is kept under, for a later `branch`.
1371
+ */
1372
+ answer_key: string;
1373
+ /**
1374
+ * Buttons or list options, WhatsApp only. Empty for a free-text answer, which goes to `next`.
1375
+ */
1376
+ choices: Array<{
1377
+ /**
1378
+ * Step ID: letters, digits, `_` or `-`, up to 64.
1379
+ */
1380
+ id: string;
1381
+ /**
1382
+ * Button text, up to 20 characters.
1383
+ */
1384
+ label: string;
1385
+ /**
1386
+ * Step to run when the contact picks it.
1387
+ */
1388
+ next: string | null;
1389
+ }>;
1390
+ /**
1391
+ * How long to wait for the answer, up to 7 days.
1392
+ */
1393
+ timeout_seconds: number;
1394
+ /**
1395
+ * Step to run when no answer arrives in time.
1396
+ */
1397
+ on_timeout: string | null;
1398
+ /**
1399
+ * Step to run when the answer matches no option.
1400
+ */
1401
+ on_invalid: string | null;
1402
+ } | {
1403
+ /**
1404
+ * Step ID: letters, digits, `_` or `-`, up to 64.
1405
+ */
1406
+ id: string;
1407
+ /**
1408
+ * Step to run next; null ends the flow.
1409
+ */
1410
+ next: string | null;
1411
+ kind: 'branch';
1412
+ /**
1413
+ * Name the answer is kept under, for a later `branch`.
1414
+ */
1415
+ answer_key: string;
1416
+ operator: 'equals' | 'contains' | 'exists';
1417
+ /**
1418
+ * Value compared with the answer.
1419
+ */
1420
+ value: string;
1421
+ /**
1422
+ * Step to run when the condition does not hold; `next` when it does.
1423
+ */
1424
+ otherwise: string | null;
1425
+ } | {
1426
+ /**
1427
+ * Step ID: letters, digits, `_` or `-`, up to 64.
1428
+ */
1429
+ id: string;
1430
+ /**
1431
+ * Step to run next; null ends the flow.
1432
+ */
1433
+ next: string | null;
1434
+ kind: 'wait';
1435
+ /**
1436
+ * Delay, up to 7 days.
1437
+ */
1438
+ seconds: number;
1439
+ } | {
1440
+ /**
1441
+ * Step ID: letters, digits, `_` or `-`, up to 64.
1442
+ */
1443
+ id: string;
1444
+ /**
1445
+ * Step to run next; null ends the flow.
1446
+ */
1447
+ next: string | null;
1448
+ kind: 'assign_user';
1449
+ /**
1450
+ * Member who takes the conversation. See `GET /members`.
1451
+ */
1452
+ user_id: string;
1453
+ } | {
1454
+ /**
1455
+ * Step ID: letters, digits, `_` or `-`, up to 64.
1456
+ */
1457
+ id: string;
1458
+ /**
1459
+ * Step to run next; null ends the flow.
1460
+ */
1461
+ next: string | null;
1462
+ kind: 'assign_agent';
1463
+ /**
1464
+ * AI agent that answers the conversation.
1465
+ */
1466
+ agent_id: string;
1467
+ } | {
1468
+ /**
1469
+ * Step ID: letters, digits, `_` or `-`, up to 64.
1470
+ */
1471
+ id: string;
1472
+ /**
1473
+ * Step to run next; null ends the flow.
1474
+ */
1475
+ next: string | null;
1476
+ kind: 'close_conversation';
1477
+ } | {
1478
+ /**
1479
+ * Step ID: letters, digits, `_` or `-`, up to 64.
1480
+ */
1481
+ id: string;
1482
+ /**
1483
+ * Step to run next; null ends the flow.
1484
+ */
1485
+ next: string | null;
1486
+ kind: 'end';
1487
+ }>;
1488
+ };
1489
+ };
1490
+ };
1491
+ /**
1492
+ * Only the fields you send change. The status stays: an active workflow runs the new definition from its next execution.
1493
+ */
1494
+ export type UpdateWorkflow = {
1495
+ /**
1496
+ * Display name.
1497
+ */
1498
+ name?: string;
1499
+ /**
1500
+ * Replaces the whole definition.
1501
+ */
1502
+ definition?: {
1503
+ /**
1504
+ * `conversation_opened` runs when a conversation opens; `first_message_received` when the first message from the contact in a conversation arrives.
1505
+ */
1506
+ trigger: 'conversation_opened' | 'first_message_received';
1507
+ /**
1508
+ * Channels it listens to. See `GET /channels`.
1509
+ */
1510
+ channel_ids: Array<string>;
1511
+ /**
1512
+ * When it runs; null runs at any hour.
1513
+ */
1514
+ condition: {
1515
+ kind: 'inside_business_hours';
1516
+ business_hours: {
1517
+ /**
1518
+ * Opening time, `HH:MM`.
1519
+ */
1520
+ start: string;
1521
+ /**
1522
+ * Closing time, `HH:MM`.
1523
+ */
1524
+ end: string;
1525
+ /**
1526
+ * IANA time zone, for example `America/Panama`.
1527
+ */
1528
+ timezone: string;
1529
+ /**
1530
+ * Open days, 0 for Sunday to 6 for Saturday.
1531
+ */
1532
+ weekdays: Array<number>;
1533
+ };
1534
+ } | {
1535
+ kind: 'outside_business_hours';
1536
+ business_hours: {
1537
+ /**
1538
+ * Opening time, `HH:MM`.
1539
+ */
1540
+ start: string;
1541
+ /**
1542
+ * Closing time, `HH:MM`.
1543
+ */
1544
+ end: string;
1545
+ /**
1546
+ * IANA time zone, for example `America/Panama`.
1547
+ */
1548
+ timezone: string;
1549
+ /**
1550
+ * Open days, 0 for Sunday to 6 for Saturday.
1551
+ */
1552
+ weekdays: Array<number>;
1553
+ };
1554
+ } | null;
1555
+ /**
1556
+ * The steps and how they connect.
1557
+ */
1558
+ flow: {
1559
+ /**
1560
+ * ID of the first step.
1561
+ */
1562
+ entry: string;
1563
+ /**
1564
+ * One step. `assign_user`, `assign_agent` and `close_conversation` end the flow after they run.
1565
+ */
1566
+ steps: Array<{
1567
+ /**
1568
+ * Step ID: letters, digits, `_` or `-`, up to 64.
1569
+ */
1570
+ id: string;
1571
+ /**
1572
+ * Step to run next; null ends the flow.
1573
+ */
1574
+ next: string | null;
1575
+ kind: 'send_message';
1576
+ /**
1577
+ * Text sent to the contact.
1578
+ */
1579
+ text: string;
1580
+ } | {
1581
+ /**
1582
+ * Step ID: letters, digits, `_` or `-`, up to 64.
1583
+ */
1584
+ id: string;
1585
+ /**
1586
+ * Step to run next; null ends the flow.
1587
+ */
1588
+ next: string | null;
1589
+ kind: 'ask_question';
1590
+ /**
1591
+ * Text sent to the contact.
1592
+ */
1593
+ text: string;
1594
+ /**
1595
+ * Name the answer is kept under, for a later `branch`.
1596
+ */
1597
+ answer_key: string;
1598
+ /**
1599
+ * Buttons or list options, WhatsApp only. Empty for a free-text answer, which goes to `next`.
1600
+ */
1601
+ choices: Array<{
1602
+ /**
1603
+ * Step ID: letters, digits, `_` or `-`, up to 64.
1604
+ */
1605
+ id: string;
1606
+ /**
1607
+ * Button text, up to 20 characters.
1608
+ */
1609
+ label: string;
1610
+ /**
1611
+ * Step to run when the contact picks it.
1612
+ */
1613
+ next: string | null;
1614
+ }>;
1615
+ /**
1616
+ * How long to wait for the answer, up to 7 days.
1617
+ */
1618
+ timeout_seconds: number;
1619
+ /**
1620
+ * Step to run when no answer arrives in time.
1621
+ */
1622
+ on_timeout: string | null;
1623
+ /**
1624
+ * Step to run when the answer matches no option.
1625
+ */
1626
+ on_invalid: string | null;
1627
+ } | {
1628
+ /**
1629
+ * Step ID: letters, digits, `_` or `-`, up to 64.
1630
+ */
1631
+ id: string;
1632
+ /**
1633
+ * Step to run next; null ends the flow.
1634
+ */
1635
+ next: string | null;
1636
+ kind: 'branch';
1637
+ /**
1638
+ * Name the answer is kept under, for a later `branch`.
1639
+ */
1640
+ answer_key: string;
1641
+ operator: 'equals' | 'contains' | 'exists';
1642
+ /**
1643
+ * Value compared with the answer.
1644
+ */
1645
+ value: string;
1646
+ /**
1647
+ * Step to run when the condition does not hold; `next` when it does.
1648
+ */
1649
+ otherwise: string | null;
1650
+ } | {
1651
+ /**
1652
+ * Step ID: letters, digits, `_` or `-`, up to 64.
1653
+ */
1654
+ id: string;
1655
+ /**
1656
+ * Step to run next; null ends the flow.
1657
+ */
1658
+ next: string | null;
1659
+ kind: 'wait';
1660
+ /**
1661
+ * Delay, up to 7 days.
1662
+ */
1663
+ seconds: number;
1664
+ } | {
1665
+ /**
1666
+ * Step ID: letters, digits, `_` or `-`, up to 64.
1667
+ */
1668
+ id: string;
1669
+ /**
1670
+ * Step to run next; null ends the flow.
1671
+ */
1672
+ next: string | null;
1673
+ kind: 'assign_user';
1674
+ /**
1675
+ * Member who takes the conversation. See `GET /members`.
1676
+ */
1677
+ user_id: string;
1678
+ } | {
1679
+ /**
1680
+ * Step ID: letters, digits, `_` or `-`, up to 64.
1681
+ */
1682
+ id: string;
1683
+ /**
1684
+ * Step to run next; null ends the flow.
1685
+ */
1686
+ next: string | null;
1687
+ kind: 'assign_agent';
1688
+ /**
1689
+ * AI agent that answers the conversation.
1690
+ */
1691
+ agent_id: string;
1692
+ } | {
1693
+ /**
1694
+ * Step ID: letters, digits, `_` or `-`, up to 64.
1695
+ */
1696
+ id: string;
1697
+ /**
1698
+ * Step to run next; null ends the flow.
1699
+ */
1700
+ next: string | null;
1701
+ kind: 'close_conversation';
1702
+ } | {
1703
+ /**
1704
+ * Step ID: letters, digits, `_` or `-`, up to 64.
1705
+ */
1706
+ id: string;
1707
+ /**
1708
+ * Step to run next; null ends the flow.
1709
+ */
1710
+ next: string | null;
1711
+ kind: 'end';
1712
+ }>;
1713
+ };
1714
+ };
1715
+ };
1716
+ /**
1717
+ * Optional. A value you choose, unique per logical write, 8–200 characters: a UUID or an ID from your system such as `order-10482-ready`. Retrying with the same key and body replays the first response instead of repeating the write.
1718
+ */
1719
+ export type IdempotencyKey = string;
1720
+ export type ListContactsData = {
1721
+ body?: never;
1722
+ path?: never;
1723
+ query?: {
1724
+ /**
1725
+ * Items per page.
1726
+ */
1727
+ page_size?: number;
1728
+ /**
1729
+ * `next_cursor` from the previous page. Use it unchanged.
1730
+ */
1731
+ cursor?: string;
1732
+ /**
1733
+ * Text contained in the name, phone, email or company.
1734
+ */
1735
+ query?: string;
1736
+ /**
1737
+ * Only contacts with this tag.
1738
+ */
1739
+ tag_id?: string;
1740
+ /**
1741
+ * Only contacts this member owns.
1742
+ */
1743
+ owner_user_id?: string;
1744
+ /**
1745
+ * Only contacts at this stage.
1746
+ */
1747
+ lifecycle_stage?: 'subscriber' | 'lead' | 'marketing_qualified' | 'sales_qualified' | 'opportunity' | 'customer' | 'evangelist' | 'other';
1748
+ /**
1749
+ * Only contacts reachable on this channel.
1750
+ */
1751
+ channel?: 'whatsapp' | 'instagram' | 'messenger';
1752
+ };
1753
+ url: '/contacts';
1754
+ };
1755
+ export type ListContactsErrors = {
1756
+ /**
1757
+ * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
1758
+ */
1759
+ 400: Error;
1760
+ /**
1761
+ * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
1762
+ */
1763
+ 401: Error;
1764
+ /**
1765
+ * `insufficient_scope`: The key lacks the scope this operation requires.
1766
+ */
1767
+ 403: Error;
1768
+ /**
1769
+ * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
1770
+ */
1771
+ 429: Error;
1772
+ /**
1773
+ * `internal_error`: Ricky failed. Retry a read. Before retrying a write, read the resource: the same `Idempotency-Key` answers `request_processing`.
1774
+ */
1775
+ 500: Error;
1776
+ };
1777
+ export type ListContactsError = ListContactsErrors[keyof ListContactsErrors];
1778
+ export type ListContactsResponses = {
1779
+ /**
1780
+ * Success.
1781
+ */
1782
+ 200: {
1783
+ data: Array<Contact>;
1784
+ /**
1785
+ * Pass as `cursor` for the next page; null on the last page.
1786
+ */
1787
+ next_cursor: string | null;
1788
+ };
1789
+ };
1790
+ export type ListContactsResponse = ListContactsResponses[keyof ListContactsResponses];
1791
+ export type CreateContactData = {
1792
+ body: CreateContact;
1793
+ headers?: {
1794
+ /**
1795
+ * Optional. A value you choose, unique per logical write, 8–200 characters: a UUID or an ID from your system such as `order-10482-ready`. Retrying with the same key and body replays the first response instead of repeating the write.
1796
+ */
1797
+ 'Idempotency-Key'?: string;
1798
+ };
1799
+ path?: never;
1800
+ query?: never;
1801
+ url: '/contacts';
1802
+ };
1803
+ export type CreateContactErrors = {
1804
+ /**
1805
+ * `invalid_json`: The body is not valid JSON.
1806
+ *
1807
+ * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
1808
+ */
1809
+ 400: Error;
1810
+ /**
1811
+ * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
1812
+ */
1813
+ 401: Error;
1814
+ /**
1815
+ * `insufficient_scope`: The key lacks the scope this operation requires.
1816
+ */
1817
+ 403: Error;
1818
+ /**
1819
+ * `idempotency_conflict`: The `Idempotency-Key` was used for a different request.
1820
+ *
1821
+ * `request_processing`: A request with this `Idempotency-Key` is still processing or ended in an unknown state.
1822
+ *
1823
+ * `conflict`: The resource changed in a way that prevents the operation.
1824
+ */
1825
+ 409: Error;
1826
+ /**
1827
+ * `body_too_large`: The JSON body exceeds 64 KiB.
1828
+ */
1829
+ 413: Error;
1830
+ /**
1831
+ * `unsupported_media_type`: The body must be `application/json`.
1832
+ */
1833
+ 415: Error;
1834
+ /**
1835
+ * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
1836
+ */
1837
+ 429: Error;
1838
+ /**
1839
+ * `internal_error`: Ricky failed. Retry a read. Before retrying a write, read the resource: the same `Idempotency-Key` answers `request_processing`.
1840
+ */
1841
+ 500: Error;
1842
+ };
1843
+ export type CreateContactError = CreateContactErrors[keyof CreateContactErrors];
1844
+ export type CreateContactResponses = {
1845
+ /**
1846
+ * Success.
1847
+ */
1848
+ 201: {
1849
+ data: Contact;
1850
+ };
1851
+ };
1852
+ export type CreateContactResponse = CreateContactResponses[keyof CreateContactResponses];
1853
+ export type GetContactData = {
1854
+ body?: never;
1855
+ path: {
1856
+ /**
1857
+ * Contact ID.
1858
+ */
1859
+ contact_id: string;
1860
+ };
1861
+ query?: never;
1862
+ url: '/contacts/{contact_id}';
1863
+ };
1864
+ export type GetContactErrors = {
1865
+ /**
1866
+ * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
1867
+ */
1868
+ 400: Error;
1869
+ /**
1870
+ * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
1871
+ */
1872
+ 401: Error;
1873
+ /**
1874
+ * `insufficient_scope`: The key lacks the scope this operation requires.
1875
+ */
1876
+ 403: Error;
1877
+ /**
1878
+ * `not_found`: The resource does not exist in this organization.
1879
+ */
1880
+ 404: Error;
1881
+ /**
1882
+ * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
1883
+ */
1884
+ 429: Error;
1885
+ /**
1886
+ * `internal_error`: Ricky failed. Retry a read. Before retrying a write, read the resource: the same `Idempotency-Key` answers `request_processing`.
1887
+ */
1888
+ 500: Error;
1889
+ };
1890
+ export type GetContactError = GetContactErrors[keyof GetContactErrors];
1891
+ export type GetContactResponses = {
1892
+ /**
1893
+ * Success.
1894
+ */
1895
+ 200: {
1896
+ data: Contact;
1897
+ };
1898
+ };
1899
+ export type GetContactResponse = GetContactResponses[keyof GetContactResponses];
1900
+ export type UpdateContactData = {
1901
+ body: UpdateContact;
1902
+ headers?: {
1903
+ /**
1904
+ * Optional. A value you choose, unique per logical write, 8–200 characters: a UUID or an ID from your system such as `order-10482-ready`. Retrying with the same key and body replays the first response instead of repeating the write.
1905
+ */
1906
+ 'Idempotency-Key'?: string;
1907
+ };
1908
+ path: {
1909
+ /**
1910
+ * Contact ID.
1911
+ */
1912
+ contact_id: string;
1913
+ };
1914
+ query?: never;
1915
+ url: '/contacts/{contact_id}';
1916
+ };
1917
+ export type UpdateContactErrors = {
1918
+ /**
1919
+ * `invalid_json`: The body is not valid JSON.
1920
+ *
1921
+ * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
1922
+ */
1923
+ 400: Error;
1924
+ /**
1925
+ * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
1926
+ */
1927
+ 401: Error;
1928
+ /**
1929
+ * `insufficient_scope`: The key lacks the scope this operation requires.
1930
+ */
1931
+ 403: Error;
1932
+ /**
1933
+ * `not_found`: The resource does not exist in this organization.
1934
+ */
1935
+ 404: Error;
1936
+ /**
1937
+ * `idempotency_conflict`: The `Idempotency-Key` was used for a different request.
1938
+ *
1939
+ * `request_processing`: A request with this `Idempotency-Key` is still processing or ended in an unknown state.
1940
+ *
1941
+ * `conflict`: The resource changed in a way that prevents the operation.
1942
+ */
1943
+ 409: Error;
1944
+ /**
1945
+ * `body_too_large`: The JSON body exceeds 64 KiB.
1946
+ */
1947
+ 413: Error;
1948
+ /**
1949
+ * `unsupported_media_type`: The body must be `application/json`.
1950
+ */
1951
+ 415: Error;
1952
+ /**
1953
+ * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
1954
+ */
1955
+ 429: Error;
1956
+ /**
1957
+ * `internal_error`: Ricky failed. Retry a read. Before retrying a write, read the resource: the same `Idempotency-Key` answers `request_processing`.
1958
+ */
1959
+ 500: Error;
1960
+ };
1961
+ export type UpdateContactError = UpdateContactErrors[keyof UpdateContactErrors];
1962
+ export type UpdateContactResponses = {
1963
+ /**
1964
+ * Success.
1965
+ */
1966
+ 200: {
1967
+ data: Contact;
1968
+ };
1969
+ };
1970
+ export type UpdateContactResponse = UpdateContactResponses[keyof UpdateContactResponses];
1971
+ export type AddContactNoteData = {
1972
+ body: AddContactNote;
1973
+ headers?: {
1974
+ /**
1975
+ * Optional. A value you choose, unique per logical write, 8–200 characters: a UUID or an ID from your system such as `order-10482-ready`. Retrying with the same key and body replays the first response instead of repeating the write.
1976
+ */
1977
+ 'Idempotency-Key'?: string;
1978
+ };
1979
+ path: {
1980
+ /**
1981
+ * Contact ID.
1982
+ */
1983
+ contact_id: string;
1984
+ };
1985
+ query?: never;
1986
+ url: '/contacts/{contact_id}/notes';
1987
+ };
1988
+ export type AddContactNoteErrors = {
1989
+ /**
1990
+ * `invalid_json`: The body is not valid JSON.
1991
+ *
1992
+ * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
1993
+ */
1994
+ 400: Error;
1995
+ /**
1996
+ * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
1997
+ */
1998
+ 401: Error;
1999
+ /**
2000
+ * `insufficient_scope`: The key lacks the scope this operation requires.
2001
+ */
2002
+ 403: Error;
2003
+ /**
2004
+ * `not_found`: The resource does not exist in this organization.
2005
+ */
2006
+ 404: Error;
2007
+ /**
2008
+ * `idempotency_conflict`: The `Idempotency-Key` was used for a different request.
2009
+ *
2010
+ * `request_processing`: A request with this `Idempotency-Key` is still processing or ended in an unknown state.
2011
+ */
2012
+ 409: Error;
2013
+ /**
2014
+ * `body_too_large`: The JSON body exceeds 64 KiB.
2015
+ */
2016
+ 413: Error;
2017
+ /**
2018
+ * `unsupported_media_type`: The body must be `application/json`.
2019
+ */
2020
+ 415: Error;
2021
+ /**
2022
+ * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
2023
+ */
2024
+ 429: Error;
2025
+ /**
2026
+ * `internal_error`: Ricky failed. Retry a read. Before retrying a write, read the resource: the same `Idempotency-Key` answers `request_processing`.
2027
+ */
2028
+ 500: Error;
2029
+ };
2030
+ export type AddContactNoteError = AddContactNoteErrors[keyof AddContactNoteErrors];
2031
+ export type AddContactNoteResponses = {
2032
+ /**
2033
+ * Success.
2034
+ */
2035
+ 200: {
2036
+ data: Contact;
2037
+ };
2038
+ };
2039
+ export type AddContactNoteResponse = AddContactNoteResponses[keyof AddContactNoteResponses];
2040
+ export type ListContactFieldsData = {
2041
+ body?: never;
2042
+ path?: never;
2043
+ query?: never;
2044
+ url: '/contact-fields';
2045
+ };
2046
+ export type ListContactFieldsErrors = {
2047
+ /**
2048
+ * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
2049
+ */
2050
+ 401: Error;
2051
+ /**
2052
+ * `insufficient_scope`: The key lacks the scope this operation requires.
2053
+ */
2054
+ 403: Error;
2055
+ /**
2056
+ * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
2057
+ */
2058
+ 429: Error;
2059
+ /**
2060
+ * `internal_error`: Ricky failed. Retry a read. Before retrying a write, read the resource: the same `Idempotency-Key` answers `request_processing`.
2061
+ */
2062
+ 500: Error;
2063
+ };
2064
+ export type ListContactFieldsError = ListContactFieldsErrors[keyof ListContactFieldsErrors];
2065
+ export type ListContactFieldsResponses = {
2066
+ /**
2067
+ * Success.
2068
+ */
2069
+ 200: {
2070
+ data: Array<ContactField>;
2071
+ /**
2072
+ * Pass as `cursor` for the next page; null on the last page.
2073
+ */
2074
+ next_cursor: string | null;
2075
+ };
2076
+ };
2077
+ export type ListContactFieldsResponse = ListContactFieldsResponses[keyof ListContactFieldsResponses];
2078
+ export type ListConversationsData = {
2079
+ body?: never;
2080
+ path?: never;
2081
+ query?: {
2082
+ /**
2083
+ * Items per page.
2084
+ */
2085
+ page_size?: number;
2086
+ /**
2087
+ * `next_cursor` from the previous page. Use it unchanged.
2088
+ */
2089
+ cursor?: string;
2090
+ status?: 'all' | 'open' | 'closed';
2091
+ /**
2092
+ * Only conversations assigned to this member.
2093
+ */
2094
+ assigned_user_id?: string;
2095
+ };
2096
+ url: '/conversations';
2097
+ };
2098
+ export type ListConversationsErrors = {
2099
+ /**
2100
+ * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
2101
+ */
2102
+ 400: Error;
2103
+ /**
2104
+ * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
2105
+ */
2106
+ 401: Error;
2107
+ /**
2108
+ * `insufficient_scope`: The key lacks the scope this operation requires.
2109
+ */
2110
+ 403: Error;
2111
+ /**
2112
+ * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
2113
+ */
2114
+ 429: Error;
2115
+ /**
2116
+ * `internal_error`: Ricky failed. Retry a read. Before retrying a write, read the resource: the same `Idempotency-Key` answers `request_processing`.
2117
+ */
2118
+ 500: Error;
2119
+ };
2120
+ export type ListConversationsError = ListConversationsErrors[keyof ListConversationsErrors];
2121
+ export type ListConversationsResponses = {
2122
+ /**
2123
+ * Success.
2124
+ */
2125
+ 200: {
2126
+ data: Array<Conversation>;
2127
+ /**
2128
+ * Pass as `cursor` for the next page; null on the last page.
2129
+ */
2130
+ next_cursor: string | null;
2131
+ };
2132
+ };
2133
+ export type ListConversationsResponse = ListConversationsResponses[keyof ListConversationsResponses];
2134
+ export type StartConversationData = {
2135
+ body: StartConversation;
2136
+ headers?: {
2137
+ /**
2138
+ * Optional. A value you choose, unique per logical write, 8–200 characters: a UUID or an ID from your system such as `order-10482-ready`. Retrying with the same key and body replays the first response instead of repeating the write.
2139
+ */
2140
+ 'Idempotency-Key'?: string;
2141
+ };
2142
+ path?: never;
2143
+ query?: never;
2144
+ url: '/conversations';
2145
+ };
2146
+ export type StartConversationErrors = {
2147
+ /**
2148
+ * `invalid_json`: The body is not valid JSON.
2149
+ *
2150
+ * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
2151
+ */
2152
+ 400: Error;
2153
+ /**
2154
+ * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
2155
+ */
2156
+ 401: Error;
2157
+ /**
2158
+ * `insufficient_scope`: The key lacks the scope this operation requires.
2159
+ */
2160
+ 403: Error;
2161
+ /**
2162
+ * `not_found`: The resource does not exist in this organization.
2163
+ */
2164
+ 404: Error;
2165
+ /**
2166
+ * `idempotency_conflict`: The `Idempotency-Key` was used for a different request.
2167
+ *
2168
+ * `request_processing`: A request with this `Idempotency-Key` is still processing or ended in an unknown state.
2169
+ */
2170
+ 409: Error;
2171
+ /**
2172
+ * `body_too_large`: The JSON body exceeds 64 KiB.
2173
+ */
2174
+ 413: Error;
1057
2175
  /**
1058
2176
  * `unsupported_media_type`: The body must be `application/json`.
1059
2177
  */
1060
2178
  415: Error;
2179
+ /**
2180
+ * `outside_messaging_window`: The channel only allows free-form text inside its reply window; send a template.
2181
+ *
2182
+ * `rule_violation`: The request breaks a business rule; `message` says which.
2183
+ */
2184
+ 422: Error;
1061
2185
  /**
1062
2186
  * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
1063
2187
  */
@@ -1066,29 +2190,37 @@ export type CreateContactErrors = {
1066
2190
  * `internal_error`: Ricky failed. Retry a read. Before retrying a write, read the resource: the same `Idempotency-Key` answers `request_processing`.
1067
2191
  */
1068
2192
  500: Error;
2193
+ /**
2194
+ * `upstream_error`: The messaging provider failed. Retry later.
2195
+ */
2196
+ 502: Error;
2197
+ /**
2198
+ * `unavailable`: A dependency is temporarily unavailable. Retry later.
2199
+ */
2200
+ 503: Error;
1069
2201
  };
1070
- export type CreateContactError = CreateContactErrors[keyof CreateContactErrors];
1071
- export type CreateContactResponses = {
2202
+ export type StartConversationError = StartConversationErrors[keyof StartConversationErrors];
2203
+ export type StartConversationResponses = {
1072
2204
  /**
1073
- * Success.
2205
+ * Accepted.
1074
2206
  */
1075
- 201: {
1076
- data: Contact;
2207
+ 202: {
2208
+ data: Send;
1077
2209
  };
1078
2210
  };
1079
- export type CreateContactResponse = CreateContactResponses[keyof CreateContactResponses];
1080
- export type GetContactData = {
2211
+ export type StartConversationResponse = StartConversationResponses[keyof StartConversationResponses];
2212
+ export type GetConversationData = {
1081
2213
  body?: never;
1082
2214
  path: {
1083
2215
  /**
1084
- * Contact ID.
2216
+ * Conversation ID.
1085
2217
  */
1086
- contact_id: string;
2218
+ conversation_id: string;
1087
2219
  };
1088
2220
  query?: never;
1089
- url: '/contacts/{contact_id}';
2221
+ url: '/conversations/{conversation_id}';
1090
2222
  };
1091
- export type GetContactErrors = {
2223
+ export type GetConversationErrors = {
1092
2224
  /**
1093
2225
  * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
1094
2226
  */
@@ -1114,18 +2246,18 @@ export type GetContactErrors = {
1114
2246
  */
1115
2247
  500: Error;
1116
2248
  };
1117
- export type GetContactError = GetContactErrors[keyof GetContactErrors];
1118
- export type GetContactResponses = {
2249
+ export type GetConversationError = GetConversationErrors[keyof GetConversationErrors];
2250
+ export type GetConversationResponses = {
1119
2251
  /**
1120
2252
  * Success.
1121
2253
  */
1122
2254
  200: {
1123
- data: Contact;
2255
+ data: Conversation;
1124
2256
  };
1125
2257
  };
1126
- export type GetContactResponse = GetContactResponses[keyof GetContactResponses];
1127
- export type UpdateContactData = {
1128
- body: UpdateContact;
2258
+ export type GetConversationResponse = GetConversationResponses[keyof GetConversationResponses];
2259
+ export type AssignConversationData = {
2260
+ body: AssignConversation;
1129
2261
  headers?: {
1130
2262
  /**
1131
2263
  * Optional. A value you choose, unique per logical write, 8–200 characters: a UUID or an ID from your system such as `order-10482-ready`. Retrying with the same key and body replays the first response instead of repeating the write.
@@ -1134,14 +2266,14 @@ export type UpdateContactData = {
1134
2266
  };
1135
2267
  path: {
1136
2268
  /**
1137
- * Contact ID.
2269
+ * Conversation ID.
1138
2270
  */
1139
- contact_id: string;
2271
+ conversation_id: string;
1140
2272
  };
1141
2273
  query?: never;
1142
- url: '/contacts/{contact_id}';
2274
+ url: '/conversations/{conversation_id}/assignment';
1143
2275
  };
1144
- export type UpdateContactErrors = {
2276
+ export type AssignConversationErrors = {
1145
2277
  /**
1146
2278
  * `invalid_json`: The body is not valid JSON.
1147
2279
  *
@@ -1164,8 +2296,6 @@ export type UpdateContactErrors = {
1164
2296
  * `idempotency_conflict`: The `Idempotency-Key` was used for a different request.
1165
2297
  *
1166
2298
  * `request_processing`: A request with this `Idempotency-Key` is still processing or ended in an unknown state.
1167
- *
1168
- * `conflict`: The resource changed in a way that prevents the operation.
1169
2299
  */
1170
2300
  409: Error;
1171
2301
  /**
@@ -1176,6 +2306,10 @@ export type UpdateContactErrors = {
1176
2306
  * `unsupported_media_type`: The body must be `application/json`.
1177
2307
  */
1178
2308
  415: Error;
2309
+ /**
2310
+ * `rule_violation`: The request breaks a business rule; `message` says which.
2311
+ */
2312
+ 422: Error;
1179
2313
  /**
1180
2314
  * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
1181
2315
  */
@@ -1185,18 +2319,18 @@ export type UpdateContactErrors = {
1185
2319
  */
1186
2320
  500: Error;
1187
2321
  };
1188
- export type UpdateContactError = UpdateContactErrors[keyof UpdateContactErrors];
1189
- export type UpdateContactResponses = {
2322
+ export type AssignConversationError = AssignConversationErrors[keyof AssignConversationErrors];
2323
+ export type AssignConversationResponses = {
1190
2324
  /**
1191
2325
  * Success.
1192
2326
  */
1193
2327
  200: {
1194
- data: Contact;
2328
+ data: Conversation;
1195
2329
  };
1196
2330
  };
1197
- export type UpdateContactResponse = UpdateContactResponses[keyof UpdateContactResponses];
1198
- export type AddContactNoteData = {
1199
- body: AddContactNote;
2331
+ export type AssignConversationResponse = AssignConversationResponses[keyof AssignConversationResponses];
2332
+ export type CloseConversationData = {
2333
+ body: CloseConversation;
1200
2334
  headers?: {
1201
2335
  /**
1202
2336
  * Optional. A value you choose, unique per logical write, 8–200 characters: a UUID or an ID from your system such as `order-10482-ready`. Retrying with the same key and body replays the first response instead of repeating the write.
@@ -1205,14 +2339,14 @@ export type AddContactNoteData = {
1205
2339
  };
1206
2340
  path: {
1207
2341
  /**
1208
- * Contact ID.
2342
+ * Conversation ID.
1209
2343
  */
1210
- contact_id: string;
2344
+ conversation_id: string;
1211
2345
  };
1212
2346
  query?: never;
1213
- url: '/contacts/{contact_id}/notes';
2347
+ url: '/conversations/{conversation_id}/close';
1214
2348
  };
1215
- export type AddContactNoteErrors = {
2349
+ export type CloseConversationErrors = {
1216
2350
  /**
1217
2351
  * `invalid_json`: The body is not valid JSON.
1218
2352
  *
@@ -1254,23 +2388,38 @@ export type AddContactNoteErrors = {
1254
2388
  */
1255
2389
  500: Error;
1256
2390
  };
1257
- export type AddContactNoteError = AddContactNoteErrors[keyof AddContactNoteErrors];
1258
- export type AddContactNoteResponses = {
2391
+ export type CloseConversationError = CloseConversationErrors[keyof CloseConversationErrors];
2392
+ export type CloseConversationResponses = {
1259
2393
  /**
1260
2394
  * Success.
1261
2395
  */
1262
2396
  200: {
1263
- data: Contact;
2397
+ data: Conversation;
1264
2398
  };
1265
2399
  };
1266
- export type AddContactNoteResponse = AddContactNoteResponses[keyof AddContactNoteResponses];
1267
- export type ListContactFieldsData = {
2400
+ export type CloseConversationResponse = CloseConversationResponses[keyof CloseConversationResponses];
2401
+ export type ReopenConversationData = {
1268
2402
  body?: never;
1269
- path?: never;
2403
+ headers?: {
2404
+ /**
2405
+ * Optional. A value you choose, unique per logical write, 8–200 characters: a UUID or an ID from your system such as `order-10482-ready`. Retrying with the same key and body replays the first response instead of repeating the write.
2406
+ */
2407
+ 'Idempotency-Key'?: string;
2408
+ };
2409
+ path: {
2410
+ /**
2411
+ * Conversation ID.
2412
+ */
2413
+ conversation_id: string;
2414
+ };
1270
2415
  query?: never;
1271
- url: '/contact-fields';
2416
+ url: '/conversations/{conversation_id}/reopen';
1272
2417
  };
1273
- export type ListContactFieldsErrors = {
2418
+ export type ReopenConversationErrors = {
2419
+ /**
2420
+ * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
2421
+ */
2422
+ 400: Error;
1274
2423
  /**
1275
2424
  * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
1276
2425
  */
@@ -1278,7 +2427,17 @@ export type ListContactFieldsErrors = {
1278
2427
  /**
1279
2428
  * `insufficient_scope`: The key lacks the scope this operation requires.
1280
2429
  */
1281
- 403: Error;
2430
+ 403: Error;
2431
+ /**
2432
+ * `not_found`: The resource does not exist in this organization.
2433
+ */
2434
+ 404: Error;
2435
+ /**
2436
+ * `idempotency_conflict`: The `Idempotency-Key` was used for a different request.
2437
+ *
2438
+ * `request_processing`: A request with this `Idempotency-Key` is still processing or ended in an unknown state.
2439
+ */
2440
+ 409: Error;
1282
2441
  /**
1283
2442
  * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
1284
2443
  */
@@ -1288,41 +2447,33 @@ export type ListContactFieldsErrors = {
1288
2447
  */
1289
2448
  500: Error;
1290
2449
  };
1291
- export type ListContactFieldsError = ListContactFieldsErrors[keyof ListContactFieldsErrors];
1292
- export type ListContactFieldsResponses = {
2450
+ export type ReopenConversationError = ReopenConversationErrors[keyof ReopenConversationErrors];
2451
+ export type ReopenConversationResponses = {
1293
2452
  /**
1294
2453
  * Success.
1295
2454
  */
1296
2455
  200: {
1297
- data: Array<ContactField>;
1298
- /**
1299
- * Pass as `cursor` for the next page; null on the last page.
1300
- */
1301
- next_cursor: string | null;
2456
+ data: Conversation;
1302
2457
  };
1303
2458
  };
1304
- export type ListContactFieldsResponse = ListContactFieldsResponses[keyof ListContactFieldsResponses];
1305
- export type ListConversationsData = {
2459
+ export type ReopenConversationResponse = ReopenConversationResponses[keyof ReopenConversationResponses];
2460
+ export type ListMessagesData = {
1306
2461
  body?: never;
1307
- path?: never;
1308
- query?: {
2462
+ path: {
1309
2463
  /**
1310
- * Items per page.
2464
+ * Conversation ID.
1311
2465
  */
1312
- page_size?: number;
2466
+ conversation_id: string;
2467
+ };
2468
+ query?: {
1313
2469
  /**
1314
2470
  * `next_cursor` from the previous page. Use it unchanged.
1315
2471
  */
1316
2472
  cursor?: string;
1317
- status?: 'all' | 'open' | 'closed';
1318
- /**
1319
- * Only conversations assigned to this member.
1320
- */
1321
- assigned_user_id?: string;
1322
2473
  };
1323
- url: '/conversations';
2474
+ url: '/conversations/{conversation_id}/messages';
1324
2475
  };
1325
- export type ListConversationsErrors = {
2476
+ export type ListMessagesErrors = {
1326
2477
  /**
1327
2478
  * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
1328
2479
  */
@@ -1335,6 +2486,10 @@ export type ListConversationsErrors = {
1335
2486
  * `insufficient_scope`: The key lacks the scope this operation requires.
1336
2487
  */
1337
2488
  403: Error;
2489
+ /**
2490
+ * `not_found`: The resource does not exist in this organization.
2491
+ */
2492
+ 404: Error;
1338
2493
  /**
1339
2494
  * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
1340
2495
  */
@@ -1344,33 +2499,38 @@ export type ListConversationsErrors = {
1344
2499
  */
1345
2500
  500: Error;
1346
2501
  };
1347
- export type ListConversationsError = ListConversationsErrors[keyof ListConversationsErrors];
1348
- export type ListConversationsResponses = {
2502
+ export type ListMessagesError = ListMessagesErrors[keyof ListMessagesErrors];
2503
+ export type ListMessagesResponses = {
1349
2504
  /**
1350
2505
  * Success.
1351
2506
  */
1352
2507
  200: {
1353
- data: Array<Conversation>;
2508
+ data: Array<Message>;
1354
2509
  /**
1355
2510
  * Pass as `cursor` for the next page; null on the last page.
1356
2511
  */
1357
2512
  next_cursor: string | null;
1358
2513
  };
1359
2514
  };
1360
- export type ListConversationsResponse = ListConversationsResponses[keyof ListConversationsResponses];
1361
- export type StartConversationData = {
1362
- body: StartConversation;
2515
+ export type ListMessagesResponse = ListMessagesResponses[keyof ListMessagesResponses];
2516
+ export type SendMessageData = {
2517
+ body: SendMessage;
1363
2518
  headers?: {
1364
2519
  /**
1365
2520
  * Optional. A value you choose, unique per logical write, 8–200 characters: a UUID or an ID from your system such as `order-10482-ready`. Retrying with the same key and body replays the first response instead of repeating the write.
1366
2521
  */
1367
2522
  'Idempotency-Key'?: string;
1368
2523
  };
1369
- path?: never;
2524
+ path: {
2525
+ /**
2526
+ * Conversation ID.
2527
+ */
2528
+ conversation_id: string;
2529
+ };
1370
2530
  query?: never;
1371
- url: '/conversations';
2531
+ url: '/conversations/{conversation_id}/messages';
1372
2532
  };
1373
- export type StartConversationErrors = {
2533
+ export type SendMessageErrors = {
1374
2534
  /**
1375
2535
  * `invalid_json`: The body is not valid JSON.
1376
2536
  *
@@ -1426,8 +2586,8 @@ export type StartConversationErrors = {
1426
2586
  */
1427
2587
  503: Error;
1428
2588
  };
1429
- export type StartConversationError = StartConversationErrors[keyof StartConversationErrors];
1430
- export type StartConversationResponses = {
2589
+ export type SendMessageError = SendMessageErrors[keyof SendMessageErrors];
2590
+ export type SendMessageResponses = {
1431
2591
  /**
1432
2592
  * Accepted.
1433
2593
  */
@@ -1435,19 +2595,23 @@ export type StartConversationResponses = {
1435
2595
  data: Send;
1436
2596
  };
1437
2597
  };
1438
- export type StartConversationResponse = StartConversationResponses[keyof StartConversationResponses];
1439
- export type GetConversationData = {
2598
+ export type SendMessageResponse = SendMessageResponses[keyof SendMessageResponses];
2599
+ export type GetMessageData = {
1440
2600
  body?: never;
1441
2601
  path: {
1442
2602
  /**
1443
2603
  * Conversation ID.
1444
2604
  */
1445
2605
  conversation_id: string;
2606
+ /**
2607
+ * Message ID.
2608
+ */
2609
+ message_id: string;
1446
2610
  };
1447
2611
  query?: never;
1448
- url: '/conversations/{conversation_id}';
2612
+ url: '/conversations/{conversation_id}/messages/{message_id}';
1449
2613
  };
1450
- export type GetConversationErrors = {
2614
+ export type GetMessageErrors = {
1451
2615
  /**
1452
2616
  * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
1453
2617
  */
@@ -1473,37 +2637,29 @@ export type GetConversationErrors = {
1473
2637
  */
1474
2638
  500: Error;
1475
2639
  };
1476
- export type GetConversationError = GetConversationErrors[keyof GetConversationErrors];
1477
- export type GetConversationResponses = {
2640
+ export type GetMessageError = GetMessageErrors[keyof GetMessageErrors];
2641
+ export type GetMessageResponses = {
1478
2642
  /**
1479
2643
  * Success.
1480
2644
  */
1481
2645
  200: {
1482
- data: Conversation;
2646
+ data: Message;
1483
2647
  };
1484
2648
  };
1485
- export type GetConversationResponse = GetConversationResponses[keyof GetConversationResponses];
1486
- export type AssignConversationData = {
1487
- body: AssignConversation;
1488
- headers?: {
1489
- /**
1490
- * Optional. A value you choose, unique per logical write, 8–200 characters: a UUID or an ID from your system such as `order-10482-ready`. Retrying with the same key and body replays the first response instead of repeating the write.
1491
- */
1492
- 'Idempotency-Key'?: string;
1493
- };
2649
+ export type GetMessageResponse = GetMessageResponses[keyof GetMessageResponses];
2650
+ export type GetSendData = {
2651
+ body?: never;
1494
2652
  path: {
1495
2653
  /**
1496
- * Conversation ID.
2654
+ * Send ID.
1497
2655
  */
1498
- conversation_id: string;
2656
+ send_id: string;
1499
2657
  };
1500
2658
  query?: never;
1501
- url: '/conversations/{conversation_id}/assignment';
2659
+ url: '/sends/{send_id}';
1502
2660
  };
1503
- export type AssignConversationErrors = {
2661
+ export type GetSendErrors = {
1504
2662
  /**
1505
- * `invalid_json`: The body is not valid JSON.
1506
- *
1507
2663
  * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
1508
2664
  */
1509
2665
  400: Error;
@@ -1519,24 +2675,6 @@ export type AssignConversationErrors = {
1519
2675
  * `not_found`: The resource does not exist in this organization.
1520
2676
  */
1521
2677
  404: Error;
1522
- /**
1523
- * `idempotency_conflict`: The `Idempotency-Key` was used for a different request.
1524
- *
1525
- * `request_processing`: A request with this `Idempotency-Key` is still processing or ended in an unknown state.
1526
- */
1527
- 409: Error;
1528
- /**
1529
- * `body_too_large`: The JSON body exceeds 64 KiB.
1530
- */
1531
- 413: Error;
1532
- /**
1533
- * `unsupported_media_type`: The body must be `application/json`.
1534
- */
1535
- 415: Error;
1536
- /**
1537
- * `rule_violation`: The request breaks a business rule; `message` says which.
1538
- */
1539
- 422: Error;
1540
2678
  /**
1541
2679
  * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
1542
2680
  */
@@ -1546,40 +2684,23 @@ export type AssignConversationErrors = {
1546
2684
  */
1547
2685
  500: Error;
1548
2686
  };
1549
- export type AssignConversationError = AssignConversationErrors[keyof AssignConversationErrors];
1550
- export type AssignConversationResponses = {
2687
+ export type GetSendError = GetSendErrors[keyof GetSendErrors];
2688
+ export type GetSendResponses = {
1551
2689
  /**
1552
2690
  * Success.
1553
2691
  */
1554
2692
  200: {
1555
- data: Conversation;
2693
+ data: Send;
1556
2694
  };
1557
2695
  };
1558
- export type AssignConversationResponse = AssignConversationResponses[keyof AssignConversationResponses];
1559
- export type CloseConversationData = {
1560
- body: CloseConversation;
1561
- headers?: {
1562
- /**
1563
- * Optional. A value you choose, unique per logical write, 8–200 characters: a UUID or an ID from your system such as `order-10482-ready`. Retrying with the same key and body replays the first response instead of repeating the write.
1564
- */
1565
- 'Idempotency-Key'?: string;
1566
- };
1567
- path: {
1568
- /**
1569
- * Conversation ID.
1570
- */
1571
- conversation_id: string;
1572
- };
2696
+ export type GetSendResponse = GetSendResponses[keyof GetSendResponses];
2697
+ export type ListChannelsData = {
2698
+ body?: never;
2699
+ path?: never;
1573
2700
  query?: never;
1574
- url: '/conversations/{conversation_id}/close';
2701
+ url: '/channels';
1575
2702
  };
1576
- export type CloseConversationErrors = {
1577
- /**
1578
- * `invalid_json`: The body is not valid JSON.
1579
- *
1580
- * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
1581
- */
1582
- 400: Error;
2703
+ export type ListChannelsErrors = {
1583
2704
  /**
1584
2705
  * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
1585
2706
  */
@@ -1588,24 +2709,6 @@ export type CloseConversationErrors = {
1588
2709
  * `insufficient_scope`: The key lacks the scope this operation requires.
1589
2710
  */
1590
2711
  403: Error;
1591
- /**
1592
- * `not_found`: The resource does not exist in this organization.
1593
- */
1594
- 404: Error;
1595
- /**
1596
- * `idempotency_conflict`: The `Idempotency-Key` was used for a different request.
1597
- *
1598
- * `request_processing`: A request with this `Idempotency-Key` is still processing or ended in an unknown state.
1599
- */
1600
- 409: Error;
1601
- /**
1602
- * `body_too_large`: The JSON body exceeds 64 KiB.
1603
- */
1604
- 413: Error;
1605
- /**
1606
- * `unsupported_media_type`: The body must be `application/json`.
1607
- */
1608
- 415: Error;
1609
2712
  /**
1610
2713
  * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
1611
2714
  */
@@ -1615,38 +2718,27 @@ export type CloseConversationErrors = {
1615
2718
  */
1616
2719
  500: Error;
1617
2720
  };
1618
- export type CloseConversationError = CloseConversationErrors[keyof CloseConversationErrors];
1619
- export type CloseConversationResponses = {
2721
+ export type ListChannelsError = ListChannelsErrors[keyof ListChannelsErrors];
2722
+ export type ListChannelsResponses = {
1620
2723
  /**
1621
2724
  * Success.
1622
2725
  */
1623
2726
  200: {
1624
- data: Conversation;
1625
- };
1626
- };
1627
- export type CloseConversationResponse = CloseConversationResponses[keyof CloseConversationResponses];
1628
- export type ReopenConversationData = {
1629
- body?: never;
1630
- headers?: {
1631
- /**
1632
- * Optional. A value you choose, unique per logical write, 8–200 characters: a UUID or an ID from your system such as `order-10482-ready`. Retrying with the same key and body replays the first response instead of repeating the write.
1633
- */
1634
- 'Idempotency-Key'?: string;
1635
- };
1636
- path: {
2727
+ data: Array<Channel>;
1637
2728
  /**
1638
- * Conversation ID.
2729
+ * Pass as `cursor` for the next page; null on the last page.
1639
2730
  */
1640
- conversation_id: string;
2731
+ next_cursor: string | null;
1641
2732
  };
2733
+ };
2734
+ export type ListChannelsResponse = ListChannelsResponses[keyof ListChannelsResponses];
2735
+ export type ListMembersData = {
2736
+ body?: never;
2737
+ path?: never;
1642
2738
  query?: never;
1643
- url: '/conversations/{conversation_id}/reopen';
2739
+ url: '/members';
1644
2740
  };
1645
- export type ReopenConversationErrors = {
1646
- /**
1647
- * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
1648
- */
1649
- 400: Error;
2741
+ export type ListMembersErrors = {
1650
2742
  /**
1651
2743
  * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
1652
2744
  */
@@ -1655,16 +2747,6 @@ export type ReopenConversationErrors = {
1655
2747
  * `insufficient_scope`: The key lacks the scope this operation requires.
1656
2748
  */
1657
2749
  403: Error;
1658
- /**
1659
- * `not_found`: The resource does not exist in this organization.
1660
- */
1661
- 404: Error;
1662
- /**
1663
- * `idempotency_conflict`: The `Idempotency-Key` was used for a different request.
1664
- *
1665
- * `request_processing`: A request with this `Idempotency-Key` is still processing or ended in an unknown state.
1666
- */
1667
- 409: Error;
1668
2750
  /**
1669
2751
  * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
1670
2752
  */
@@ -1674,37 +2756,27 @@ export type ReopenConversationErrors = {
1674
2756
  */
1675
2757
  500: Error;
1676
2758
  };
1677
- export type ReopenConversationError = ReopenConversationErrors[keyof ReopenConversationErrors];
1678
- export type ReopenConversationResponses = {
2759
+ export type ListMembersError = ListMembersErrors[keyof ListMembersErrors];
2760
+ export type ListMembersResponses = {
1679
2761
  /**
1680
2762
  * Success.
1681
2763
  */
1682
2764
  200: {
1683
- data: Conversation;
1684
- };
1685
- };
1686
- export type ReopenConversationResponse = ReopenConversationResponses[keyof ReopenConversationResponses];
1687
- export type ListMessagesData = {
1688
- body?: never;
1689
- path: {
1690
- /**
1691
- * Conversation ID.
1692
- */
1693
- conversation_id: string;
1694
- };
1695
- query?: {
2765
+ data: Array<Member>;
1696
2766
  /**
1697
- * `next_cursor` from the previous page. Use it unchanged.
2767
+ * Pass as `cursor` for the next page; null on the last page.
1698
2768
  */
1699
- cursor?: string;
2769
+ next_cursor: string | null;
1700
2770
  };
1701
- url: '/conversations/{conversation_id}/messages';
1702
2771
  };
1703
- export type ListMessagesErrors = {
1704
- /**
1705
- * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
1706
- */
1707
- 400: Error;
2772
+ export type ListMembersResponse = ListMembersResponses[keyof ListMembersResponses];
2773
+ export type ListTagsData = {
2774
+ body?: never;
2775
+ path?: never;
2776
+ query?: never;
2777
+ url: '/tags';
2778
+ };
2779
+ export type ListTagsErrors = {
1708
2780
  /**
1709
2781
  * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
1710
2782
  */
@@ -1713,10 +2785,6 @@ export type ListMessagesErrors = {
1713
2785
  * `insufficient_scope`: The key lacks the scope this operation requires.
1714
2786
  */
1715
2787
  403: Error;
1716
- /**
1717
- * `not_found`: The resource does not exist in this organization.
1718
- */
1719
- 404: Error;
1720
2788
  /**
1721
2789
  * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
1722
2790
  */
@@ -1726,38 +2794,33 @@ export type ListMessagesErrors = {
1726
2794
  */
1727
2795
  500: Error;
1728
2796
  };
1729
- export type ListMessagesError = ListMessagesErrors[keyof ListMessagesErrors];
1730
- export type ListMessagesResponses = {
2797
+ export type ListTagsError = ListTagsErrors[keyof ListTagsErrors];
2798
+ export type ListTagsResponses = {
1731
2799
  /**
1732
2800
  * Success.
1733
2801
  */
1734
2802
  200: {
1735
- data: Array<Message>;
2803
+ data: Array<Tag>;
1736
2804
  /**
1737
2805
  * Pass as `cursor` for the next page; null on the last page.
1738
2806
  */
1739
2807
  next_cursor: string | null;
1740
2808
  };
1741
2809
  };
1742
- export type ListMessagesResponse = ListMessagesResponses[keyof ListMessagesResponses];
1743
- export type SendMessageData = {
1744
- body: SendMessage;
2810
+ export type ListTagsResponse = ListTagsResponses[keyof ListTagsResponses];
2811
+ export type CreateTagData = {
2812
+ body: CreateTag;
1745
2813
  headers?: {
1746
2814
  /**
1747
2815
  * Optional. A value you choose, unique per logical write, 8–200 characters: a UUID or an ID from your system such as `order-10482-ready`. Retrying with the same key and body replays the first response instead of repeating the write.
1748
2816
  */
1749
2817
  'Idempotency-Key'?: string;
1750
2818
  };
1751
- path: {
1752
- /**
1753
- * Conversation ID.
1754
- */
1755
- conversation_id: string;
1756
- };
2819
+ path?: never;
1757
2820
  query?: never;
1758
- url: '/conversations/{conversation_id}/messages';
2821
+ url: '/tags';
1759
2822
  };
1760
- export type SendMessageErrors = {
2823
+ export type CreateTagErrors = {
1761
2824
  /**
1762
2825
  * `invalid_json`: The body is not valid JSON.
1763
2826
  *
@@ -1772,14 +2835,12 @@ export type SendMessageErrors = {
1772
2835
  * `insufficient_scope`: The key lacks the scope this operation requires.
1773
2836
  */
1774
2837
  403: Error;
1775
- /**
1776
- * `not_found`: The resource does not exist in this organization.
1777
- */
1778
- 404: Error;
1779
2838
  /**
1780
2839
  * `idempotency_conflict`: The `Idempotency-Key` was used for a different request.
1781
2840
  *
1782
2841
  * `request_processing`: A request with this `Idempotency-Key` is still processing or ended in an unknown state.
2842
+ *
2843
+ * `conflict`: The resource changed in a way that prevents the operation.
1783
2844
  */
1784
2845
  409: Error;
1785
2846
  /**
@@ -1791,11 +2852,39 @@ export type SendMessageErrors = {
1791
2852
  */
1792
2853
  415: Error;
1793
2854
  /**
1794
- * `outside_messaging_window`: The channel only allows free-form text inside its reply window; send a template.
1795
- *
1796
- * `rule_violation`: The request breaks a business rule; `message` says which.
2855
+ * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
1797
2856
  */
1798
- 422: Error;
2857
+ 429: Error;
2858
+ /**
2859
+ * `internal_error`: Ricky failed. Retry a read. Before retrying a write, read the resource: the same `Idempotency-Key` answers `request_processing`.
2860
+ */
2861
+ 500: Error;
2862
+ };
2863
+ export type CreateTagError = CreateTagErrors[keyof CreateTagErrors];
2864
+ export type CreateTagResponses = {
2865
+ /**
2866
+ * Success.
2867
+ */
2868
+ 201: {
2869
+ data: Tag;
2870
+ };
2871
+ };
2872
+ export type CreateTagResponse = CreateTagResponses[keyof CreateTagResponses];
2873
+ export type ListTemplatesData = {
2874
+ body?: never;
2875
+ path?: never;
2876
+ query?: never;
2877
+ url: '/templates';
2878
+ };
2879
+ export type ListTemplatesErrors = {
2880
+ /**
2881
+ * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
2882
+ */
2883
+ 401: Error;
2884
+ /**
2885
+ * `insufficient_scope`: The key lacks the scope this operation requires.
2886
+ */
2887
+ 403: Error;
1799
2888
  /**
1800
2889
  * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
1801
2890
  */
@@ -1808,41 +2897,28 @@ export type SendMessageErrors = {
1808
2897
  * `upstream_error`: The messaging provider failed. Retry later.
1809
2898
  */
1810
2899
  502: Error;
1811
- /**
1812
- * `unavailable`: A dependency is temporarily unavailable. Retry later.
1813
- */
1814
- 503: Error;
1815
2900
  };
1816
- export type SendMessageError = SendMessageErrors[keyof SendMessageErrors];
1817
- export type SendMessageResponses = {
2901
+ export type ListTemplatesError = ListTemplatesErrors[keyof ListTemplatesErrors];
2902
+ export type ListTemplatesResponses = {
1818
2903
  /**
1819
- * Accepted.
2904
+ * Success.
1820
2905
  */
1821
- 202: {
1822
- data: Send;
1823
- };
1824
- };
1825
- export type SendMessageResponse = SendMessageResponses[keyof SendMessageResponses];
1826
- export type GetMessageData = {
1827
- body?: never;
1828
- path: {
1829
- /**
1830
- * Conversation ID.
1831
- */
1832
- conversation_id: string;
2906
+ 200: {
2907
+ data: Array<Template>;
1833
2908
  /**
1834
- * Message ID.
2909
+ * Pass as `cursor` for the next page; null on the last page.
1835
2910
  */
1836
- message_id: string;
2911
+ next_cursor: string | null;
1837
2912
  };
2913
+ };
2914
+ export type ListTemplatesResponse = ListTemplatesResponses[keyof ListTemplatesResponses];
2915
+ export type ListWebhooksData = {
2916
+ body?: never;
2917
+ path?: never;
1838
2918
  query?: never;
1839
- url: '/conversations/{conversation_id}/messages/{message_id}';
2919
+ url: '/webhooks';
1840
2920
  };
1841
- export type GetMessageErrors = {
1842
- /**
1843
- * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
1844
- */
1845
- 400: Error;
2921
+ export type ListWebhooksErrors = {
1846
2922
  /**
1847
2923
  * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
1848
2924
  */
@@ -1851,10 +2927,6 @@ export type GetMessageErrors = {
1851
2927
  * `insufficient_scope`: The key lacks the scope this operation requires.
1852
2928
  */
1853
2929
  403: Error;
1854
- /**
1855
- * `not_found`: The resource does not exist in this organization.
1856
- */
1857
- 404: Error;
1858
2930
  /**
1859
2931
  * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
1860
2932
  */
@@ -1864,29 +2936,30 @@ export type GetMessageErrors = {
1864
2936
  */
1865
2937
  500: Error;
1866
2938
  };
1867
- export type GetMessageError = GetMessageErrors[keyof GetMessageErrors];
1868
- export type GetMessageResponses = {
2939
+ export type ListWebhooksError = ListWebhooksErrors[keyof ListWebhooksErrors];
2940
+ export type ListWebhooksResponses = {
1869
2941
  /**
1870
2942
  * Success.
1871
2943
  */
1872
2944
  200: {
1873
- data: Message;
1874
- };
1875
- };
1876
- export type GetMessageResponse = GetMessageResponses[keyof GetMessageResponses];
1877
- export type GetSendData = {
1878
- body?: never;
1879
- path: {
2945
+ data: Array<Webhook>;
1880
2946
  /**
1881
- * Send ID.
2947
+ * Pass as `cursor` for the next page; null on the last page.
1882
2948
  */
1883
- send_id: string;
2949
+ next_cursor: string | null;
1884
2950
  };
2951
+ };
2952
+ export type ListWebhooksResponse = ListWebhooksResponses[keyof ListWebhooksResponses];
2953
+ export type CreateWebhookData = {
2954
+ body: CreateWebhook;
2955
+ path?: never;
1885
2956
  query?: never;
1886
- url: '/sends/{send_id}';
2957
+ url: '/webhooks';
1887
2958
  };
1888
- export type GetSendErrors = {
2959
+ export type CreateWebhookErrors = {
1889
2960
  /**
2961
+ * `invalid_json`: The body is not valid JSON.
2962
+ *
1890
2963
  * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
1891
2964
  */
1892
2965
  400: Error;
@@ -1899,9 +2972,13 @@ export type GetSendErrors = {
1899
2972
  */
1900
2973
  403: Error;
1901
2974
  /**
1902
- * `not_found`: The resource does not exist in this organization.
2975
+ * `body_too_large`: The JSON body exceeds 64 KiB.
1903
2976
  */
1904
- 404: Error;
2977
+ 413: Error;
2978
+ /**
2979
+ * `unsupported_media_type`: The body must be `application/json`.
2980
+ */
2981
+ 415: Error;
1905
2982
  /**
1906
2983
  * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
1907
2984
  */
@@ -1911,23 +2988,32 @@ export type GetSendErrors = {
1911
2988
  */
1912
2989
  500: Error;
1913
2990
  };
1914
- export type GetSendError = GetSendErrors[keyof GetSendErrors];
1915
- export type GetSendResponses = {
2991
+ export type CreateWebhookError = CreateWebhookErrors[keyof CreateWebhookErrors];
2992
+ export type CreateWebhookResponses = {
1916
2993
  /**
1917
2994
  * Success.
1918
2995
  */
1919
- 200: {
1920
- data: Send;
2996
+ 201: {
2997
+ data: CreatedWebhook;
1921
2998
  };
1922
2999
  };
1923
- export type GetSendResponse = GetSendResponses[keyof GetSendResponses];
1924
- export type ListChannelsData = {
3000
+ export type CreateWebhookResponse = CreateWebhookResponses[keyof CreateWebhookResponses];
3001
+ export type DisableWebhookData = {
1925
3002
  body?: never;
1926
- path?: never;
3003
+ path: {
3004
+ /**
3005
+ * Webhook ID.
3006
+ */
3007
+ webhook_id: string;
3008
+ };
1927
3009
  query?: never;
1928
- url: '/channels';
3010
+ url: '/webhooks/{webhook_id}';
1929
3011
  };
1930
- export type ListChannelsErrors = {
3012
+ export type DisableWebhookErrors = {
3013
+ /**
3014
+ * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
3015
+ */
3016
+ 400: Error;
1931
3017
  /**
1932
3018
  * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
1933
3019
  */
@@ -1936,6 +3022,10 @@ export type ListChannelsErrors = {
1936
3022
  * `insufficient_scope`: The key lacks the scope this operation requires.
1937
3023
  */
1938
3024
  403: Error;
3025
+ /**
3026
+ * `not_found`: The resource does not exist in this organization.
3027
+ */
3028
+ 404: Error;
1939
3029
  /**
1940
3030
  * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
1941
3031
  */
@@ -1945,27 +3035,32 @@ export type ListChannelsErrors = {
1945
3035
  */
1946
3036
  500: Error;
1947
3037
  };
1948
- export type ListChannelsError = ListChannelsErrors[keyof ListChannelsErrors];
1949
- export type ListChannelsResponses = {
3038
+ export type DisableWebhookError = DisableWebhookErrors[keyof DisableWebhookErrors];
3039
+ export type DisableWebhookResponses = {
1950
3040
  /**
1951
3041
  * Success.
1952
3042
  */
1953
3043
  200: {
1954
- data: Array<Channel>;
1955
- /**
1956
- * Pass as `cursor` for the next page; null on the last page.
1957
- */
1958
- next_cursor: string | null;
3044
+ data: Webhook;
1959
3045
  };
1960
3046
  };
1961
- export type ListChannelsResponse = ListChannelsResponses[keyof ListChannelsResponses];
1962
- export type ListMembersData = {
3047
+ export type DisableWebhookResponse = DisableWebhookResponses[keyof DisableWebhookResponses];
3048
+ export type TestWebhookData = {
1963
3049
  body?: never;
1964
- path?: never;
3050
+ path: {
3051
+ /**
3052
+ * Webhook ID.
3053
+ */
3054
+ webhook_id: string;
3055
+ };
1965
3056
  query?: never;
1966
- url: '/members';
3057
+ url: '/webhooks/{webhook_id}/test';
1967
3058
  };
1968
- export type ListMembersErrors = {
3059
+ export type TestWebhookErrors = {
3060
+ /**
3061
+ * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
3062
+ */
3063
+ 400: Error;
1969
3064
  /**
1970
3065
  * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
1971
3066
  */
@@ -1974,6 +3069,10 @@ export type ListMembersErrors = {
1974
3069
  * `insufficient_scope`: The key lacks the scope this operation requires.
1975
3070
  */
1976
3071
  403: Error;
3072
+ /**
3073
+ * `not_found`: The resource does not exist in this organization.
3074
+ */
3075
+ 404: Error;
1977
3076
  /**
1978
3077
  * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
1979
3078
  */
@@ -1983,35 +3082,54 @@ export type ListMembersErrors = {
1983
3082
  */
1984
3083
  500: Error;
1985
3084
  };
1986
- export type ListMembersError = ListMembersErrors[keyof ListMembersErrors];
1987
- export type ListMembersResponses = {
3085
+ export type TestWebhookError = TestWebhookErrors[keyof TestWebhookErrors];
3086
+ export type TestWebhookResponses = {
1988
3087
  /**
1989
3088
  * Success.
1990
3089
  */
1991
3090
  200: {
1992
- data: Array<Member>;
3091
+ data: WebhookTestResult;
3092
+ };
3093
+ };
3094
+ export type TestWebhookResponse = TestWebhookResponses[keyof TestWebhookResponses];
3095
+ export type RotateWebhookSecretData = {
3096
+ body: RotateWebhookSecret;
3097
+ path: {
1993
3098
  /**
1994
- * Pass as `cursor` for the next page; null on the last page.
3099
+ * Webhook ID.
1995
3100
  */
1996
- next_cursor: string | null;
3101
+ webhook_id: string;
1997
3102
  };
1998
- };
1999
- export type ListMembersResponse = ListMembersResponses[keyof ListMembersResponses];
2000
- export type ListTagsData = {
2001
- body?: never;
2002
- path?: never;
2003
3103
  query?: never;
2004
- url: '/tags';
3104
+ url: '/webhooks/{webhook_id}/rotate-secret';
2005
3105
  };
2006
- export type ListTagsErrors = {
3106
+ export type RotateWebhookSecretErrors = {
3107
+ /**
3108
+ * `invalid_json`: The body is not valid JSON.
3109
+ *
3110
+ * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
3111
+ */
3112
+ 400: Error;
3113
+ /**
3114
+ * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
3115
+ */
3116
+ 401: Error;
3117
+ /**
3118
+ * `insufficient_scope`: The key lacks the scope this operation requires.
3119
+ */
3120
+ 403: Error;
3121
+ /**
3122
+ * `not_found`: The resource does not exist in this organization.
3123
+ */
3124
+ 404: Error;
2007
3125
  /**
2008
- * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
3126
+ * `body_too_large`: The JSON body exceeds 64 KiB.
2009
3127
  */
2010
- 401: Error;
3128
+ 413: Error;
2011
3129
  /**
2012
- * `insufficient_scope`: The key lacks the scope this operation requires.
3130
+ * `unsupported_media_type`: The body must be `application/json`.
2013
3131
  */
2014
- 403: Error;
3132
+ 415: Error;
2015
3133
  /**
2016
3134
  * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
2017
3135
  */
@@ -2021,36 +3139,29 @@ export type ListTagsErrors = {
2021
3139
  */
2022
3140
  500: Error;
2023
3141
  };
2024
- export type ListTagsError = ListTagsErrors[keyof ListTagsErrors];
2025
- export type ListTagsResponses = {
3142
+ export type RotateWebhookSecretError = RotateWebhookSecretErrors[keyof RotateWebhookSecretErrors];
3143
+ export type RotateWebhookSecretResponses = {
2026
3144
  /**
2027
3145
  * Success.
2028
3146
  */
2029
3147
  200: {
2030
- data: Array<Tag>;
2031
- /**
2032
- * Pass as `cursor` for the next page; null on the last page.
2033
- */
2034
- next_cursor: string | null;
3148
+ data: CreatedWebhook;
2035
3149
  };
2036
3150
  };
2037
- export type ListTagsResponse = ListTagsResponses[keyof ListTagsResponses];
2038
- export type CreateTagData = {
2039
- body: CreateTag;
2040
- headers?: {
3151
+ export type RotateWebhookSecretResponse = RotateWebhookSecretResponses[keyof RotateWebhookSecretResponses];
3152
+ export type ListWebhookDeliveriesData = {
3153
+ body?: never;
3154
+ path: {
2041
3155
  /**
2042
- * Optional. A value you choose, unique per logical write, 8–200 characters: a UUID or an ID from your system such as `order-10482-ready`. Retrying with the same key and body replays the first response instead of repeating the write.
3156
+ * Webhook ID.
2043
3157
  */
2044
- 'Idempotency-Key'?: string;
3158
+ webhook_id: string;
2045
3159
  };
2046
- path?: never;
2047
3160
  query?: never;
2048
- url: '/tags';
3161
+ url: '/webhooks/{webhook_id}/deliveries';
2049
3162
  };
2050
- export type CreateTagErrors = {
3163
+ export type ListWebhookDeliveriesErrors = {
2051
3164
  /**
2052
- * `invalid_json`: The body is not valid JSON.
2053
- *
2054
3165
  * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
2055
3166
  */
2056
3167
  400: Error;
@@ -2063,21 +3174,9 @@ export type CreateTagErrors = {
2063
3174
  */
2064
3175
  403: Error;
2065
3176
  /**
2066
- * `idempotency_conflict`: The `Idempotency-Key` was used for a different request.
2067
- *
2068
- * `request_processing`: A request with this `Idempotency-Key` is still processing or ended in an unknown state.
2069
- *
2070
- * `conflict`: The resource changed in a way that prevents the operation.
2071
- */
2072
- 409: Error;
2073
- /**
2074
- * `body_too_large`: The JSON body exceeds 64 KiB.
2075
- */
2076
- 413: Error;
2077
- /**
2078
- * `unsupported_media_type`: The body must be `application/json`.
3177
+ * `not_found`: The resource does not exist in this organization.
2079
3178
  */
2080
- 415: Error;
3179
+ 404: Error;
2081
3180
  /**
2082
3181
  * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
2083
3182
  */
@@ -2087,23 +3186,40 @@ export type CreateTagErrors = {
2087
3186
  */
2088
3187
  500: Error;
2089
3188
  };
2090
- export type CreateTagError = CreateTagErrors[keyof CreateTagErrors];
2091
- export type CreateTagResponses = {
3189
+ export type ListWebhookDeliveriesError = ListWebhookDeliveriesErrors[keyof ListWebhookDeliveriesErrors];
3190
+ export type ListWebhookDeliveriesResponses = {
2092
3191
  /**
2093
3192
  * Success.
2094
3193
  */
2095
- 201: {
2096
- data: Tag;
3194
+ 200: {
3195
+ data: Array<WebhookDelivery>;
3196
+ /**
3197
+ * Pass as `cursor` for the next page; null on the last page.
3198
+ */
3199
+ next_cursor: string | null;
2097
3200
  };
2098
3201
  };
2099
- export type CreateTagResponse = CreateTagResponses[keyof CreateTagResponses];
2100
- export type ListTemplatesData = {
3202
+ export type ListWebhookDeliveriesResponse = ListWebhookDeliveriesResponses[keyof ListWebhookDeliveriesResponses];
3203
+ export type RetryWebhookDeliveryData = {
2101
3204
  body?: never;
2102
- path?: never;
3205
+ path: {
3206
+ /**
3207
+ * Webhook ID.
3208
+ */
3209
+ webhook_id: string;
3210
+ /**
3211
+ * Delivery ID.
3212
+ */
3213
+ delivery_id: string;
3214
+ };
2103
3215
  query?: never;
2104
- url: '/templates';
3216
+ url: '/webhooks/{webhook_id}/deliveries/{delivery_id}/retry';
2105
3217
  };
2106
- export type ListTemplatesErrors = {
3218
+ export type RetryWebhookDeliveryErrors = {
3219
+ /**
3220
+ * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
3221
+ */
3222
+ 400: Error;
2107
3223
  /**
2108
3224
  * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
2109
3225
  */
@@ -2112,6 +3228,10 @@ export type ListTemplatesErrors = {
2112
3228
  * `insufficient_scope`: The key lacks the scope this operation requires.
2113
3229
  */
2114
3230
  403: Error;
3231
+ /**
3232
+ * `not_found`: The resource does not exist in this organization.
3233
+ */
3234
+ 404: Error;
2115
3235
  /**
2116
3236
  * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
2117
3237
  */
@@ -2120,32 +3240,24 @@ export type ListTemplatesErrors = {
2120
3240
  * `internal_error`: Ricky failed. Retry a read. Before retrying a write, read the resource: the same `Idempotency-Key` answers `request_processing`.
2121
3241
  */
2122
3242
  500: Error;
2123
- /**
2124
- * `upstream_error`: The messaging provider failed. Retry later.
2125
- */
2126
- 502: Error;
2127
3243
  };
2128
- export type ListTemplatesError = ListTemplatesErrors[keyof ListTemplatesErrors];
2129
- export type ListTemplatesResponses = {
3244
+ export type RetryWebhookDeliveryError = RetryWebhookDeliveryErrors[keyof RetryWebhookDeliveryErrors];
3245
+ export type RetryWebhookDeliveryResponses = {
2130
3246
  /**
2131
3247
  * Success.
2132
3248
  */
2133
3249
  200: {
2134
- data: Array<Template>;
2135
- /**
2136
- * Pass as `cursor` for the next page; null on the last page.
2137
- */
2138
- next_cursor: string | null;
3250
+ data: WebhookDelivery;
2139
3251
  };
2140
3252
  };
2141
- export type ListTemplatesResponse = ListTemplatesResponses[keyof ListTemplatesResponses];
2142
- export type ListWebhooksData = {
3253
+ export type RetryWebhookDeliveryResponse = RetryWebhookDeliveryResponses[keyof RetryWebhookDeliveryResponses];
3254
+ export type ListWorkflowsData = {
2143
3255
  body?: never;
2144
3256
  path?: never;
2145
3257
  query?: never;
2146
- url: '/webhooks';
3258
+ url: '/workflows';
2147
3259
  };
2148
- export type ListWebhooksErrors = {
3260
+ export type ListWorkflowsErrors = {
2149
3261
  /**
2150
3262
  * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
2151
3263
  */
@@ -2163,27 +3275,33 @@ export type ListWebhooksErrors = {
2163
3275
  */
2164
3276
  500: Error;
2165
3277
  };
2166
- export type ListWebhooksError = ListWebhooksErrors[keyof ListWebhooksErrors];
2167
- export type ListWebhooksResponses = {
3278
+ export type ListWorkflowsError = ListWorkflowsErrors[keyof ListWorkflowsErrors];
3279
+ export type ListWorkflowsResponses = {
2168
3280
  /**
2169
3281
  * Success.
2170
3282
  */
2171
3283
  200: {
2172
- data: Array<Webhook>;
3284
+ data: Array<Workflow>;
2173
3285
  /**
2174
3286
  * Pass as `cursor` for the next page; null on the last page.
2175
3287
  */
2176
3288
  next_cursor: string | null;
2177
3289
  };
2178
3290
  };
2179
- export type ListWebhooksResponse = ListWebhooksResponses[keyof ListWebhooksResponses];
2180
- export type CreateWebhookData = {
2181
- body: CreateWebhook;
3291
+ export type ListWorkflowsResponse = ListWorkflowsResponses[keyof ListWorkflowsResponses];
3292
+ export type CreateWorkflowData = {
3293
+ body: CreateWorkflow;
3294
+ headers?: {
3295
+ /**
3296
+ * Optional. A value you choose, unique per logical write, 8–200 characters: a UUID or an ID from your system such as `order-10482-ready`. Retrying with the same key and body replays the first response instead of repeating the write.
3297
+ */
3298
+ 'Idempotency-Key'?: string;
3299
+ };
2182
3300
  path?: never;
2183
3301
  query?: never;
2184
- url: '/webhooks';
3302
+ url: '/workflows';
2185
3303
  };
2186
- export type CreateWebhookErrors = {
3304
+ export type CreateWorkflowErrors = {
2187
3305
  /**
2188
3306
  * `invalid_json`: The body is not valid JSON.
2189
3307
  *
@@ -2198,6 +3316,12 @@ export type CreateWebhookErrors = {
2198
3316
  * `insufficient_scope`: The key lacks the scope this operation requires.
2199
3317
  */
2200
3318
  403: Error;
3319
+ /**
3320
+ * `idempotency_conflict`: The `Idempotency-Key` was used for a different request.
3321
+ *
3322
+ * `request_processing`: A request with this `Idempotency-Key` is still processing or ended in an unknown state.
3323
+ */
3324
+ 409: Error;
2201
3325
  /**
2202
3326
  * `body_too_large`: The JSON body exceeds 64 KiB.
2203
3327
  */
@@ -2215,28 +3339,28 @@ export type CreateWebhookErrors = {
2215
3339
  */
2216
3340
  500: Error;
2217
3341
  };
2218
- export type CreateWebhookError = CreateWebhookErrors[keyof CreateWebhookErrors];
2219
- export type CreateWebhookResponses = {
3342
+ export type CreateWorkflowError = CreateWorkflowErrors[keyof CreateWorkflowErrors];
3343
+ export type CreateWorkflowResponses = {
2220
3344
  /**
2221
3345
  * Success.
2222
3346
  */
2223
3347
  201: {
2224
- data: CreatedWebhook;
3348
+ data: Workflow;
2225
3349
  };
2226
3350
  };
2227
- export type CreateWebhookResponse = CreateWebhookResponses[keyof CreateWebhookResponses];
2228
- export type DisableWebhookData = {
3351
+ export type CreateWorkflowResponse = CreateWorkflowResponses[keyof CreateWorkflowResponses];
3352
+ export type DeleteWorkflowData = {
2229
3353
  body?: never;
2230
3354
  path: {
2231
3355
  /**
2232
- * Webhook ID.
3356
+ * Workflow ID.
2233
3357
  */
2234
- webhook_id: string;
3358
+ workflow_id: string;
2235
3359
  };
2236
3360
  query?: never;
2237
- url: '/webhooks/{webhook_id}';
3361
+ url: '/workflows/{workflow_id}';
2238
3362
  };
2239
- export type DisableWebhookErrors = {
3363
+ export type DeleteWorkflowErrors = {
2240
3364
  /**
2241
3365
  * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
2242
3366
  */
@@ -2262,28 +3386,28 @@ export type DisableWebhookErrors = {
2262
3386
  */
2263
3387
  500: Error;
2264
3388
  };
2265
- export type DisableWebhookError = DisableWebhookErrors[keyof DisableWebhookErrors];
2266
- export type DisableWebhookResponses = {
3389
+ export type DeleteWorkflowError = DeleteWorkflowErrors[keyof DeleteWorkflowErrors];
3390
+ export type DeleteWorkflowResponses = {
2267
3391
  /**
2268
3392
  * Success.
2269
3393
  */
2270
3394
  200: {
2271
- data: Webhook;
3395
+ data: Workflow;
2272
3396
  };
2273
3397
  };
2274
- export type DisableWebhookResponse = DisableWebhookResponses[keyof DisableWebhookResponses];
2275
- export type TestWebhookData = {
3398
+ export type DeleteWorkflowResponse = DeleteWorkflowResponses[keyof DeleteWorkflowResponses];
3399
+ export type GetWorkflowData = {
2276
3400
  body?: never;
2277
3401
  path: {
2278
3402
  /**
2279
- * Webhook ID.
3403
+ * Workflow ID.
2280
3404
  */
2281
- webhook_id: string;
3405
+ workflow_id: string;
2282
3406
  };
2283
3407
  query?: never;
2284
- url: '/webhooks/{webhook_id}/test';
3408
+ url: '/workflows/{workflow_id}';
2285
3409
  };
2286
- export type TestWebhookErrors = {
3410
+ export type GetWorkflowErrors = {
2287
3411
  /**
2288
3412
  * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
2289
3413
  */
@@ -2309,28 +3433,34 @@ export type TestWebhookErrors = {
2309
3433
  */
2310
3434
  500: Error;
2311
3435
  };
2312
- export type TestWebhookError = TestWebhookErrors[keyof TestWebhookErrors];
2313
- export type TestWebhookResponses = {
3436
+ export type GetWorkflowError = GetWorkflowErrors[keyof GetWorkflowErrors];
3437
+ export type GetWorkflowResponses = {
2314
3438
  /**
2315
3439
  * Success.
2316
3440
  */
2317
3441
  200: {
2318
- data: WebhookTestResult;
3442
+ data: Workflow;
2319
3443
  };
2320
3444
  };
2321
- export type TestWebhookResponse = TestWebhookResponses[keyof TestWebhookResponses];
2322
- export type RotateWebhookSecretData = {
2323
- body: RotateWebhookSecret;
3445
+ export type GetWorkflowResponse = GetWorkflowResponses[keyof GetWorkflowResponses];
3446
+ export type UpdateWorkflowData = {
3447
+ body: UpdateWorkflow;
3448
+ headers?: {
3449
+ /**
3450
+ * Optional. A value you choose, unique per logical write, 8–200 characters: a UUID or an ID from your system such as `order-10482-ready`. Retrying with the same key and body replays the first response instead of repeating the write.
3451
+ */
3452
+ 'Idempotency-Key'?: string;
3453
+ };
2324
3454
  path: {
2325
3455
  /**
2326
- * Webhook ID.
3456
+ * Workflow ID.
2327
3457
  */
2328
- webhook_id: string;
3458
+ workflow_id: string;
2329
3459
  };
2330
3460
  query?: never;
2331
- url: '/webhooks/{webhook_id}/rotate-secret';
3461
+ url: '/workflows/{workflow_id}';
2332
3462
  };
2333
- export type RotateWebhookSecretErrors = {
3463
+ export type UpdateWorkflowErrors = {
2334
3464
  /**
2335
3465
  * `invalid_json`: The body is not valid JSON.
2336
3466
  *
@@ -2349,6 +3479,12 @@ export type RotateWebhookSecretErrors = {
2349
3479
  * `not_found`: The resource does not exist in this organization.
2350
3480
  */
2351
3481
  404: Error;
3482
+ /**
3483
+ * `idempotency_conflict`: The `Idempotency-Key` was used for a different request.
3484
+ *
3485
+ * `request_processing`: A request with this `Idempotency-Key` is still processing or ended in an unknown state.
3486
+ */
3487
+ 409: Error;
2352
3488
  /**
2353
3489
  * `body_too_large`: The JSON body exceeds 64 KiB.
2354
3490
  */
@@ -2357,6 +3493,10 @@ export type RotateWebhookSecretErrors = {
2357
3493
  * `unsupported_media_type`: The body must be `application/json`.
2358
3494
  */
2359
3495
  415: Error;
3496
+ /**
3497
+ * `rule_violation`: The request breaks a business rule; `message` says which.
3498
+ */
3499
+ 422: Error;
2360
3500
  /**
2361
3501
  * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
2362
3502
  */
@@ -2366,28 +3506,28 @@ export type RotateWebhookSecretErrors = {
2366
3506
  */
2367
3507
  500: Error;
2368
3508
  };
2369
- export type RotateWebhookSecretError = RotateWebhookSecretErrors[keyof RotateWebhookSecretErrors];
2370
- export type RotateWebhookSecretResponses = {
3509
+ export type UpdateWorkflowError = UpdateWorkflowErrors[keyof UpdateWorkflowErrors];
3510
+ export type UpdateWorkflowResponses = {
2371
3511
  /**
2372
3512
  * Success.
2373
3513
  */
2374
3514
  200: {
2375
- data: CreatedWebhook;
3515
+ data: Workflow;
2376
3516
  };
2377
3517
  };
2378
- export type RotateWebhookSecretResponse = RotateWebhookSecretResponses[keyof RotateWebhookSecretResponses];
2379
- export type ListWebhookDeliveriesData = {
3518
+ export type UpdateWorkflowResponse = UpdateWorkflowResponses[keyof UpdateWorkflowResponses];
3519
+ export type ActivateWorkflowData = {
2380
3520
  body?: never;
2381
3521
  path: {
2382
3522
  /**
2383
- * Webhook ID.
3523
+ * Workflow ID.
2384
3524
  */
2385
- webhook_id: string;
3525
+ workflow_id: string;
2386
3526
  };
2387
3527
  query?: never;
2388
- url: '/webhooks/{webhook_id}/deliveries';
3528
+ url: '/workflows/{workflow_id}/activate';
2389
3529
  };
2390
- export type ListWebhookDeliveriesErrors = {
3530
+ export type ActivateWorkflowErrors = {
2391
3531
  /**
2392
3532
  * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
2393
3533
  */
@@ -2404,6 +3544,10 @@ export type ListWebhookDeliveriesErrors = {
2404
3544
  * `not_found`: The resource does not exist in this organization.
2405
3545
  */
2406
3546
  404: Error;
3547
+ /**
3548
+ * `rule_violation`: The request breaks a business rule; `message` says which.
3549
+ */
3550
+ 422: Error;
2407
3551
  /**
2408
3552
  * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
2409
3553
  */
@@ -2413,36 +3557,84 @@ export type ListWebhookDeliveriesErrors = {
2413
3557
  */
2414
3558
  500: Error;
2415
3559
  };
2416
- export type ListWebhookDeliveriesError = ListWebhookDeliveriesErrors[keyof ListWebhookDeliveriesErrors];
2417
- export type ListWebhookDeliveriesResponses = {
3560
+ export type ActivateWorkflowError = ActivateWorkflowErrors[keyof ActivateWorkflowErrors];
3561
+ export type ActivateWorkflowResponses = {
2418
3562
  /**
2419
3563
  * Success.
2420
3564
  */
2421
3565
  200: {
2422
- data: Array<WebhookDelivery>;
3566
+ data: Workflow;
3567
+ };
3568
+ };
3569
+ export type ActivateWorkflowResponse = ActivateWorkflowResponses[keyof ActivateWorkflowResponses];
3570
+ export type PauseWorkflowData = {
3571
+ body?: never;
3572
+ path: {
2423
3573
  /**
2424
- * Pass as `cursor` for the next page; null on the last page.
3574
+ * Workflow ID.
2425
3575
  */
2426
- next_cursor: string | null;
3576
+ workflow_id: string;
2427
3577
  };
3578
+ query?: never;
3579
+ url: '/workflows/{workflow_id}/pause';
2428
3580
  };
2429
- export type ListWebhookDeliveriesResponse = ListWebhookDeliveriesResponses[keyof ListWebhookDeliveriesResponses];
2430
- export type RetryWebhookDeliveryData = {
3581
+ export type PauseWorkflowErrors = {
3582
+ /**
3583
+ * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
3584
+ */
3585
+ 400: Error;
3586
+ /**
3587
+ * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
3588
+ */
3589
+ 401: Error;
3590
+ /**
3591
+ * `insufficient_scope`: The key lacks the scope this operation requires.
3592
+ */
3593
+ 403: Error;
3594
+ /**
3595
+ * `not_found`: The resource does not exist in this organization.
3596
+ */
3597
+ 404: Error;
3598
+ /**
3599
+ * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
3600
+ */
3601
+ 429: Error;
3602
+ /**
3603
+ * `internal_error`: Ricky failed. Retry a read. Before retrying a write, read the resource: the same `Idempotency-Key` answers `request_processing`.
3604
+ */
3605
+ 500: Error;
3606
+ };
3607
+ export type PauseWorkflowError = PauseWorkflowErrors[keyof PauseWorkflowErrors];
3608
+ export type PauseWorkflowResponses = {
3609
+ /**
3610
+ * Success.
3611
+ */
3612
+ 200: {
3613
+ data: Workflow;
3614
+ };
3615
+ };
3616
+ export type PauseWorkflowResponse = PauseWorkflowResponses[keyof PauseWorkflowResponses];
3617
+ export type ListWorkflowExecutionsData = {
2431
3618
  body?: never;
2432
3619
  path: {
2433
3620
  /**
2434
- * Webhook ID.
3621
+ * Workflow ID.
2435
3622
  */
2436
- webhook_id: string;
3623
+ workflow_id: string;
3624
+ };
3625
+ query?: {
2437
3626
  /**
2438
- * Delivery ID.
3627
+ * Items per page.
2439
3628
  */
2440
- delivery_id: string;
3629
+ page_size?: number;
3630
+ /**
3631
+ * `next_cursor` from the previous page. Use it unchanged.
3632
+ */
3633
+ cursor?: string;
2441
3634
  };
2442
- query?: never;
2443
- url: '/webhooks/{webhook_id}/deliveries/{delivery_id}/retry';
3635
+ url: '/workflows/{workflow_id}/executions';
2444
3636
  };
2445
- export type RetryWebhookDeliveryErrors = {
3637
+ export type ListWorkflowExecutionsErrors = {
2446
3638
  /**
2447
3639
  * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
2448
3640
  */
@@ -2468,16 +3660,20 @@ export type RetryWebhookDeliveryErrors = {
2468
3660
  */
2469
3661
  500: Error;
2470
3662
  };
2471
- export type RetryWebhookDeliveryError = RetryWebhookDeliveryErrors[keyof RetryWebhookDeliveryErrors];
2472
- export type RetryWebhookDeliveryResponses = {
3663
+ export type ListWorkflowExecutionsError = ListWorkflowExecutionsErrors[keyof ListWorkflowExecutionsErrors];
3664
+ export type ListWorkflowExecutionsResponses = {
2473
3665
  /**
2474
3666
  * Success.
2475
3667
  */
2476
3668
  200: {
2477
- data: WebhookDelivery;
3669
+ data: Array<WorkflowExecution>;
3670
+ /**
3671
+ * Pass as `cursor` for the next page; null on the last page.
3672
+ */
3673
+ next_cursor: string | null;
2478
3674
  };
2479
3675
  };
2480
- export type RetryWebhookDeliveryResponse = RetryWebhookDeliveryResponses[keyof RetryWebhookDeliveryResponses];
3676
+ export type ListWorkflowExecutionsResponse = ListWorkflowExecutionsResponses[keyof ListWorkflowExecutionsResponses];
2481
3677
  export type WebhookMessageReceivedWebhookPayload = WebhookEvent;
2482
3678
  export type WebhookMessageReceivedWebhookRequest = {
2483
3679
  body: WebhookMessageReceivedWebhookPayload;