retell-sdk 5.64.0 → 5.66.0

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.
Files changed (129) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +29 -0
  3. package/client.d.mts +9 -6
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +9 -6
  6. package/client.d.ts.map +1 -1
  7. package/client.js +3 -0
  8. package/client.js.map +1 -1
  9. package/client.mjs +3 -0
  10. package/client.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/resources/agent.d.mts +43 -13
  13. package/resources/agent.d.mts.map +1 -1
  14. package/resources/agent.d.ts +43 -13
  15. package/resources/agent.d.ts.map +1 -1
  16. package/resources/agent.js +21 -2
  17. package/resources/agent.js.map +1 -1
  18. package/resources/agent.mjs +21 -2
  19. package/resources/agent.mjs.map +1 -1
  20. package/resources/app.d.mts +28 -46
  21. package/resources/app.d.mts.map +1 -1
  22. package/resources/app.d.ts +28 -46
  23. package/resources/app.d.ts.map +1 -1
  24. package/resources/app.js +7 -5
  25. package/resources/app.js.map +1 -1
  26. package/resources/app.mjs +7 -5
  27. package/resources/app.mjs.map +1 -1
  28. package/resources/asset.d.mts +53 -0
  29. package/resources/asset.d.mts.map +1 -0
  30. package/resources/asset.d.ts +53 -0
  31. package/resources/asset.d.ts.map +1 -0
  32. package/resources/asset.js +20 -0
  33. package/resources/asset.js.map +1 -0
  34. package/resources/asset.mjs +16 -0
  35. package/resources/asset.mjs.map +1 -0
  36. package/resources/batch-call.d.mts +4 -2
  37. package/resources/batch-call.d.mts.map +1 -1
  38. package/resources/batch-call.d.ts +4 -2
  39. package/resources/batch-call.d.ts.map +1 -1
  40. package/resources/call.d.mts +155 -21
  41. package/resources/call.d.mts.map +1 -1
  42. package/resources/call.d.ts +155 -21
  43. package/resources/call.d.ts.map +1 -1
  44. package/resources/call.js +37 -5
  45. package/resources/call.js.map +1 -1
  46. package/resources/call.mjs +37 -5
  47. package/resources/call.mjs.map +1 -1
  48. package/resources/chat-agent.d.mts +2 -2
  49. package/resources/chat-agent.d.mts.map +1 -1
  50. package/resources/chat-agent.d.ts +2 -2
  51. package/resources/chat-agent.d.ts.map +1 -1
  52. package/resources/chat.d.mts +24 -11
  53. package/resources/chat.d.mts.map +1 -1
  54. package/resources/chat.d.ts +24 -11
  55. package/resources/chat.d.ts.map +1 -1
  56. package/resources/contact.d.mts +137 -26
  57. package/resources/contact.d.mts.map +1 -1
  58. package/resources/contact.d.ts +137 -26
  59. package/resources/contact.d.ts.map +1 -1
  60. package/resources/contact.js +23 -4
  61. package/resources/contact.js.map +1 -1
  62. package/resources/contact.mjs +23 -4
  63. package/resources/contact.mjs.map +1 -1
  64. package/resources/conversation-flow-component.d.mts +182 -2
  65. package/resources/conversation-flow-component.d.mts.map +1 -1
  66. package/resources/conversation-flow-component.d.ts +182 -2
  67. package/resources/conversation-flow-component.d.ts.map +1 -1
  68. package/resources/conversation-flow.d.mts +362 -2
  69. package/resources/conversation-flow.d.mts.map +1 -1
  70. package/resources/conversation-flow.d.ts +362 -2
  71. package/resources/conversation-flow.d.ts.map +1 -1
  72. package/resources/crm.d.mts +4 -0
  73. package/resources/crm.d.mts.map +1 -1
  74. package/resources/crm.d.ts +4 -0
  75. package/resources/crm.d.ts.map +1 -1
  76. package/resources/export-request.d.mts +2 -2
  77. package/resources/export-request.d.mts.map +1 -1
  78. package/resources/export-request.d.ts +2 -2
  79. package/resources/export-request.d.ts.map +1 -1
  80. package/resources/index.d.mts +4 -3
  81. package/resources/index.d.mts.map +1 -1
  82. package/resources/index.d.ts +4 -3
  83. package/resources/index.d.ts.map +1 -1
  84. package/resources/index.js +3 -1
  85. package/resources/index.js.map +1 -1
  86. package/resources/index.mjs +1 -0
  87. package/resources/index.mjs.map +1 -1
  88. package/resources/knowledge-base.d.mts +7 -7
  89. package/resources/knowledge-base.d.ts +7 -7
  90. package/resources/llm.d.mts +38 -2
  91. package/resources/llm.d.mts.map +1 -1
  92. package/resources/llm.d.ts +38 -2
  93. package/resources/llm.d.ts.map +1 -1
  94. package/resources/phone-number.d.mts +14 -8
  95. package/resources/phone-number.d.mts.map +1 -1
  96. package/resources/phone-number.d.ts +14 -8
  97. package/resources/phone-number.d.ts.map +1 -1
  98. package/resources/tests.d.mts +6 -6
  99. package/resources/tests.d.mts.map +1 -1
  100. package/resources/tests.d.ts +6 -6
  101. package/resources/tests.d.ts.map +1 -1
  102. package/resources/voice.d.mts +4 -4
  103. package/resources/voice.d.mts.map +1 -1
  104. package/resources/voice.d.ts +4 -4
  105. package/resources/voice.d.ts.map +1 -1
  106. package/src/client.ts +31 -0
  107. package/src/resources/agent.ts +60 -9
  108. package/src/resources/app.ts +29 -58
  109. package/src/resources/asset.ts +69 -0
  110. package/src/resources/batch-call.ts +6 -1
  111. package/src/resources/call.ts +196 -18
  112. package/src/resources/chat-agent.ts +2 -2
  113. package/src/resources/chat.ts +28 -11
  114. package/src/resources/contact.ts +187 -26
  115. package/src/resources/conversation-flow-component.ts +206 -2
  116. package/src/resources/conversation-flow.ts +410 -2
  117. package/src/resources/crm.ts +5 -0
  118. package/src/resources/export-request.ts +2 -2
  119. package/src/resources/index.ts +12 -0
  120. package/src/resources/knowledge-base.ts +7 -7
  121. package/src/resources/llm.ts +38 -2
  122. package/src/resources/phone-number.ts +14 -8
  123. package/src/resources/tests.ts +6 -6
  124. package/src/resources/voice.ts +4 -4
  125. package/src/version.ts +1 -1
  126. package/version.d.mts +1 -1
  127. package/version.d.ts +1 -1
  128. package/version.js +1 -1
  129. package/version.mjs +1 -1
@@ -2,8 +2,10 @@
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
+ import { type Uploadable } from '../core/uploads';
5
6
  import { buildHeaders } from '../internal/headers';
6
7
  import { RequestOptions } from '../internal/request-options';
8
+ import { multipartFormRequestOptions } from '../internal/uploads';
7
9
  import { path } from '../internal/utils/path';
8
10
 
9
11
  export class Contact extends APIResource {
@@ -50,10 +52,6 @@ export class Contact extends APIResource {
50
52
  });
51
53
  }
52
54
 
53
- /**
54
- * Trigger a backfill job that re-applies analysis data mappings to contacts using
55
- * historical call data. Only one backfill job can run per organization at a time.
56
- */
57
55
  backfillAnalysisData(
58
56
  body: ContactBackfillAnalysisDataParams,
59
57
  options?: RequestOptions,
@@ -61,6 +59,19 @@ export class Contact extends APIResource {
61
59
  return this._client.post('/backfill-contact-analysis-data', { body, ...options });
62
60
  }
63
61
 
62
+ /**
63
+ * Start an incremental contact import from an uploaded CSV: creates new contacts
64
+ * and updates existing ones matched by phone number. Mapped columns overwrite the
65
+ * matched contact's fields; unmapped columns are ignored. Runs asynchronously —
66
+ * poll get-contact-import for progress.
67
+ */
68
+ createImport(
69
+ body: ContactCreateImportParams,
70
+ options?: RequestOptions,
71
+ ): APIPromise<ContactCreateImportResponse> {
72
+ return this._client.post('/create-contact-import', { body, ...options });
73
+ }
74
+
64
75
  /**
65
76
  * Retrieve a contact by ID.
66
77
  */
@@ -83,6 +94,13 @@ export class Contact extends APIResource {
83
94
  return this._client.get(path`/get-contact-by-phone/${phoneNumber}`, options);
84
95
  }
85
96
 
97
+ /**
98
+ * Status and counts for the org's current or latest contact import.
99
+ */
100
+ getImport(options?: RequestOptions): APIPromise<ContactGetImportResponse> {
101
+ return this._client.get('/get-contact-import', options);
102
+ }
103
+
86
104
  /**
87
105
  * List a contact's conversations (inbound calls, outbound calls, and chats) merged
88
106
  * into a single timeline, most recent first. Results are matched by the contact's
@@ -95,6 +113,20 @@ export class Contact extends APIResource {
95
113
  ): APIPromise<ContactListConversationsResponse> {
96
114
  return this._client.get(path`/list-contact-conversations/${contactID}`, { query, ...options });
97
115
  }
116
+
117
+ /**
118
+ * Upload a CSV file for a contact import. The file is stored privately and
119
+ * referenced by the returned upload_id in create-contact-import.
120
+ */
121
+ uploadImportFile(
122
+ body: ContactUploadImportFileParams,
123
+ options?: RequestOptions,
124
+ ): APIPromise<ContactUploadImportFileResponse> {
125
+ return this._client.post(
126
+ '/upload-contact-import-file',
127
+ multipartFormRequestOptions({ body, ...options }, this._client),
128
+ );
129
+ }
98
130
  }
99
131
 
100
132
  export interface ContactResponse {
@@ -153,6 +185,11 @@ export interface ContactResponse {
153
185
  */
154
186
  last_name?: string;
155
187
 
188
+ /**
189
+ * Tags assigned to the contact.
190
+ */
191
+ tags?: Array<string>;
192
+
156
193
  /**
157
194
  * Epoch milliseconds when the contact was last modified.
158
195
  */
@@ -160,12 +197,15 @@ export interface ContactResponse {
160
197
  }
161
198
 
162
199
  export interface ContactListResponse {
163
- has_more?: boolean;
200
+ /**
201
+ * Whether more results are available.
202
+ */
203
+ has_more: boolean;
164
204
 
165
- items?: Array<ContactResponse>;
205
+ items: Array<ContactResponse>;
166
206
 
167
207
  /**
168
- * Base64url-encoded pagination key for the next page.
208
+ * Pagination key for the next page.
169
209
  */
170
210
  pagination_key?: string;
171
211
 
@@ -200,6 +240,31 @@ export interface ContactBackfillAnalysisDataResponse {
200
240
  triggered_by?: 'manual' | 'cron';
201
241
  }
202
242
 
243
+ export interface ContactCreateImportResponse {
244
+ status: 'queued' | 'running' | 'idle';
245
+
246
+ /**
247
+ * Number of items that errored so far.
248
+ */
249
+ failed?: number;
250
+
251
+ /**
252
+ * Epoch milliseconds when the job started.
253
+ */
254
+ start_timestamp?: number;
255
+
256
+ /**
257
+ * Number of items processed successfully so far.
258
+ */
259
+ succeeded?: number;
260
+
261
+ /**
262
+ * Whether the job was started by an explicit API call (`manual`) or by the
263
+ * scheduled sync (`cron`).
264
+ */
265
+ triggered_by?: 'manual' | 'cron';
266
+ }
267
+
203
268
  export interface ContactGetBackfillJobStatusResponse {
204
269
  status: 'queued' | 'running' | 'idle';
205
270
 
@@ -225,17 +290,41 @@ export interface ContactGetBackfillJobStatusResponse {
225
290
  triggered_by?: 'manual' | 'cron';
226
291
  }
227
292
 
293
+ export interface ContactGetImportResponse {
294
+ status: 'queued' | 'running' | 'idle';
295
+
296
+ /**
297
+ * Number of items that errored so far.
298
+ */
299
+ failed?: number;
300
+
301
+ /**
302
+ * Epoch milliseconds when the job started.
303
+ */
304
+ start_timestamp?: number;
305
+
306
+ /**
307
+ * Number of items processed successfully so far.
308
+ */
309
+ succeeded?: number;
310
+
311
+ /**
312
+ * Whether the job was started by an explicit API call (`manual`) or by the
313
+ * scheduled sync (`cron`).
314
+ */
315
+ triggered_by?: 'manual' | 'cron';
316
+ }
317
+
228
318
  export interface ContactListConversationsResponse {
229
319
  /**
230
- * Whether more conversations exist beyond the returned window.
320
+ * Whether more results are available.
231
321
  */
232
- has_more?: boolean;
322
+ has_more: boolean;
233
323
 
234
- items?: Array<ContactListConversationsResponse.ContactCall | ContactListConversationsResponse.ContactChat>;
324
+ items: Array<ContactListConversationsResponse.ContactCall | ContactListConversationsResponse.ContactChat>;
235
325
 
236
326
  /**
237
- * Base64url-encoded pagination key. Pass as `pagination_key` query parameter to
238
- * fetch the next page.
327
+ * Pagination key for the next page.
239
328
  */
240
329
  pagination_key?: string;
241
330
  }
@@ -324,6 +413,12 @@ export namespace ContactListConversationsResponse {
324
413
  }
325
414
  }
326
415
 
416
+ export interface ContactUploadImportFileResponse {
417
+ file_name?: string;
418
+
419
+ upload_id?: string;
420
+ }
421
+
327
422
  export interface ContactCreateParams {
328
423
  /**
329
424
  * Phone number of the contact.
@@ -347,6 +442,11 @@ export interface ContactCreateParams {
347
442
  * Last name of the contact.
348
443
  */
349
444
  last_name?: string;
445
+
446
+ /**
447
+ * Full set of tags for the contact.
448
+ */
449
+ tags?: Array<string>;
350
450
  }
351
451
 
352
452
  export interface ContactUpdateParams {
@@ -367,6 +467,11 @@ export interface ContactUpdateParams {
367
467
  * Last name of the contact.
368
468
  */
369
469
  last_name?: string;
470
+
471
+ /**
472
+ * Full replacement set of tags for the contact.
473
+ */
474
+ tags?: Array<string>;
370
475
  }
371
476
 
372
477
  export interface ContactListParams {
@@ -448,6 +553,11 @@ export namespace ContactListParams {
448
553
  * number.
449
554
  */
450
555
  phone_number?: FilterCriteria.PhoneNumber;
556
+
557
+ /**
558
+ * Match contacts that have any of the listed tags.
559
+ */
560
+ tags?: FilterCriteria.Tags;
451
561
  }
452
562
 
453
563
  export namespace FilterCriteria {
@@ -628,29 +738,30 @@ export namespace ContactListParams {
628
738
 
629
739
  value: string;
630
740
  }
741
+
742
+ /**
743
+ * Match contacts that have any of the listed tags.
744
+ */
745
+ export interface Tags {
746
+ /**
747
+ * in: value is one of the listed values
748
+ */
749
+ op: 'in';
750
+
751
+ type: 'enum';
752
+
753
+ value: Array<string>;
754
+ }
631
755
  }
632
756
  }
633
757
 
634
758
  export interface ContactBackfillAnalysisDataParams {
635
- /**
636
- * Contact fields to recompute. Each one must still exist as a contact field and
637
- * have an analysis data mapping configured, otherwise the request is rejected
638
- * rather than running a job that writes nothing.
639
- */
640
759
  backfill_attributes: Array<string>;
641
760
 
642
- /**
643
- * Optional call filter to scope which calls are processed. Supports agent and
644
- * start_timestamp from the standard call filter.
645
- */
646
761
  backfill_call_filter?: ContactBackfillAnalysisDataParams.BackfillCallFilter;
647
762
  }
648
763
 
649
764
  export namespace ContactBackfillAnalysisDataParams {
650
- /**
651
- * Optional call filter to scope which calls are processed. Supports agent and
652
- * start_timestamp from the standard call filter.
653
- */
654
765
  export interface BackfillCallFilter {
655
766
  /**
656
767
  * Filter calls by agent. Agents are OR-connected.
@@ -671,7 +782,7 @@ export namespace ContactBackfillAnalysisDataParams {
671
782
  agent_id: string;
672
783
 
673
784
  /**
674
- * Specific versions to filter on. If not provided, all versions are included.
785
+ * Specific versions to filter on. If omitted or empty, all versions are included.
675
786
  */
676
787
  version?: Array<number>;
677
788
  }
@@ -704,6 +815,47 @@ export namespace ContactBackfillAnalysisDataParams {
704
815
  }
705
816
  }
706
817
 
818
+ export interface ContactCreateImportParams {
819
+ /**
820
+ * CSV headers mapped to contact fields. field_name is the contact field and
821
+ * external_field_name is the CSV header. Exactly one mapping must target
822
+ * phone_number. Unmapped columns are ignored.
823
+ */
824
+ column_mapping: Array<ContactCreateImportParams.ColumnMapping>;
825
+
826
+ /**
827
+ * Id returned by upload-contact-import-file.
828
+ */
829
+ upload_id: string;
830
+
831
+ /**
832
+ * Country for parsing phone numbers without a country code. Defaults to US.
833
+ */
834
+ default_country?: string;
835
+
836
+ /**
837
+ * Tags added to every contact in this import. Existing tags are preserved. Omit to
838
+ * leave tags unchanged.
839
+ */
840
+ tags?: Array<string>;
841
+ }
842
+
843
+ export namespace ContactCreateImportParams {
844
+ export interface ColumnMapping {
845
+ /**
846
+ * Field on the CRM's contact object to map to. A name that does not exist there
847
+ * surfaces as an error on the sync job rather than at configuration time.
848
+ */
849
+ external_field_name: string;
850
+
851
+ /**
852
+ * Retell contact field, built-in or custom, to map. Types must be compatible with
853
+ * the CRM field on both sides of the sync.
854
+ */
855
+ field_name: string;
856
+ }
857
+ }
858
+
707
859
  export interface ContactListConversationsParams {
708
860
  /**
709
861
  * Maximum number of items to return.
@@ -716,17 +868,26 @@ export interface ContactListConversationsParams {
716
868
  pagination_key?: string;
717
869
  }
718
870
 
871
+ export interface ContactUploadImportFileParams {
872
+ file: Uploadable;
873
+ }
874
+
719
875
  export declare namespace Contact {
720
876
  export {
721
877
  type ContactResponse as ContactResponse,
722
878
  type ContactListResponse as ContactListResponse,
723
879
  type ContactBackfillAnalysisDataResponse as ContactBackfillAnalysisDataResponse,
880
+ type ContactCreateImportResponse as ContactCreateImportResponse,
724
881
  type ContactGetBackfillJobStatusResponse as ContactGetBackfillJobStatusResponse,
882
+ type ContactGetImportResponse as ContactGetImportResponse,
725
883
  type ContactListConversationsResponse as ContactListConversationsResponse,
884
+ type ContactUploadImportFileResponse as ContactUploadImportFileResponse,
726
885
  type ContactCreateParams as ContactCreateParams,
727
886
  type ContactUpdateParams as ContactUpdateParams,
728
887
  type ContactListParams as ContactListParams,
729
888
  type ContactBackfillAnalysisDataParams as ContactBackfillAnalysisDataParams,
889
+ type ContactCreateImportParams as ContactCreateImportParams,
730
890
  type ContactListConversationsParams as ContactListConversationsParams,
891
+ type ContactUploadImportFileParams as ContactUploadImportFileParams,
731
892
  };
732
893
  }