getricky 0.1.9 → 0.1.11

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.
@@ -1,7 +1,7 @@
1
1
  export type ClientOptions = {
2
2
  baseUrl: 'https://getricky.ai/api/v1' | (string & {});
3
3
  };
4
- export type Webhooks = WebhookMessageReceivedWebhookRequest | WebhookMessageSentWebhookRequest | WebhookMessageDeliveredWebhookRequest | WebhookMessageReadWebhookRequest | WebhookMessageFailedWebhookRequest | WebhookConversationOpenedWebhookRequest | WebhookConversationClosedWebhookRequest | WebhookConversationAssignmentChangedWebhookRequest | WebhookContactCreatedWebhookRequest | WebhookContactUpdatedWebhookRequest | WebhookWebhookTestWebhookRequest;
4
+ export type Webhooks = WebhookMessageReceivedWebhookRequest | WebhookMessageSentWebhookRequest | WebhookMessageDeliveredWebhookRequest | WebhookMessageReadWebhookRequest | WebhookMessageFailedWebhookRequest | WebhookConversationOpenedWebhookRequest | WebhookConversationClosedWebhookRequest | WebhookConversationAssignmentChangedWebhookRequest | WebhookConversationAgentChangedWebhookRequest | WebhookConversationHandoffRequestedWebhookRequest | WebhookConversationHandoffResolvedWebhookRequest | WebhookContactCreatedWebhookRequest | WebhookContactUpdatedWebhookRequest | WebhookContactTagsChangedWebhookRequest | WebhookBroadcastCompletedWebhookRequest | WebhookBroadcastFailedWebhookRequest | WebhookTemplateStatusChangedWebhookRequest | WebhookWorkflowExecutionFailedWebhookRequest | WebhookKnowledgeFileReadyWebhookRequest | WebhookWebhookTestWebhookRequest;
5
5
  /**
6
6
  * Every non-2xx response.
7
7
  */
@@ -734,6 +734,216 @@ export type BroadcastRecipient = {
734
734
  */
735
735
  status_updated_at: string | null;
736
736
  };
737
+ /**
738
+ * How many numbers an audience resolves to now.
739
+ */
740
+ export type BroadcastAudiencePreview = {
741
+ /**
742
+ * Numbers a broadcast to this audience would go to now, at most 5,000.
743
+ */
744
+ recipients: number;
745
+ /**
746
+ * Contacts or numbers left out because they have no valid WhatsApp number.
747
+ */
748
+ skipped: number;
749
+ };
750
+ /**
751
+ * A branch or place the agents can send as a WhatsApp location.
752
+ */
753
+ export type KnowledgeLocation = {
754
+ /**
755
+ * Location ID.
756
+ */
757
+ id: string;
758
+ /**
759
+ * Name customers know it by.
760
+ */
761
+ name: string;
762
+ /**
763
+ * Full address as customers read it.
764
+ */
765
+ address: string;
766
+ /**
767
+ * Latitude of the map pin.
768
+ */
769
+ latitude: number;
770
+ /**
771
+ * Longitude of the map pin.
772
+ */
773
+ longitude: number;
774
+ /**
775
+ * Street.
776
+ */
777
+ street: string | null;
778
+ /**
779
+ * City.
780
+ */
781
+ city: string | null;
782
+ /**
783
+ * State, province or region.
784
+ */
785
+ state: string | null;
786
+ /**
787
+ * Postal code.
788
+ */
789
+ postal_code: string | null;
790
+ /**
791
+ * Country.
792
+ */
793
+ country: string | null;
794
+ /**
795
+ * Country code, ISO 3166-1 alpha-2.
796
+ */
797
+ country_code: string | null;
798
+ /**
799
+ * Phone in E.164.
800
+ */
801
+ phone: string | null;
802
+ /**
803
+ * Email.
804
+ */
805
+ email: string | null;
806
+ /**
807
+ * Opening hours, as free text.
808
+ */
809
+ hours: string | null;
810
+ };
811
+ /**
812
+ * A contact card in the knowledge directory, which agents can send to customers.
813
+ */
814
+ export type KnowledgeContact = {
815
+ /**
816
+ * Knowledge contact ID.
817
+ */
818
+ id: string;
819
+ /**
820
+ * Name shown on the contact card.
821
+ */
822
+ display_name: string;
823
+ /**
824
+ * First name.
825
+ */
826
+ first_name: string | null;
827
+ /**
828
+ * Last name.
829
+ */
830
+ last_name: string | null;
831
+ /**
832
+ * Name prefix, such as `Dr.`.
833
+ */
834
+ prefix: string | null;
835
+ /**
836
+ * Name suffix.
837
+ */
838
+ suffix: string | null;
839
+ /**
840
+ * Company.
841
+ */
842
+ company: string | null;
843
+ /**
844
+ * Department.
845
+ */
846
+ department: string | null;
847
+ /**
848
+ * Job title.
849
+ */
850
+ job_title: string | null;
851
+ /**
852
+ * When the agents should share it.
853
+ */
854
+ description: string | null;
855
+ /**
856
+ * Phone in E.164.
857
+ */
858
+ phone: string | null;
859
+ /**
860
+ * `CELL`, `WORK` or `HOME`.
861
+ */
862
+ phone_type: string | null;
863
+ /**
864
+ * Email.
865
+ */
866
+ email: string | null;
867
+ /**
868
+ * `WORK` or `PERSONAL`.
869
+ */
870
+ email_type: string | null;
871
+ };
872
+ /**
873
+ * A document or image the agents can consult or send.
874
+ */
875
+ export type KnowledgeFile = {
876
+ /**
877
+ * File ID.
878
+ */
879
+ id: string;
880
+ /**
881
+ * Title the agents see.
882
+ */
883
+ title: string;
884
+ /**
885
+ * When the agents should use it; may be empty.
886
+ */
887
+ description: string;
888
+ /**
889
+ * Original file name.
890
+ */
891
+ filename: string;
892
+ /**
893
+ * File type.
894
+ */
895
+ mime_type: 'application/pdf' | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' | 'image/jpeg' | 'image/png';
896
+ /**
897
+ * Size in bytes.
898
+ */
899
+ size_bytes: number;
900
+ /**
901
+ * `uploading` until `POST /knowledge/files/{file_id}/complete` reads it; then `ready`.
902
+ */
903
+ status: 'uploading' | 'ready' | 'failed';
904
+ /**
905
+ * Agents may read it to answer.
906
+ */
907
+ consult_enabled: boolean;
908
+ /**
909
+ * Agents may send the file itself to customers.
910
+ */
911
+ send_enabled: boolean;
912
+ /**
913
+ * Pages of a PDF; null otherwise.
914
+ */
915
+ page_count: number | null;
916
+ /**
917
+ * Start of the text Ricky read from it.
918
+ */
919
+ preview: string | null;
920
+ /**
921
+ * Why Ricky could not read useful content; null when it could.
922
+ */
923
+ extraction_error: string | null;
924
+ /**
925
+ * Signed download URL, valid for five minutes. Only `GET /knowledge/files/{file_id}` of a `ready` file carries it; null elsewhere.
926
+ */
927
+ download_url: string | null;
928
+ /**
929
+ * When the upload began.
930
+ */
931
+ created_at: string;
932
+ /**
933
+ * Last change.
934
+ */
935
+ updated_at: string;
936
+ };
937
+ /**
938
+ * A file waiting for its bytes, and where to put them.
939
+ */
940
+ export type KnowledgeFileUpload = {
941
+ file: KnowledgeFile;
942
+ /**
943
+ * Signed URL valid for two hours. `PUT` the file bytes to it with `Content-Type` set to `mime_type`, then call `POST /knowledge/files/{file_id}/complete`.
944
+ */
945
+ upload_url: string;
946
+ };
737
947
  /**
738
948
  * A webhook subscription.
739
949
  */
@@ -746,7 +956,7 @@ export type Webhook = {
746
956
  * HTTPS endpoint Ricky posts to.
747
957
  */
748
958
  url: string;
749
- event_types: Array<'message.received' | 'message.sent' | 'message.delivered' | 'message.read' | 'message.failed' | 'conversation.opened' | 'conversation.closed' | 'conversation.assignment_changed' | 'contact.created' | 'contact.updated'>;
959
+ event_types: Array<'message.received' | 'message.sent' | 'message.delivered' | 'message.read' | 'message.failed' | 'conversation.opened' | 'conversation.closed' | 'conversation.assignment_changed' | 'conversation.agent_changed' | 'conversation.handoff_requested' | 'conversation.handoff_resolved' | 'contact.created' | 'contact.updated' | 'contact.tags_changed' | 'broadcast.completed' | 'broadcast.failed' | 'template.status_changed' | 'workflow.execution_failed' | 'knowledge_file.ready'>;
750
960
  status: 'active' | 'disabled';
751
961
  /**
752
962
  * When it was created.
@@ -769,7 +979,7 @@ export type CreatedWebhook = {
769
979
  * HTTPS endpoint Ricky posts to.
770
980
  */
771
981
  url: string;
772
- event_types: Array<'message.received' | 'message.sent' | 'message.delivered' | 'message.read' | 'message.failed' | 'conversation.opened' | 'conversation.closed' | 'conversation.assignment_changed' | 'contact.created' | 'contact.updated'>;
982
+ event_types: Array<'message.received' | 'message.sent' | 'message.delivered' | 'message.read' | 'message.failed' | 'conversation.opened' | 'conversation.closed' | 'conversation.assignment_changed' | 'conversation.agent_changed' | 'conversation.handoff_requested' | 'conversation.handoff_resolved' | 'contact.created' | 'contact.updated' | 'contact.tags_changed' | 'broadcast.completed' | 'broadcast.failed' | 'template.status_changed' | 'workflow.execution_failed' | 'knowledge_file.ready'>;
773
983
  status: 'active' | 'disabled';
774
984
  /**
775
985
  * When it was created.
@@ -792,7 +1002,7 @@ export type WebhookDelivery = {
792
1002
  * Delivery ID; equals the event `id` and `X-Ricky-Delivery-Id`.
793
1003
  */
794
1004
  id: string;
795
- event_type: 'message.received' | 'message.sent' | 'message.delivered' | 'message.read' | 'message.failed' | 'conversation.opened' | 'conversation.closed' | 'conversation.assignment_changed' | 'contact.created' | 'contact.updated';
1005
+ event_type: 'message.received' | 'message.sent' | 'message.delivered' | 'message.read' | 'message.failed' | 'conversation.opened' | 'conversation.closed' | 'conversation.assignment_changed' | 'conversation.agent_changed' | 'conversation.handoff_requested' | 'conversation.handoff_resolved' | 'contact.created' | 'contact.updated' | 'contact.tags_changed' | 'broadcast.completed' | 'broadcast.failed' | 'template.status_changed' | 'workflow.execution_failed' | 'knowledge_file.ready';
796
1006
  status: 'pending' | 'processing' | 'delivered' | 'failed';
797
1007
  /**
798
1008
  * Delivery attempts so far; Ricky makes at most ten.
@@ -827,7 +1037,7 @@ export type WebhookEvent = {
827
1037
  * Delivery ID. Deduplicate by it.
828
1038
  */
829
1039
  id: string;
830
- type: 'message.received' | 'message.sent' | 'message.delivered' | 'message.read' | 'message.failed' | 'conversation.opened' | 'conversation.closed' | 'conversation.assignment_changed' | 'contact.created' | 'contact.updated' | 'webhook.test';
1040
+ type: 'message.received' | 'message.sent' | 'message.delivered' | 'message.read' | 'message.failed' | 'conversation.opened' | 'conversation.closed' | 'conversation.assignment_changed' | 'conversation.agent_changed' | 'conversation.handoff_requested' | 'conversation.handoff_resolved' | 'contact.created' | 'contact.updated' | 'contact.tags_changed' | 'broadcast.completed' | 'broadcast.failed' | 'template.status_changed' | 'workflow.execution_failed' | 'knowledge_file.ready' | 'webhook.test';
831
1041
  /**
832
1042
  * When it happened.
833
1043
  */
@@ -849,6 +1059,26 @@ export type WebhookEvent = {
849
1059
  * Contact, for `contact.*` events.
850
1060
  */
851
1061
  contact_id?: string;
1062
+ /**
1063
+ * Broadcast, for `broadcast.*` events.
1064
+ */
1065
+ broadcast_id?: string;
1066
+ /**
1067
+ * Template ID at Meta, for `template.status_changed`.
1068
+ */
1069
+ template_id?: string;
1070
+ /**
1071
+ * Workflow, for `workflow.execution_failed`.
1072
+ */
1073
+ workflow_id?: string;
1074
+ /**
1075
+ * Execution, for `workflow.execution_failed`.
1076
+ */
1077
+ workflow_execution_id?: string;
1078
+ /**
1079
+ * Knowledge file, for `knowledge_file.ready`.
1080
+ */
1081
+ knowledge_file_id?: string;
852
1082
  /**
853
1083
  * Webhook, for `webhook.test`.
854
1084
  */
@@ -967,203 +1197,6 @@ export type ConversationAssignmentResult = {
967
1197
  */
968
1198
  status: 'assigned' | 'not_found' | 'failed';
969
1199
  };
970
- /**
971
- * A branch or place the agents can send as a WhatsApp location.
972
- */
973
- export type KnowledgeLocation = {
974
- /**
975
- * Location ID.
976
- */
977
- id: string;
978
- /**
979
- * Name customers know it by.
980
- */
981
- name: string;
982
- /**
983
- * Full address as customers read it.
984
- */
985
- address: string;
986
- /**
987
- * Latitude of the map pin.
988
- */
989
- latitude: number;
990
- /**
991
- * Longitude of the map pin.
992
- */
993
- longitude: number;
994
- /**
995
- * Street.
996
- */
997
- street: string | null;
998
- /**
999
- * City.
1000
- */
1001
- city: string | null;
1002
- /**
1003
- * State, province or region.
1004
- */
1005
- state: string | null;
1006
- /**
1007
- * Postal code.
1008
- */
1009
- postal_code: string | null;
1010
- /**
1011
- * Country.
1012
- */
1013
- country: string | null;
1014
- /**
1015
- * Country code, ISO 3166-1 alpha-2.
1016
- */
1017
- country_code: string | null;
1018
- /**
1019
- * Phone in E.164.
1020
- */
1021
- phone: string | null;
1022
- /**
1023
- * Email.
1024
- */
1025
- email: string | null;
1026
- /**
1027
- * Opening hours, as free text.
1028
- */
1029
- hours: string | null;
1030
- };
1031
- /**
1032
- * A contact card in the knowledge directory, which agents can send to customers.
1033
- */
1034
- export type KnowledgeContact = {
1035
- /**
1036
- * Knowledge contact ID.
1037
- */
1038
- id: string;
1039
- /**
1040
- * Name shown on the contact card.
1041
- */
1042
- display_name: string;
1043
- /**
1044
- * First name.
1045
- */
1046
- first_name: string | null;
1047
- /**
1048
- * Last name.
1049
- */
1050
- last_name: string | null;
1051
- /**
1052
- * Name prefix, such as `Dr.`.
1053
- */
1054
- prefix: string | null;
1055
- /**
1056
- * Name suffix.
1057
- */
1058
- suffix: string | null;
1059
- /**
1060
- * Company.
1061
- */
1062
- company: string | null;
1063
- /**
1064
- * Department.
1065
- */
1066
- department: string | null;
1067
- /**
1068
- * Job title.
1069
- */
1070
- job_title: string | null;
1071
- /**
1072
- * When the agents should share it.
1073
- */
1074
- description: string | null;
1075
- /**
1076
- * Phone in E.164.
1077
- */
1078
- phone: string | null;
1079
- /**
1080
- * `CELL`, `WORK` or `HOME`.
1081
- */
1082
- phone_type: string | null;
1083
- /**
1084
- * Email.
1085
- */
1086
- email: string | null;
1087
- /**
1088
- * `WORK` or `PERSONAL`.
1089
- */
1090
- email_type: string | null;
1091
- };
1092
- /**
1093
- * A document or image the agents can consult or send.
1094
- */
1095
- export type KnowledgeFile = {
1096
- /**
1097
- * File ID.
1098
- */
1099
- id: string;
1100
- /**
1101
- * Title the agents see.
1102
- */
1103
- title: string;
1104
- /**
1105
- * When the agents should use it; may be empty.
1106
- */
1107
- description: string;
1108
- /**
1109
- * Original file name.
1110
- */
1111
- filename: string;
1112
- /**
1113
- * File type.
1114
- */
1115
- mime_type: 'application/pdf' | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' | 'image/jpeg' | 'image/png';
1116
- /**
1117
- * Size in bytes.
1118
- */
1119
- size_bytes: number;
1120
- /**
1121
- * `uploading` until `POST /knowledge/files/{file_id}/complete` reads it; then `ready`.
1122
- */
1123
- status: 'uploading' | 'ready' | 'failed';
1124
- /**
1125
- * Agents may read it to answer.
1126
- */
1127
- consult_enabled: boolean;
1128
- /**
1129
- * Agents may send the file itself to customers.
1130
- */
1131
- send_enabled: boolean;
1132
- /**
1133
- * Pages of a PDF; null otherwise.
1134
- */
1135
- page_count: number | null;
1136
- /**
1137
- * Start of the text Ricky read from it.
1138
- */
1139
- preview: string | null;
1140
- /**
1141
- * Why Ricky could not read useful content; null when it could.
1142
- */
1143
- extraction_error: string | null;
1144
- /**
1145
- * Signed download URL, valid for five minutes. Only `GET /knowledge/files/{file_id}` of a `ready` file carries it; null elsewhere.
1146
- */
1147
- download_url: string | null;
1148
- /**
1149
- * When the upload began.
1150
- */
1151
- created_at: string;
1152
- /**
1153
- * Last change.
1154
- */
1155
- updated_at: string;
1156
- };
1157
- /**
1158
- * A file waiting for its bytes, and where to put them.
1159
- */
1160
- export type KnowledgeFileUpload = {
1161
- file: KnowledgeFile;
1162
- /**
1163
- * Signed URL valid for two hours. `PUT` the file bytes to it with `Content-Type` set to `mime_type`, then call `POST /knowledge/files/{file_id}/complete`.
1164
- */
1165
- upload_url: string;
1166
- };
1167
1200
  /**
1168
1201
  * The days a report covers, in America/Panama time, and the period it is compared with.
1169
1202
  */
@@ -2210,145 +2243,180 @@ export type ResolutionsReport = {
2210
2243
  /**
2211
2244
  * The period by who held the conversation when it closed, most closes first.
2212
2245
  */
2213
- by_assignee: Array<{
2214
- /**
2215
- * Who held the conversation when it closed.
2216
- */
2217
- type: 'human' | 'ai' | 'unassigned';
2218
- /**
2219
- * Name; null when it has none and for `unassigned`. Equal names are one row.
2220
- */
2221
- name: string | null;
2222
- /**
2223
- * Closes in the period.
2224
- */
2225
- closed: number;
2226
- /**
2227
- * Median time from opening to close, in seconds.
2228
- */
2229
- median_resolution_seconds: number | null;
2230
- }>;
2231
- /**
2232
- * Closes of the period by how long the conversation was open.
2233
- */
2234
- distribution: Array<{
2235
- bucket: 'under_1h' | '1h_4h' | '4h_24h' | '1d_3d' | 'over_3d';
2236
- /**
2237
- * Closes in the period that took that long.
2238
- */
2239
- closed: number;
2240
- }>;
2241
- /**
2242
- * When Ricky computed the report.
2243
- */
2244
- generated_at: string;
2245
- };
2246
- /**
2247
- * The result of checking a template draft without submitting it.
2248
- */
2249
- export type TemplateValidation = {
2250
- /**
2251
- * Whether `POST /templates` would submit this draft to Meta.
2252
- */
2253
- valid: boolean;
2254
- /**
2255
- * Every problem found; empty when the draft is valid.
2256
- */
2257
- errors: Array<{
2258
- /**
2259
- * The request field the problem is in.
2260
- */
2261
- param: string;
2262
- /**
2263
- * What to change.
2264
- */
2265
- message: string;
2266
- }>;
2267
- /**
2268
- * The components Ricky would submit, in the WhatsApp Cloud API format; null when the draft is invalid.
2269
- */
2270
- components: Array<{
2271
- [key: string]: unknown;
2272
- }> | null;
2273
- };
2274
- /**
2275
- * A template Meta deleted.
2276
- */
2277
- export type DeletedTemplate = {
2278
- /**
2279
- * Template ID at Meta.
2280
- */
2281
- id: string;
2282
- deleted: true;
2283
- };
2284
- /**
2285
- * A WhatsApp number, with its status, quality and messaging limit at Meta.
2286
- */
2287
- export type WhatsAppNumber = {
2288
- /**
2289
- * Channel ID.
2290
- */
2291
- id: string;
2292
- /**
2293
- * Name shown in Ricky.
2294
- */
2295
- name: string;
2296
- /**
2297
- * Phone in E.164.
2298
- */
2299
- phone_number: string | null;
2300
- /**
2301
- * Business name Meta approved for the number.
2302
- */
2303
- verified_name: string | null;
2304
- /**
2305
- * Phone number ID at Meta.
2306
- */
2307
- phone_number_id: string | null;
2246
+ by_assignee: Array<{
2247
+ /**
2248
+ * Who held the conversation when it closed.
2249
+ */
2250
+ type: 'human' | 'ai' | 'unassigned';
2251
+ /**
2252
+ * Name; null when it has none and for `unassigned`. Equal names are one row.
2253
+ */
2254
+ name: string | null;
2255
+ /**
2256
+ * Closes in the period.
2257
+ */
2258
+ closed: number;
2259
+ /**
2260
+ * Median time from opening to close, in seconds.
2261
+ */
2262
+ median_resolution_seconds: number | null;
2263
+ }>;
2308
2264
  /**
2309
- * WhatsApp Business Account that owns the number.
2265
+ * Closes of the period by how long the conversation was open.
2310
2266
  */
2311
- whatsapp_business_account_id: string | null;
2267
+ distribution: Array<{
2268
+ bucket: 'under_1h' | '1h_4h' | '4h_24h' | '1d_3d' | 'over_3d';
2269
+ /**
2270
+ * Closes in the period that took that long.
2271
+ */
2272
+ closed: number;
2273
+ }>;
2312
2274
  /**
2313
- * `coexistence` when the number also stays on the WhatsApp Business app; `dedicated` otherwise.
2275
+ * When Ricky computed the report.
2314
2276
  */
2315
- connection_mode: 'dedicated' | 'coexistence' | null;
2277
+ generated_at: string;
2278
+ };
2279
+ /**
2280
+ * The Odoo appointments a reminder workflow would message on a coming day.
2281
+ */
2282
+ export type ReminderPreview = {
2316
2283
  /**
2317
- * Status of the number at Meta, as Meta reports it, for example `CONNECTED`.
2284
+ * Day the workflow sends these reminders, in its time zone.
2318
2285
  */
2319
- status: string | null;
2286
+ date: string;
2320
2287
  /**
2321
- * When the number was disconnected from Ricky; null while connected.
2288
+ * IANA time zone of the workflow.
2322
2289
  */
2323
- disconnected_at: string | null;
2290
+ timezone: string;
2324
2291
  /**
2325
- * Whether Meta lets the number send: `available`, `limited` or `blocked`.
2292
+ * When Ricky read the appointments from Odoo.
2326
2293
  */
2327
- messaging_health: 'available' | 'limited' | 'blocked';
2294
+ checked_at: string;
2328
2295
  /**
2329
- * Quality rating at Meta: `green`, `yellow`, `red`, `not_yet_determined` or `unknown`.
2296
+ * Every appointment state the Odoo installation has.
2330
2297
  */
2331
- quality_rating: string | null;
2298
+ appointment_states: Array<{
2299
+ /**
2300
+ * State as Odoo stores it.
2301
+ */
2302
+ value: string;
2303
+ /**
2304
+ * State as Odoo shows it.
2305
+ */
2306
+ label: string;
2307
+ }>;
2332
2308
  /**
2333
- * Messaging limit tier at Meta, for example `TIER_1K` or `TIER_UNLIMITED`; `UNKNOWN` when Meta has not reported it.
2309
+ * Each appointment of that day in Odoo, in start order.
2334
2310
  */
2335
- messaging_limit: string | null;
2311
+ reminders: Array<{
2312
+ /**
2313
+ * Appointment ID in Odoo.
2314
+ */
2315
+ appointment_id: string;
2316
+ /**
2317
+ * Appointment state in Odoo.
2318
+ */
2319
+ appointment_state: string;
2320
+ /**
2321
+ * Customer first name in Odoo.
2322
+ */
2323
+ customer_first_name: string | null;
2324
+ /**
2325
+ * Phone in Odoo.
2326
+ */
2327
+ phone: string | null;
2328
+ /**
2329
+ * Branch in Odoo.
2330
+ */
2331
+ branch_name: string | null;
2332
+ /**
2333
+ * When the appointment starts.
2334
+ */
2335
+ starts_at: string;
2336
+ /**
2337
+ * Why it is not sent: its Odoo state is not one the workflow reminds (`state`), or it has no customer name (`name`), branch (`branch`) or valid phone (`phone`); null when it is sent.
2338
+ */
2339
+ excluded_because: 'state' | 'name' | 'branch' | 'phone' | null;
2340
+ /**
2341
+ * The message the template would send, with this appointment’s values.
2342
+ */
2343
+ message: string;
2344
+ /**
2345
+ * The send already recorded for this appointment and day; null if none.
2346
+ */
2347
+ delivery: {
2348
+ /**
2349
+ * `pending` or `processing` while queued; `accepted` once WhatsApp took it; then `sent`, `delivered` and `read` as WhatsApp reports them; `failed` for good; `superseded` when a newer send replaced it; `unknown` when Ricky cannot tell.
2350
+ */
2351
+ status: 'pending' | 'processing' | 'accepted' | 'sent' | 'delivered' | 'read' | 'failed' | 'superseded' | 'unknown';
2352
+ /**
2353
+ * Why it failed; null otherwise.
2354
+ */
2355
+ error: string | null;
2356
+ } | null;
2357
+ }>;
2358
+ };
2359
+ /**
2360
+ * What a reminder workflow checked and sent on a past day.
2361
+ */
2362
+ export type ReminderHistory = {
2336
2363
  /**
2337
- * Whether Ricky receives the messages sent to the number.
2364
+ * Day the workflow ran, in its time zone.
2338
2365
  */
2339
- inbound_processing_enabled: boolean | null;
2366
+ date: string;
2340
2367
  /**
2341
- * Whether customers can call the number and reach the AI agent.
2368
+ * IANA time zone of the workflow.
2342
2369
  */
2343
- calls_enabled: boolean | null;
2370
+ timezone: string;
2344
2371
  /**
2345
- * When it was connected.
2372
+ * Times the workflow checked Odoo that day; 0 for days before Ricky recorded them.
2346
2373
  */
2347
- connected_at: string | null;
2374
+ evaluations_recorded: number;
2348
2375
  /**
2349
- * When Ricky last read its details from Meta.
2376
+ * Each appointment the workflow checked or sent that day, oldest first.
2350
2377
  */
2351
- last_synced_at: string | null;
2378
+ reminders: Array<{
2379
+ /**
2380
+ * Customer first name in Odoo.
2381
+ */
2382
+ customer_first_name: string | null;
2383
+ /**
2384
+ * Phone in Odoo.
2385
+ */
2386
+ phone: string | null;
2387
+ /**
2388
+ * Branch in Odoo.
2389
+ */
2390
+ branch_name: string | null;
2391
+ /**
2392
+ * When the appointment started; null if not recorded.
2393
+ */
2394
+ starts_at: string | null;
2395
+ /**
2396
+ * Why it is not sent: its Odoo state is not one the workflow reminds (`state`), or it has no customer name (`name`), branch (`branch`) or valid phone (`phone`); null when it is sent.
2397
+ */
2398
+ excluded_because: 'state' | 'name' | 'branch' | 'phone' | null;
2399
+ /**
2400
+ * The message sent; null when nothing was sent.
2401
+ */
2402
+ message: string | null;
2403
+ /**
2404
+ * When the workflow last checked the appointment before sending; null if not recorded.
2405
+ */
2406
+ evaluated_at: string | null;
2407
+ /**
2408
+ * When the send was queued; null when nothing was sent.
2409
+ */
2410
+ queued_at: string | null;
2411
+ /**
2412
+ * Where the send stands, with the values of a preview’s `delivery.status`; null when nothing was sent.
2413
+ */
2414
+ status: 'pending' | 'processing' | 'accepted' | 'sent' | 'delivered' | 'read' | 'failed' | 'superseded' | 'unknown' | null;
2415
+ /**
2416
+ * Why it failed; null otherwise.
2417
+ */
2418
+ error: string | null;
2419
+ }>;
2352
2420
  };
2353
2421
  /**
2354
2422
  * An automation Ricky runs for the organization.
@@ -2673,6 +2741,113 @@ export type WorkflowExecution = {
2673
2741
  */
2674
2742
  processed_at: string | null;
2675
2743
  };
2744
+ /**
2745
+ * The result of checking a template draft without submitting it.
2746
+ */
2747
+ export type TemplateValidation = {
2748
+ /**
2749
+ * Whether `POST /templates` would submit this draft to Meta.
2750
+ */
2751
+ valid: boolean;
2752
+ /**
2753
+ * Every problem found; empty when the draft is valid.
2754
+ */
2755
+ errors: Array<{
2756
+ /**
2757
+ * The request field the problem is in.
2758
+ */
2759
+ param: string;
2760
+ /**
2761
+ * What to change.
2762
+ */
2763
+ message: string;
2764
+ }>;
2765
+ /**
2766
+ * The components Ricky would submit, in the WhatsApp Cloud API format; null when the draft is invalid.
2767
+ */
2768
+ components: Array<{
2769
+ [key: string]: unknown;
2770
+ }> | null;
2771
+ };
2772
+ /**
2773
+ * A template Meta deleted.
2774
+ */
2775
+ export type DeletedTemplate = {
2776
+ /**
2777
+ * Template ID at Meta.
2778
+ */
2779
+ id: string;
2780
+ deleted: true;
2781
+ };
2782
+ /**
2783
+ * A WhatsApp number, with its status, quality and messaging limit at Meta.
2784
+ */
2785
+ export type WhatsAppNumber = {
2786
+ /**
2787
+ * Channel ID.
2788
+ */
2789
+ id: string;
2790
+ /**
2791
+ * Name shown in Ricky.
2792
+ */
2793
+ name: string;
2794
+ /**
2795
+ * Phone in E.164.
2796
+ */
2797
+ phone_number: string | null;
2798
+ /**
2799
+ * Business name Meta approved for the number.
2800
+ */
2801
+ verified_name: string | null;
2802
+ /**
2803
+ * Phone number ID at Meta.
2804
+ */
2805
+ phone_number_id: string | null;
2806
+ /**
2807
+ * WhatsApp Business Account that owns the number.
2808
+ */
2809
+ whatsapp_business_account_id: string | null;
2810
+ /**
2811
+ * `coexistence` when the number also stays on the WhatsApp Business app; `dedicated` otherwise.
2812
+ */
2813
+ connection_mode: 'dedicated' | 'coexistence' | null;
2814
+ /**
2815
+ * Status of the number at Meta, as Meta reports it, for example `CONNECTED`.
2816
+ */
2817
+ status: string | null;
2818
+ /**
2819
+ * When the number was disconnected from Ricky; null while connected.
2820
+ */
2821
+ disconnected_at: string | null;
2822
+ /**
2823
+ * Whether Meta lets the number send: `available`, `limited` or `blocked`.
2824
+ */
2825
+ messaging_health: 'available' | 'limited' | 'blocked';
2826
+ /**
2827
+ * Quality rating at Meta: `green`, `yellow`, `red`, `not_yet_determined` or `unknown`.
2828
+ */
2829
+ quality_rating: string | null;
2830
+ /**
2831
+ * Messaging limit tier at Meta, for example `TIER_1K` or `TIER_UNLIMITED`; `UNKNOWN` when Meta has not reported it.
2832
+ */
2833
+ messaging_limit: string | null;
2834
+ /**
2835
+ * Whether Ricky receives the messages sent to the number.
2836
+ */
2837
+ inbound_processing_enabled: boolean | null;
2838
+ /**
2839
+ * Whether customers can call the number and reach the AI agent.
2840
+ */
2841
+ calls_enabled: boolean | null;
2842
+ /**
2843
+ * When it was connected.
2844
+ */
2845
+ connected_at: string | null;
2846
+ /**
2847
+ * When Ricky last read its details from Meta.
2848
+ */
2849
+ last_synced_at: string | null;
2850
+ };
2676
2851
  /**
2677
2852
  * Only `name` is required; it does not connect the agent to any channel.
2678
2853
  */
@@ -3109,26 +3284,94 @@ export type AddContactNote = {
3109
3284
  };
3110
3285
  export type CreateWebhook = {
3111
3286
  /**
3112
- * Public HTTPS endpoint.
3287
+ * Public HTTPS endpoint.
3288
+ */
3289
+ url: string;
3290
+ event_types: Array<'message.received' | 'message.sent' | 'message.delivered' | 'message.read' | 'message.failed' | 'conversation.opened' | 'conversation.closed' | 'conversation.assignment_changed' | 'conversation.agent_changed' | 'conversation.handoff_requested' | 'conversation.handoff_resolved' | 'contact.created' | 'contact.updated' | 'contact.tags_changed' | 'broadcast.completed' | 'broadcast.failed' | 'template.status_changed' | 'workflow.execution_failed' | 'knowledge_file.ready'>;
3291
+ };
3292
+ export type RotateWebhookSecret = {
3293
+ /**
3294
+ * How long deliveries keep the previous signature too, so you can deploy the new secret first. 0 ends the previous secret now.
3295
+ */
3296
+ expire_previous_after_hours?: number;
3297
+ };
3298
+ /**
3299
+ * Sends an approved template to many numbers, now or at a set time.
3300
+ */
3301
+ export type CreateBroadcast = {
3302
+ /**
3303
+ * WhatsApp channel to send from. See `GET /channels`.
3304
+ */
3305
+ channel_id: string;
3306
+ template: TemplateMessage;
3307
+ /**
3308
+ * Who receives it. `filter` takes every contact matching all the filters you send (no filter: every contact); `contacts` and `phones` take the ones you list. Ricky uses each contact’s phone, or its WhatsApp number, skips contacts without one and sends once per number, up to 5,000.
3309
+ */
3310
+ audience: {
3311
+ type: 'filter';
3312
+ /**
3313
+ * Only contacts with this tag.
3314
+ */
3315
+ tag_id?: string;
3316
+ /**
3317
+ * Only contacts at this stage.
3318
+ */
3319
+ lifecycle_stage?: 'subscriber' | 'lead' | 'marketing_qualified' | 'sales_qualified' | 'opportunity' | 'customer' | 'evangelist' | 'other';
3320
+ /**
3321
+ * Only contacts whose name, phone, email or company contains it.
3322
+ */
3323
+ query?: string;
3324
+ } | {
3325
+ type: 'contacts';
3326
+ /**
3327
+ * Contacts of the organization.
3328
+ */
3329
+ contact_ids: Array<string>;
3330
+ } | {
3331
+ type: 'phones';
3332
+ /**
3333
+ * Numbers with country code, for example `+50760001234`.
3334
+ */
3335
+ phones: Array<string>;
3336
+ };
3337
+ /**
3338
+ * Fills template variables per recipient from their contact, as the broadcast composer does. Ricky saves them on the template, replacing the ones it had, so later broadcasts of the template use them too; omit it to keep the saved ones, send `[]` to clear them. A recipient without a contact, or without a value in the field, receives the text you sent in `template.components`.
3113
3339
  */
3114
- url: string;
3115
- event_types: Array<'message.received' | 'message.sent' | 'message.delivered' | 'message.read' | 'message.failed' | 'conversation.opened' | 'conversation.closed' | 'conversation.assignment_changed' | 'contact.created' | 'contact.updated'>;
3116
- };
3117
- export type RotateWebhookSecret = {
3340
+ mappings?: Array<{
3341
+ /**
3342
+ * Where the variable is: the header, the body, or a URL button.
3343
+ */
3344
+ component: 'header' | 'body' | 'button';
3345
+ /**
3346
+ * The variable: its number (`1`) or its name in a header or body; for a button, the button’s index (`0`).
3347
+ */
3348
+ key: string;
3349
+ /**
3350
+ * Where each recipient’s value comes from.
3351
+ */
3352
+ source: {
3353
+ type: 'contact';
3354
+ /**
3355
+ * A field of the contact.
3356
+ */
3357
+ field: 'birthday' | 'city' | 'company' | 'country' | 'first_name' | 'job_title' | 'last_name' | 'lead_status' | 'lifecycle_stage' | 'linkedin_url' | 'notes' | 'postal_code' | 'primary_email' | 'primary_phone' | 'region' | 'source' | 'street_address' | 'website_url';
3358
+ } | {
3359
+ type: 'custom_field';
3360
+ /**
3361
+ * A custom contact field. See `GET /contact-fields`.
3362
+ */
3363
+ field_id: string;
3364
+ };
3365
+ }>;
3118
3366
  /**
3119
- * How long deliveries keep the previous signature too, so you can deploy the new secret first. 0 ends the previous secret now.
3367
+ * When to start sending, up to 7 days ahead. Omit it to send now.
3120
3368
  */
3121
- expire_previous_after_hours?: number;
3369
+ scheduled_at?: string;
3122
3370
  };
3123
3371
  /**
3124
- * Sends an approved template to many numbers, now or at a set time.
3372
+ * The audience to count, as you would send it to `POST /broadcasts`.
3125
3373
  */
3126
- export type CreateBroadcast = {
3127
- /**
3128
- * WhatsApp channel to send from. See `GET /channels`.
3129
- */
3130
- channel_id: string;
3131
- template: TemplateMessage;
3374
+ export type PreviewBroadcastAudience = {
3132
3375
  /**
3133
3376
  * Who receives it. `filter` takes every contact matching all the filters you send (no filter: every contact); `contacts` and `phones` take the ones you list. Ricky uses each contact’s phone, or its WhatsApp number, skips contacts without one and sends once per number, up to 5,000.
3134
3377
  */
@@ -3159,10 +3402,6 @@ export type CreateBroadcast = {
3159
3402
  */
3160
3403
  phones: Array<string>;
3161
3404
  };
3162
- /**
3163
- * When to start sending, up to 7 days ahead. Omit it to send now.
3164
- */
3165
- scheduled_at?: string;
3166
3405
  };
3167
3406
  /**
3168
3407
  * Adds and removes the same tags on many contacts. Their other tags stay.
@@ -3518,248 +3757,22 @@ export type UpdateKnowledgeFile = {
3518
3757
  */
3519
3758
  consult_enabled?: boolean;
3520
3759
  /**
3521
- * Agents may send the file itself.
3522
- */
3523
- send_enabled?: boolean;
3524
- };
3525
- /**
3526
- * A template draft. Ricky checks it as `POST /templates/validate` does, then submits it.
3527
- */
3528
- export type CreateTemplate = {
3529
- /**
3530
- * WhatsApp channel whose business account will own the template.
3531
- */
3532
- channel_id: string;
3533
- /**
3534
- * Lowercase letters, digits and underscores, starting with a letter.
3535
- */
3536
- name: string;
3537
- /**
3538
- * Language code, for example `es` or `en_US`.
3539
- */
3540
- language: string;
3541
- /**
3542
- * `UTILITY` for updates on something the customer asked for; `MARKETING` otherwise.
3543
- */
3544
- category: 'MARKETING' | 'UTILITY';
3545
- /**
3546
- * How variables are written: `{{first_name}}` or `{{1}}`. It cannot change later.
3547
- */
3548
- parameter_format?: 'NAMED' | 'POSITIONAL';
3549
- /**
3550
- * `TEXT` or `LOCATION`. Send `null` for no header.
3551
- */
3552
- header?: {
3553
- type: 'TEXT';
3554
- /**
3555
- * Header text; at most one variable.
3556
- */
3557
- text: string;
3558
- /**
3559
- * Example value of the header variable; required when it has one.
3560
- */
3561
- example?: string;
3562
- } | {
3563
- type: 'LOCATION';
3564
- } | null;
3565
- /**
3566
- * The message text.
3567
- */
3568
- body: {
3569
- /**
3570
- * Body text. Variables are `{{1}}`, `{{2}}`… for `POSITIONAL` and `{{first_name}}` for `NAMED`; not at the very start or end.
3571
- */
3572
- text: string;
3573
- /**
3574
- * An example value for every variable, keyed by its number or name without braces. Meta reviews them.
3575
- */
3576
- examples?: {
3577
- [key: string]: string;
3578
- };
3579
- };
3580
- /**
3581
- * Footer text, without variables.
3582
- */
3583
- footer?: string | null;
3584
- /**
3585
- * Quick replies, at most two links and one phone. Quick replies cannot sit between the other buttons.
3586
- */
3587
- buttons?: Array<{
3588
- type: 'QUICK_REPLY';
3589
- text: string;
3590
- } | {
3591
- type: 'URL';
3592
- text: string;
3593
- /**
3594
- * Link the button opens; it may end in the variable `{{1}}`.
3595
- */
3596
- url: string;
3597
- /**
3598
- * Example URL for a link with `{{1}}`; required when it has one.
3599
- */
3600
- example?: string;
3601
- } | {
3602
- type: 'PHONE_NUMBER';
3603
- text: string;
3604
- /**
3605
- * Phone the button calls, with country code.
3606
- */
3607
- phone_number: string;
3608
- }>;
3609
- };
3610
- /**
3611
- * The body of `POST /templates`; `channel_id` is optional here.
3612
- */
3613
- export type ValidateTemplate = {
3614
- /**
3615
- * WhatsApp channel whose business account will own the template.
3616
- */
3617
- channel_id?: string;
3618
- /**
3619
- * Lowercase letters, digits and underscores, starting with a letter.
3620
- */
3621
- name: string;
3622
- /**
3623
- * Language code, for example `es` or `en_US`.
3624
- */
3625
- language: string;
3626
- /**
3627
- * `UTILITY` for updates on something the customer asked for; `MARKETING` otherwise.
3628
- */
3629
- category: 'MARKETING' | 'UTILITY';
3630
- /**
3631
- * How variables are written: `{{first_name}}` or `{{1}}`. It cannot change later.
3632
- */
3633
- parameter_format?: 'NAMED' | 'POSITIONAL';
3634
- /**
3635
- * `TEXT` or `LOCATION`. Send `null` for no header.
3636
- */
3637
- header?: {
3638
- type: 'TEXT';
3639
- /**
3640
- * Header text; at most one variable.
3641
- */
3642
- text: string;
3643
- /**
3644
- * Example value of the header variable; required when it has one.
3645
- */
3646
- example?: string;
3647
- } | {
3648
- type: 'LOCATION';
3649
- } | null;
3650
- /**
3651
- * The message text.
3652
- */
3653
- body: {
3654
- /**
3655
- * Body text. Variables are `{{1}}`, `{{2}}`… for `POSITIONAL` and `{{first_name}}` for `NAMED`; not at the very start or end.
3656
- */
3657
- text: string;
3658
- /**
3659
- * An example value for every variable, keyed by its number or name without braces. Meta reviews them.
3660
- */
3661
- examples?: {
3662
- [key: string]: string;
3663
- };
3664
- };
3665
- /**
3666
- * Footer text, without variables.
3667
- */
3668
- footer?: string | null;
3669
- /**
3670
- * Quick replies, at most two links and one phone. Quick replies cannot sit between the other buttons.
3671
- */
3672
- buttons?: Array<{
3673
- type: 'QUICK_REPLY';
3674
- text: string;
3675
- } | {
3676
- type: 'URL';
3677
- text: string;
3678
- /**
3679
- * Link the button opens; it may end in the variable `{{1}}`.
3680
- */
3681
- url: string;
3682
- /**
3683
- * Example URL for a link with `{{1}}`; required when it has one.
3684
- */
3685
- example?: string;
3686
- } | {
3687
- type: 'PHONE_NUMBER';
3688
- text: string;
3689
- /**
3690
- * Phone the button calls, with country code.
3691
- */
3692
- phone_number: string;
3693
- }>;
3694
- };
3695
- /**
3696
- * Only the parts you send change; `buttons` replaces every button. Name, language and `parameter_format` cannot change.
3697
- */
3698
- export type UpdateTemplate = {
3699
- /**
3700
- * `UTILITY` for updates on something the customer asked for; `MARKETING` otherwise.
3701
- */
3702
- category?: 'MARKETING' | 'UTILITY';
3703
- /**
3704
- * `TEXT` or `LOCATION`. Send `null` for no header.
3705
- */
3706
- header?: {
3707
- type: 'TEXT';
3708
- /**
3709
- * Header text; at most one variable.
3710
- */
3711
- text: string;
3712
- /**
3713
- * Example value of the header variable; required when it has one.
3714
- */
3715
- example?: string;
3716
- } | {
3717
- type: 'LOCATION';
3718
- } | null;
3719
- /**
3720
- * The message text.
3721
- */
3722
- body?: {
3723
- /**
3724
- * Body text. Variables are `{{1}}`, `{{2}}`… for `POSITIONAL` and `{{first_name}}` for `NAMED`; not at the very start or end.
3725
- */
3726
- text: string;
3727
- /**
3728
- * An example value for every variable, keyed by its number or name without braces. Meta reviews them.
3729
- */
3730
- examples?: {
3731
- [key: string]: string;
3732
- };
3733
- };
3760
+ * Agents may send the file itself.
3761
+ */
3762
+ send_enabled?: boolean;
3763
+ };
3764
+ /**
3765
+ * The file every send of the workflow carries in its template header.
3766
+ */
3767
+ export type UploadWorkflowHeaderMedia = {
3734
3768
  /**
3735
- * Footer text, without variables.
3769
+ * Public HTTPS address Ricky downloads the file from. It must not redirect or resolve to a private address, and its `Content-Type` must be the kind the template header takes (image, video or document) within WhatsApp’s size limit for it.
3736
3770
  */
3737
- footer?: string | null;
3771
+ url: string;
3738
3772
  /**
3739
- * Quick replies, at most two links and one phone. Quick replies cannot sit between the other buttons.
3773
+ * Name to keep for the file; defaults to the last part of the URL.
3740
3774
  */
3741
- buttons?: Array<{
3742
- type: 'QUICK_REPLY';
3743
- text: string;
3744
- } | {
3745
- type: 'URL';
3746
- text: string;
3747
- /**
3748
- * Link the button opens; it may end in the variable `{{1}}`.
3749
- */
3750
- url: string;
3751
- /**
3752
- * Example URL for a link with `{{1}}`; required when it has one.
3753
- */
3754
- example?: string;
3755
- } | {
3756
- type: 'PHONE_NUMBER';
3757
- text: string;
3758
- /**
3759
- * Phone the button calls, with country code.
3760
- */
3761
- phone_number: string;
3762
- }>;
3775
+ file_name?: string;
3763
3776
  };
3764
3777
  /**
3765
3778
  * Creates a conversation workflow as a `draft`. Activating it is a separate call.
@@ -4211,6 +4224,245 @@ export type UpdateWorkflow = {
4211
4224
  };
4212
4225
  };
4213
4226
  };
4227
+ /**
4228
+ * A template draft. Ricky checks it as `POST /templates/validate` does, then submits it.
4229
+ */
4230
+ export type CreateTemplate = {
4231
+ /**
4232
+ * WhatsApp channel whose business account will own the template.
4233
+ */
4234
+ channel_id: string;
4235
+ /**
4236
+ * Lowercase letters, digits and underscores, starting with a letter.
4237
+ */
4238
+ name: string;
4239
+ /**
4240
+ * Language code, for example `es` or `en_US`.
4241
+ */
4242
+ language: string;
4243
+ /**
4244
+ * `UTILITY` for updates on something the customer asked for; `MARKETING` otherwise.
4245
+ */
4246
+ category: 'MARKETING' | 'UTILITY';
4247
+ /**
4248
+ * How variables are written: `{{first_name}}` or `{{1}}`. It cannot change later.
4249
+ */
4250
+ parameter_format?: 'NAMED' | 'POSITIONAL';
4251
+ /**
4252
+ * `TEXT` or `LOCATION`. Send `null` for no header.
4253
+ */
4254
+ header?: {
4255
+ type: 'TEXT';
4256
+ /**
4257
+ * Header text; at most one variable.
4258
+ */
4259
+ text: string;
4260
+ /**
4261
+ * Example value of the header variable; required when it has one.
4262
+ */
4263
+ example?: string;
4264
+ } | {
4265
+ type: 'LOCATION';
4266
+ } | null;
4267
+ /**
4268
+ * The message text.
4269
+ */
4270
+ body: {
4271
+ /**
4272
+ * Body text. Variables are `{{1}}`, `{{2}}`… for `POSITIONAL` and `{{first_name}}` for `NAMED`; not at the very start or end.
4273
+ */
4274
+ text: string;
4275
+ /**
4276
+ * An example value for every variable, keyed by its number or name without braces. Meta reviews them.
4277
+ */
4278
+ examples?: {
4279
+ [key: string]: string;
4280
+ };
4281
+ };
4282
+ /**
4283
+ * Footer text, without variables.
4284
+ */
4285
+ footer?: string | null;
4286
+ /**
4287
+ * Quick replies, at most two links and one phone. Quick replies cannot sit between the other buttons.
4288
+ */
4289
+ buttons?: Array<{
4290
+ type: 'QUICK_REPLY';
4291
+ text: string;
4292
+ } | {
4293
+ type: 'URL';
4294
+ text: string;
4295
+ /**
4296
+ * Link the button opens; it may end in the variable `{{1}}`.
4297
+ */
4298
+ url: string;
4299
+ /**
4300
+ * Example URL for a link with `{{1}}`; required when it has one.
4301
+ */
4302
+ example?: string;
4303
+ } | {
4304
+ type: 'PHONE_NUMBER';
4305
+ text: string;
4306
+ /**
4307
+ * Phone the button calls, with country code.
4308
+ */
4309
+ phone_number: string;
4310
+ }>;
4311
+ };
4312
+ /**
4313
+ * The body of `POST /templates`; `channel_id` is optional here.
4314
+ */
4315
+ export type ValidateTemplate = {
4316
+ /**
4317
+ * WhatsApp channel whose business account will own the template.
4318
+ */
4319
+ channel_id?: string;
4320
+ /**
4321
+ * Lowercase letters, digits and underscores, starting with a letter.
4322
+ */
4323
+ name: string;
4324
+ /**
4325
+ * Language code, for example `es` or `en_US`.
4326
+ */
4327
+ language: string;
4328
+ /**
4329
+ * `UTILITY` for updates on something the customer asked for; `MARKETING` otherwise.
4330
+ */
4331
+ category: 'MARKETING' | 'UTILITY';
4332
+ /**
4333
+ * How variables are written: `{{first_name}}` or `{{1}}`. It cannot change later.
4334
+ */
4335
+ parameter_format?: 'NAMED' | 'POSITIONAL';
4336
+ /**
4337
+ * `TEXT` or `LOCATION`. Send `null` for no header.
4338
+ */
4339
+ header?: {
4340
+ type: 'TEXT';
4341
+ /**
4342
+ * Header text; at most one variable.
4343
+ */
4344
+ text: string;
4345
+ /**
4346
+ * Example value of the header variable; required when it has one.
4347
+ */
4348
+ example?: string;
4349
+ } | {
4350
+ type: 'LOCATION';
4351
+ } | null;
4352
+ /**
4353
+ * The message text.
4354
+ */
4355
+ body: {
4356
+ /**
4357
+ * Body text. Variables are `{{1}}`, `{{2}}`… for `POSITIONAL` and `{{first_name}}` for `NAMED`; not at the very start or end.
4358
+ */
4359
+ text: string;
4360
+ /**
4361
+ * An example value for every variable, keyed by its number or name without braces. Meta reviews them.
4362
+ */
4363
+ examples?: {
4364
+ [key: string]: string;
4365
+ };
4366
+ };
4367
+ /**
4368
+ * Footer text, without variables.
4369
+ */
4370
+ footer?: string | null;
4371
+ /**
4372
+ * Quick replies, at most two links and one phone. Quick replies cannot sit between the other buttons.
4373
+ */
4374
+ buttons?: Array<{
4375
+ type: 'QUICK_REPLY';
4376
+ text: string;
4377
+ } | {
4378
+ type: 'URL';
4379
+ text: string;
4380
+ /**
4381
+ * Link the button opens; it may end in the variable `{{1}}`.
4382
+ */
4383
+ url: string;
4384
+ /**
4385
+ * Example URL for a link with `{{1}}`; required when it has one.
4386
+ */
4387
+ example?: string;
4388
+ } | {
4389
+ type: 'PHONE_NUMBER';
4390
+ text: string;
4391
+ /**
4392
+ * Phone the button calls, with country code.
4393
+ */
4394
+ phone_number: string;
4395
+ }>;
4396
+ };
4397
+ /**
4398
+ * Only the parts you send change; `buttons` replaces every button. Name, language and `parameter_format` cannot change.
4399
+ */
4400
+ export type UpdateTemplate = {
4401
+ /**
4402
+ * `UTILITY` for updates on something the customer asked for; `MARKETING` otherwise.
4403
+ */
4404
+ category?: 'MARKETING' | 'UTILITY';
4405
+ /**
4406
+ * `TEXT` or `LOCATION`. Send `null` for no header.
4407
+ */
4408
+ header?: {
4409
+ type: 'TEXT';
4410
+ /**
4411
+ * Header text; at most one variable.
4412
+ */
4413
+ text: string;
4414
+ /**
4415
+ * Example value of the header variable; required when it has one.
4416
+ */
4417
+ example?: string;
4418
+ } | {
4419
+ type: 'LOCATION';
4420
+ } | null;
4421
+ /**
4422
+ * The message text.
4423
+ */
4424
+ body?: {
4425
+ /**
4426
+ * Body text. Variables are `{{1}}`, `{{2}}`… for `POSITIONAL` and `{{first_name}}` for `NAMED`; not at the very start or end.
4427
+ */
4428
+ text: string;
4429
+ /**
4430
+ * An example value for every variable, keyed by its number or name without braces. Meta reviews them.
4431
+ */
4432
+ examples?: {
4433
+ [key: string]: string;
4434
+ };
4435
+ };
4436
+ /**
4437
+ * Footer text, without variables.
4438
+ */
4439
+ footer?: string | null;
4440
+ /**
4441
+ * Quick replies, at most two links and one phone. Quick replies cannot sit between the other buttons.
4442
+ */
4443
+ buttons?: Array<{
4444
+ type: 'QUICK_REPLY';
4445
+ text: string;
4446
+ } | {
4447
+ type: 'URL';
4448
+ text: string;
4449
+ /**
4450
+ * Link the button opens; it may end in the variable `{{1}}`.
4451
+ */
4452
+ url: string;
4453
+ /**
4454
+ * Example URL for a link with `{{1}}`; required when it has one.
4455
+ */
4456
+ example?: string;
4457
+ } | {
4458
+ type: 'PHONE_NUMBER';
4459
+ text: string;
4460
+ /**
4461
+ * Phone the button calls, with country code.
4462
+ */
4463
+ phone_number: string;
4464
+ }>;
4465
+ };
4214
4466
  /**
4215
4467
  * 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.
4216
4468
  */
@@ -6220,6 +6472,203 @@ export type ListWorkflowExecutionsResponses = {
6220
6472
  };
6221
6473
  };
6222
6474
  export type ListWorkflowExecutionsResponse = ListWorkflowExecutionsResponses[keyof ListWorkflowExecutionsResponses];
6475
+ export type UploadWorkflowHeaderMediaData = {
6476
+ body: UploadWorkflowHeaderMedia;
6477
+ headers?: {
6478
+ /**
6479
+ * 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.
6480
+ */
6481
+ 'Idempotency-Key'?: string;
6482
+ };
6483
+ path: {
6484
+ /**
6485
+ * Workflow ID.
6486
+ */
6487
+ workflow_id: string;
6488
+ };
6489
+ query?: never;
6490
+ url: '/workflows/{workflow_id}/header-media';
6491
+ };
6492
+ export type UploadWorkflowHeaderMediaErrors = {
6493
+ /**
6494
+ * `invalid_json`: The body is not valid JSON.
6495
+ *
6496
+ * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
6497
+ */
6498
+ 400: Error;
6499
+ /**
6500
+ * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
6501
+ */
6502
+ 401: Error;
6503
+ /**
6504
+ * `insufficient_scope`: The key lacks the scope this operation requires.
6505
+ */
6506
+ 403: Error;
6507
+ /**
6508
+ * `not_found`: The resource does not exist in this organization.
6509
+ */
6510
+ 404: Error;
6511
+ /**
6512
+ * `idempotency_conflict`: The `Idempotency-Key` was used for a different request.
6513
+ *
6514
+ * `request_processing`: A request with this `Idempotency-Key` is still processing or ended in an unknown state.
6515
+ */
6516
+ 409: Error;
6517
+ /**
6518
+ * `body_too_large`: The JSON body exceeds 64 KiB.
6519
+ */
6520
+ 413: Error;
6521
+ /**
6522
+ * `unsupported_media_type`: The body must be `application/json`.
6523
+ */
6524
+ 415: Error;
6525
+ /**
6526
+ * `rule_violation`: The request breaks a business rule; `message` says which.
6527
+ */
6528
+ 422: Error;
6529
+ /**
6530
+ * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
6531
+ */
6532
+ 429: Error;
6533
+ /**
6534
+ * `internal_error`: Ricky failed. Retry a read. Before retrying a write, read the resource: the same `Idempotency-Key` answers `request_processing`.
6535
+ */
6536
+ 500: Error;
6537
+ /**
6538
+ * `upstream_error`: The messaging provider failed. Retry later.
6539
+ */
6540
+ 502: Error;
6541
+ };
6542
+ export type UploadWorkflowHeaderMediaError = UploadWorkflowHeaderMediaErrors[keyof UploadWorkflowHeaderMediaErrors];
6543
+ export type UploadWorkflowHeaderMediaResponses = {
6544
+ /**
6545
+ * Success.
6546
+ */
6547
+ 200: {
6548
+ data: Workflow;
6549
+ };
6550
+ };
6551
+ export type UploadWorkflowHeaderMediaResponse = UploadWorkflowHeaderMediaResponses[keyof UploadWorkflowHeaderMediaResponses];
6552
+ export type PreviewWorkflowRemindersData = {
6553
+ body?: never;
6554
+ path: {
6555
+ /**
6556
+ * Workflow ID.
6557
+ */
6558
+ workflow_id: string;
6559
+ };
6560
+ query: {
6561
+ /**
6562
+ * Day the workflow would send, `YYYY-MM-DD` in its time zone: its next run or a later day.
6563
+ */
6564
+ date: string;
6565
+ /**
6566
+ * Odoo states to remind instead of the workflow’s, comma-separated, to see what a change would do. Omit it to use the workflow’s.
6567
+ */
6568
+ appointment_states?: string;
6569
+ };
6570
+ url: '/workflows/{workflow_id}/reminders/preview';
6571
+ };
6572
+ export type PreviewWorkflowRemindersErrors = {
6573
+ /**
6574
+ * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
6575
+ */
6576
+ 400: Error;
6577
+ /**
6578
+ * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
6579
+ */
6580
+ 401: Error;
6581
+ /**
6582
+ * `insufficient_scope`: The key lacks the scope this operation requires.
6583
+ */
6584
+ 403: Error;
6585
+ /**
6586
+ * `not_found`: The resource does not exist in this organization.
6587
+ */
6588
+ 404: Error;
6589
+ /**
6590
+ * `rule_violation`: The request breaks a business rule; `message` says which.
6591
+ */
6592
+ 422: Error;
6593
+ /**
6594
+ * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
6595
+ */
6596
+ 429: Error;
6597
+ /**
6598
+ * `internal_error`: Ricky failed. Retry a read. Before retrying a write, read the resource: the same `Idempotency-Key` answers `request_processing`.
6599
+ */
6600
+ 500: Error;
6601
+ /**
6602
+ * `upstream_error`: The messaging provider failed. Retry later.
6603
+ */
6604
+ 502: Error;
6605
+ };
6606
+ export type PreviewWorkflowRemindersError = PreviewWorkflowRemindersErrors[keyof PreviewWorkflowRemindersErrors];
6607
+ export type PreviewWorkflowRemindersResponses = {
6608
+ /**
6609
+ * Success.
6610
+ */
6611
+ 200: {
6612
+ data: ReminderPreview;
6613
+ };
6614
+ };
6615
+ export type PreviewWorkflowRemindersResponse = PreviewWorkflowRemindersResponses[keyof PreviewWorkflowRemindersResponses];
6616
+ export type GetWorkflowReminderHistoryData = {
6617
+ body?: never;
6618
+ path: {
6619
+ /**
6620
+ * Workflow ID.
6621
+ */
6622
+ workflow_id: string;
6623
+ };
6624
+ query: {
6625
+ /**
6626
+ * Day the workflow ran, `YYYY-MM-DD` in its time zone.
6627
+ */
6628
+ date: string;
6629
+ };
6630
+ url: '/workflows/{workflow_id}/reminders/history';
6631
+ };
6632
+ export type GetWorkflowReminderHistoryErrors = {
6633
+ /**
6634
+ * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
6635
+ */
6636
+ 400: Error;
6637
+ /**
6638
+ * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
6639
+ */
6640
+ 401: Error;
6641
+ /**
6642
+ * `insufficient_scope`: The key lacks the scope this operation requires.
6643
+ */
6644
+ 403: Error;
6645
+ /**
6646
+ * `not_found`: The resource does not exist in this organization.
6647
+ */
6648
+ 404: Error;
6649
+ /**
6650
+ * `rule_violation`: The request breaks a business rule; `message` says which.
6651
+ */
6652
+ 422: Error;
6653
+ /**
6654
+ * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
6655
+ */
6656
+ 429: Error;
6657
+ /**
6658
+ * `internal_error`: Ricky failed. Retry a read. Before retrying a write, read the resource: the same `Idempotency-Key` answers `request_processing`.
6659
+ */
6660
+ 500: Error;
6661
+ };
6662
+ export type GetWorkflowReminderHistoryError = GetWorkflowReminderHistoryErrors[keyof GetWorkflowReminderHistoryErrors];
6663
+ export type GetWorkflowReminderHistoryResponses = {
6664
+ /**
6665
+ * Success.
6666
+ */
6667
+ 200: {
6668
+ data: ReminderHistory;
6669
+ };
6670
+ };
6671
+ export type GetWorkflowReminderHistoryResponse = GetWorkflowReminderHistoryResponses[keyof GetWorkflowReminderHistoryResponses];
6223
6672
  export type GetDashboardReportData = {
6224
6673
  body?: never;
6225
6674
  path?: never;
@@ -9603,6 +10052,58 @@ export type FetchMessageMediaResponses = {
9603
10052
  };
9604
10053
  };
9605
10054
  export type FetchMessageMediaResponse = FetchMessageMediaResponses[keyof FetchMessageMediaResponses];
10055
+ export type PreviewBroadcastAudienceData = {
10056
+ body: PreviewBroadcastAudience;
10057
+ path?: never;
10058
+ query?: never;
10059
+ url: '/broadcasts/preview';
10060
+ };
10061
+ export type PreviewBroadcastAudienceErrors = {
10062
+ /**
10063
+ * `invalid_json`: The body is not valid JSON.
10064
+ *
10065
+ * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
10066
+ */
10067
+ 400: Error;
10068
+ /**
10069
+ * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
10070
+ */
10071
+ 401: Error;
10072
+ /**
10073
+ * `insufficient_scope`: The key lacks the scope this operation requires.
10074
+ */
10075
+ 403: Error;
10076
+ /**
10077
+ * `not_found`: The resource does not exist in this organization.
10078
+ */
10079
+ 404: Error;
10080
+ /**
10081
+ * `body_too_large`: The JSON body exceeds 64 KiB.
10082
+ */
10083
+ 413: Error;
10084
+ /**
10085
+ * `unsupported_media_type`: The body must be `application/json`.
10086
+ */
10087
+ 415: Error;
10088
+ /**
10089
+ * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
10090
+ */
10091
+ 429: Error;
10092
+ /**
10093
+ * `internal_error`: Ricky failed. Retry a read. Before retrying a write, read the resource: the same `Idempotency-Key` answers `request_processing`.
10094
+ */
10095
+ 500: Error;
10096
+ };
10097
+ export type PreviewBroadcastAudienceError = PreviewBroadcastAudienceErrors[keyof PreviewBroadcastAudienceErrors];
10098
+ export type PreviewBroadcastAudienceResponses = {
10099
+ /**
10100
+ * Success.
10101
+ */
10102
+ 200: {
10103
+ data: BroadcastAudiencePreview;
10104
+ };
10105
+ };
10106
+ export type PreviewBroadcastAudienceResponse = PreviewBroadcastAudienceResponses[keyof PreviewBroadcastAudienceResponses];
9606
10107
  export type WebhookMessageReceivedWebhookPayload = WebhookEvent;
9607
10108
  export type WebhookMessageReceivedWebhookRequest = {
9608
10109
  body: WebhookMessageReceivedWebhookPayload;
@@ -9659,6 +10160,27 @@ export type WebhookConversationAssignmentChangedWebhookRequest = {
9659
10160
  path?: never;
9660
10161
  query?: never;
9661
10162
  };
10163
+ export type WebhookConversationAgentChangedWebhookPayload = WebhookEvent;
10164
+ export type WebhookConversationAgentChangedWebhookRequest = {
10165
+ body: WebhookConversationAgentChangedWebhookPayload;
10166
+ key: 'conversation.agent_changed';
10167
+ path?: never;
10168
+ query?: never;
10169
+ };
10170
+ export type WebhookConversationHandoffRequestedWebhookPayload = WebhookEvent;
10171
+ export type WebhookConversationHandoffRequestedWebhookRequest = {
10172
+ body: WebhookConversationHandoffRequestedWebhookPayload;
10173
+ key: 'conversation.handoff_requested';
10174
+ path?: never;
10175
+ query?: never;
10176
+ };
10177
+ export type WebhookConversationHandoffResolvedWebhookPayload = WebhookEvent;
10178
+ export type WebhookConversationHandoffResolvedWebhookRequest = {
10179
+ body: WebhookConversationHandoffResolvedWebhookPayload;
10180
+ key: 'conversation.handoff_resolved';
10181
+ path?: never;
10182
+ query?: never;
10183
+ };
9662
10184
  export type WebhookContactCreatedWebhookPayload = WebhookEvent;
9663
10185
  export type WebhookContactCreatedWebhookRequest = {
9664
10186
  body: WebhookContactCreatedWebhookPayload;
@@ -9673,6 +10195,48 @@ export type WebhookContactUpdatedWebhookRequest = {
9673
10195
  path?: never;
9674
10196
  query?: never;
9675
10197
  };
10198
+ export type WebhookContactTagsChangedWebhookPayload = WebhookEvent;
10199
+ export type WebhookContactTagsChangedWebhookRequest = {
10200
+ body: WebhookContactTagsChangedWebhookPayload;
10201
+ key: 'contact.tags_changed';
10202
+ path?: never;
10203
+ query?: never;
10204
+ };
10205
+ export type WebhookBroadcastCompletedWebhookPayload = WebhookEvent;
10206
+ export type WebhookBroadcastCompletedWebhookRequest = {
10207
+ body: WebhookBroadcastCompletedWebhookPayload;
10208
+ key: 'broadcast.completed';
10209
+ path?: never;
10210
+ query?: never;
10211
+ };
10212
+ export type WebhookBroadcastFailedWebhookPayload = WebhookEvent;
10213
+ export type WebhookBroadcastFailedWebhookRequest = {
10214
+ body: WebhookBroadcastFailedWebhookPayload;
10215
+ key: 'broadcast.failed';
10216
+ path?: never;
10217
+ query?: never;
10218
+ };
10219
+ export type WebhookTemplateStatusChangedWebhookPayload = WebhookEvent;
10220
+ export type WebhookTemplateStatusChangedWebhookRequest = {
10221
+ body: WebhookTemplateStatusChangedWebhookPayload;
10222
+ key: 'template.status_changed';
10223
+ path?: never;
10224
+ query?: never;
10225
+ };
10226
+ export type WebhookWorkflowExecutionFailedWebhookPayload = WebhookEvent;
10227
+ export type WebhookWorkflowExecutionFailedWebhookRequest = {
10228
+ body: WebhookWorkflowExecutionFailedWebhookPayload;
10229
+ key: 'workflow.execution_failed';
10230
+ path?: never;
10231
+ query?: never;
10232
+ };
10233
+ export type WebhookKnowledgeFileReadyWebhookPayload = WebhookEvent;
10234
+ export type WebhookKnowledgeFileReadyWebhookRequest = {
10235
+ body: WebhookKnowledgeFileReadyWebhookPayload;
10236
+ key: 'knowledge_file.ready';
10237
+ path?: never;
10238
+ query?: never;
10239
+ };
9676
10240
  export type WebhookWebhookTestWebhookPayload = WebhookEvent;
9677
10241
  export type WebhookWebhookTestWebhookRequest = {
9678
10242
  body: WebhookWebhookTestWebhookPayload;