retell-sdk 5.63.0 → 5.65.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 (147) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +29 -0
  3. package/client.d.mts +20 -8
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +20 -8
  6. package/client.d.ts.map +1 -1
  7. package/client.js +12 -0
  8. package/client.js.map +1 -1
  9. package/client.mjs +12 -0
  10. package/client.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/resources/agent.d.mts +102 -12
  13. package/resources/agent.d.mts.map +1 -1
  14. package/resources/agent.d.ts +102 -12
  15. package/resources/agent.d.ts.map +1 -1
  16. package/resources/agent.js +32 -4
  17. package/resources/agent.js.map +1 -1
  18. package/resources/agent.mjs +32 -4
  19. package/resources/agent.mjs.map +1 -1
  20. package/resources/app.d.mts +439 -0
  21. package/resources/app.d.mts.map +1 -0
  22. package/resources/app.d.ts +439 -0
  23. package/resources/app.d.ts.map +1 -0
  24. package/resources/app.js +69 -0
  25. package/resources/app.js.map +1 -0
  26. package/resources/app.mjs +65 -0
  27. package/resources/app.mjs.map +1 -0
  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 +221 -27
  41. package/resources/call.d.mts.map +1 -1
  42. package/resources/call.d.ts +221 -27
  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 +4 -10
  49. package/resources/chat-agent.d.mts.map +1 -1
  50. package/resources/chat-agent.d.ts +4 -10
  51. package/resources/chat-agent.d.ts.map +1 -1
  52. package/resources/chat-agent.js +2 -8
  53. package/resources/chat-agent.js.map +1 -1
  54. package/resources/chat-agent.mjs +2 -8
  55. package/resources/chat-agent.mjs.map +1 -1
  56. package/resources/chat.d.mts +24 -11
  57. package/resources/chat.d.mts.map +1 -1
  58. package/resources/chat.d.ts +24 -11
  59. package/resources/chat.d.ts.map +1 -1
  60. package/resources/contact.d.mts +669 -0
  61. package/resources/contact.d.mts.map +1 -0
  62. package/resources/contact.d.ts +669 -0
  63. package/resources/contact.d.ts.map +1 -0
  64. package/resources/contact.js +100 -0
  65. package/resources/contact.js.map +1 -0
  66. package/resources/contact.mjs +96 -0
  67. package/resources/contact.mjs.map +1 -0
  68. package/resources/conversation-flow-component.d.mts +56 -8
  69. package/resources/conversation-flow-component.d.mts.map +1 -1
  70. package/resources/conversation-flow-component.d.ts +56 -8
  71. package/resources/conversation-flow-component.d.ts.map +1 -1
  72. package/resources/conversation-flow.d.mts +120 -16
  73. package/resources/conversation-flow.d.mts.map +1 -1
  74. package/resources/conversation-flow.d.ts +120 -16
  75. package/resources/conversation-flow.d.ts.map +1 -1
  76. package/resources/conversation-flow.js +3 -1
  77. package/resources/conversation-flow.js.map +1 -1
  78. package/resources/conversation-flow.mjs +3 -1
  79. package/resources/conversation-flow.mjs.map +1 -1
  80. package/resources/crm.d.mts +226 -0
  81. package/resources/crm.d.mts.map +1 -0
  82. package/resources/crm.d.ts +226 -0
  83. package/resources/crm.d.ts.map +1 -0
  84. package/resources/crm.js +46 -0
  85. package/resources/crm.js.map +1 -0
  86. package/resources/crm.mjs +42 -0
  87. package/resources/crm.mjs.map +1 -0
  88. package/resources/export-request.d.mts +2 -2
  89. package/resources/export-request.d.mts.map +1 -1
  90. package/resources/export-request.d.ts +2 -2
  91. package/resources/export-request.d.ts.map +1 -1
  92. package/resources/index.d.mts +8 -4
  93. package/resources/index.d.mts.map +1 -1
  94. package/resources/index.d.ts +8 -4
  95. package/resources/index.d.ts.map +1 -1
  96. package/resources/index.js +9 -1
  97. package/resources/index.js.map +1 -1
  98. package/resources/index.mjs +4 -0
  99. package/resources/index.mjs.map +1 -1
  100. package/resources/knowledge-base.d.mts +16 -8
  101. package/resources/knowledge-base.d.mts.map +1 -1
  102. package/resources/knowledge-base.d.ts +16 -8
  103. package/resources/knowledge-base.d.ts.map +1 -1
  104. package/resources/llm.d.mts +66 -10
  105. package/resources/llm.d.mts.map +1 -1
  106. package/resources/llm.d.ts +66 -10
  107. package/resources/llm.d.ts.map +1 -1
  108. package/resources/llm.js +3 -1
  109. package/resources/llm.js.map +1 -1
  110. package/resources/llm.mjs +3 -1
  111. package/resources/llm.mjs.map +1 -1
  112. package/resources/phone-number.d.mts +14 -8
  113. package/resources/phone-number.d.mts.map +1 -1
  114. package/resources/phone-number.d.ts +14 -8
  115. package/resources/phone-number.d.ts.map +1 -1
  116. package/resources/tests.d.mts +6 -6
  117. package/resources/tests.d.mts.map +1 -1
  118. package/resources/tests.d.ts +6 -6
  119. package/resources/tests.d.ts.map +1 -1
  120. package/resources/voice.d.mts +4 -4
  121. package/resources/voice.d.mts.map +1 -1
  122. package/resources/voice.d.ts +4 -4
  123. package/resources/voice.d.ts.map +1 -1
  124. package/src/client.ts +116 -0
  125. package/src/resources/agent.ts +141 -9
  126. package/src/resources/app.ts +593 -0
  127. package/src/resources/asset.ts +69 -0
  128. package/src/resources/batch-call.ts +6 -1
  129. package/src/resources/call.ts +289 -25
  130. package/src/resources/chat-agent.ts +4 -10
  131. package/src/resources/chat.ts +28 -11
  132. package/src/resources/contact.ts +910 -0
  133. package/src/resources/conversation-flow-component.ts +56 -8
  134. package/src/resources/conversation-flow.ts +127 -15
  135. package/src/resources/crm.ts +298 -0
  136. package/src/resources/export-request.ts +2 -2
  137. package/src/resources/index.ts +50 -0
  138. package/src/resources/knowledge-base.ts +16 -8
  139. package/src/resources/llm.ts +73 -9
  140. package/src/resources/phone-number.ts +14 -8
  141. package/src/resources/tests.ts +6 -6
  142. package/src/resources/voice.ts +4 -4
  143. package/src/version.ts +1 -1
  144. package/version.d.mts +1 -1
  145. package/version.d.ts +1 -1
  146. package/version.js +1 -1
  147. package/version.mjs +1 -1
@@ -0,0 +1,910 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { type Uploadable } from '../core/uploads';
6
+ import { buildHeaders } from '../internal/headers';
7
+ import { RequestOptions } from '../internal/request-options';
8
+ import { multipartFormRequestOptions } from '../internal/uploads';
9
+ import { path } from '../internal/utils/path';
10
+
11
+ export class Contact extends APIResource {
12
+ /**
13
+ * Create a new contact.
14
+ */
15
+ create(body: ContactCreateParams, options?: RequestOptions): APIPromise<ContactResponse> {
16
+ return this._client.post('/create-contact', { body, ...options });
17
+ }
18
+
19
+ /**
20
+ * Update an existing contact.
21
+ */
22
+ update(
23
+ contactID: string,
24
+ body: ContactUpdateParams,
25
+ options?: RequestOptions,
26
+ ): APIPromise<ContactResponse> {
27
+ return this._client.patch(path`/update-contact/${contactID}`, { body, ...options });
28
+ }
29
+
30
+ /**
31
+ * List contacts, newest conversation first by default, with the total count of
32
+ * matches alongside the page. Page through results with `pagination_key`; `skip`
33
+ * is available for offset-style paging but is slower on large contact sets and can
34
+ * repeat or miss rows as contacts are updated.
35
+ */
36
+ list(
37
+ body: ContactListParams | null | undefined = {},
38
+ options?: RequestOptions,
39
+ ): APIPromise<ContactListResponse> {
40
+ return this._client.post('/list-contacts', { body, ...options });
41
+ }
42
+
43
+ /**
44
+ * Delete a contact. A contact linked to a record in a connected CRM cannot be
45
+ * deleted while two-way sync is active — unlink the CRM app first, otherwise the
46
+ * next sync would recreate it.
47
+ */
48
+ delete(contactID: string, options?: RequestOptions): APIPromise<void> {
49
+ return this._client.delete(path`/delete-contact/${contactID}`, {
50
+ ...options,
51
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
52
+ });
53
+ }
54
+
55
+ /**
56
+ * Trigger a backfill job that re-applies analysis data mappings to contacts using
57
+ * historical call data. Only one backfill job can run per organization at a time.
58
+ */
59
+ backfillAnalysisData(
60
+ body: ContactBackfillAnalysisDataParams,
61
+ options?: RequestOptions,
62
+ ): APIPromise<ContactBackfillAnalysisDataResponse> {
63
+ return this._client.post('/backfill-contact-analysis-data', { body, ...options });
64
+ }
65
+
66
+ /**
67
+ * Start an incremental contact import from an uploaded CSV: creates new contacts
68
+ * and updates existing ones matched by phone number. Mapped columns overwrite the
69
+ * matched contact's fields; unmapped columns are ignored. Runs asynchronously —
70
+ * poll get-contact-import for progress.
71
+ */
72
+ createImport(
73
+ body: ContactCreateImportParams,
74
+ options?: RequestOptions,
75
+ ): APIPromise<ContactCreateImportResponse> {
76
+ return this._client.post('/create-contact-import', { body, ...options });
77
+ }
78
+
79
+ /**
80
+ * Retrieve a contact by ID.
81
+ */
82
+ get(contactID: string, options?: RequestOptions): APIPromise<ContactResponse> {
83
+ return this._client.get(path`/get-contact/${contactID}`, options);
84
+ }
85
+
86
+ /**
87
+ * Get the status of the contact analysis data backfill job.
88
+ */
89
+ getBackfillJobStatus(options?: RequestOptions): APIPromise<ContactGetBackfillJobStatusResponse> {
90
+ return this._client.get('/get-backfill-contact-job-status', options);
91
+ }
92
+
93
+ /**
94
+ * Retrieve a contact by phone number. At most one contact exists per phone number
95
+ * in an organization.
96
+ */
97
+ getByPhone(phoneNumber: string, options?: RequestOptions): APIPromise<ContactResponse> {
98
+ return this._client.get(path`/get-contact-by-phone/${phoneNumber}`, options);
99
+ }
100
+
101
+ /**
102
+ * Status and counts for the org's current or latest contact import.
103
+ */
104
+ getImport(options?: RequestOptions): APIPromise<ContactGetImportResponse> {
105
+ return this._client.get('/get-contact-import', options);
106
+ }
107
+
108
+ /**
109
+ * List a contact's conversations (inbound calls, outbound calls, and chats) merged
110
+ * into a single timeline, most recent first. Results are matched by the contact's
111
+ * phone number. Use the returned `pagination_key` to fetch the next page.
112
+ */
113
+ listConversations(
114
+ contactID: string,
115
+ query: ContactListConversationsParams | null | undefined = {},
116
+ options?: RequestOptions,
117
+ ): APIPromise<ContactListConversationsResponse> {
118
+ return this._client.get(path`/list-contact-conversations/${contactID}`, { query, ...options });
119
+ }
120
+
121
+ /**
122
+ * Upload a CSV file for a contact import. The file is stored privately and
123
+ * referenced by the returned upload_id in create-contact-import.
124
+ */
125
+ uploadImportFile(
126
+ body: ContactUploadImportFileParams,
127
+ options?: RequestOptions,
128
+ ): APIPromise<ContactUploadImportFileResponse> {
129
+ return this._client.post(
130
+ '/upload-contact-import-file',
131
+ multipartFormRequestOptions({ body, ...options }, this._client),
132
+ );
133
+ }
134
+ }
135
+
136
+ export interface ContactResponse {
137
+ /**
138
+ * Unique identifier for the contact.
139
+ */
140
+ contact_id: string;
141
+
142
+ /**
143
+ * Epoch milliseconds when the contact was created.
144
+ */
145
+ created_timestamp: number;
146
+
147
+ /**
148
+ * Organization this contact belongs to.
149
+ */
150
+ org_id: string;
151
+
152
+ /**
153
+ * Phone number of the contact.
154
+ */
155
+ phone_number: string;
156
+
157
+ /**
158
+ * Number of conversations (calls and chats) associated with this contact.
159
+ */
160
+ conversation_count?: number;
161
+
162
+ /**
163
+ * Custom fields defined in CRM config.
164
+ */
165
+ custom_fields?: unknown;
166
+
167
+ /**
168
+ * Whether this contact should not be called.
169
+ */
170
+ do_not_call?: boolean;
171
+
172
+ /**
173
+ * CRM record ID from the external provider.
174
+ */
175
+ external_id?: string;
176
+
177
+ /**
178
+ * First name of the contact.
179
+ */
180
+ first_name?: string;
181
+
182
+ /**
183
+ * Epoch milliseconds of the most recent conversation with this contact.
184
+ */
185
+ last_conversation_timestamp?: number;
186
+
187
+ /**
188
+ * Last name of the contact.
189
+ */
190
+ last_name?: string;
191
+
192
+ /**
193
+ * Tags assigned to the contact.
194
+ */
195
+ tags?: Array<string>;
196
+
197
+ /**
198
+ * Epoch milliseconds when the contact was last modified.
199
+ */
200
+ user_modified_timestamp?: number;
201
+ }
202
+
203
+ export interface ContactListResponse {
204
+ /**
205
+ * Whether more results are available.
206
+ */
207
+ has_more: boolean;
208
+
209
+ items: Array<ContactResponse>;
210
+
211
+ /**
212
+ * Pagination key for the next page.
213
+ */
214
+ pagination_key?: string;
215
+
216
+ /**
217
+ * Total count of contacts matching the filter.
218
+ */
219
+ total?: number;
220
+ }
221
+
222
+ export interface ContactBackfillAnalysisDataResponse {
223
+ status: 'queued' | 'running' | 'idle';
224
+
225
+ /**
226
+ * Number of items that errored so far.
227
+ */
228
+ failed?: number;
229
+
230
+ /**
231
+ * Epoch milliseconds when the job started.
232
+ */
233
+ start_timestamp?: number;
234
+
235
+ /**
236
+ * Number of items processed successfully so far.
237
+ */
238
+ succeeded?: number;
239
+
240
+ /**
241
+ * Whether the job was started by an explicit API call (`manual`) or by the
242
+ * scheduled sync (`cron`).
243
+ */
244
+ triggered_by?: 'manual' | 'cron';
245
+ }
246
+
247
+ export interface ContactCreateImportResponse {
248
+ status: 'queued' | 'running' | 'idle';
249
+
250
+ /**
251
+ * Number of items that errored so far.
252
+ */
253
+ failed?: number;
254
+
255
+ /**
256
+ * Epoch milliseconds when the job started.
257
+ */
258
+ start_timestamp?: number;
259
+
260
+ /**
261
+ * Number of items processed successfully so far.
262
+ */
263
+ succeeded?: number;
264
+
265
+ /**
266
+ * Whether the job was started by an explicit API call (`manual`) or by the
267
+ * scheduled sync (`cron`).
268
+ */
269
+ triggered_by?: 'manual' | 'cron';
270
+ }
271
+
272
+ export interface ContactGetBackfillJobStatusResponse {
273
+ status: 'queued' | 'running' | 'idle';
274
+
275
+ /**
276
+ * Number of items that errored so far.
277
+ */
278
+ failed?: number;
279
+
280
+ /**
281
+ * Epoch milliseconds when the job started.
282
+ */
283
+ start_timestamp?: number;
284
+
285
+ /**
286
+ * Number of items processed successfully so far.
287
+ */
288
+ succeeded?: number;
289
+
290
+ /**
291
+ * Whether the job was started by an explicit API call (`manual`) or by the
292
+ * scheduled sync (`cron`).
293
+ */
294
+ triggered_by?: 'manual' | 'cron';
295
+ }
296
+
297
+ export interface ContactGetImportResponse {
298
+ status: 'queued' | 'running' | 'idle';
299
+
300
+ /**
301
+ * Number of items that errored so far.
302
+ */
303
+ failed?: number;
304
+
305
+ /**
306
+ * Epoch milliseconds when the job started.
307
+ */
308
+ start_timestamp?: number;
309
+
310
+ /**
311
+ * Number of items processed successfully so far.
312
+ */
313
+ succeeded?: number;
314
+
315
+ /**
316
+ * Whether the job was started by an explicit API call (`manual`) or by the
317
+ * scheduled sync (`cron`).
318
+ */
319
+ triggered_by?: 'manual' | 'cron';
320
+ }
321
+
322
+ export interface ContactListConversationsResponse {
323
+ /**
324
+ * Whether more results are available.
325
+ */
326
+ has_more: boolean;
327
+
328
+ items: Array<ContactListConversationsResponse.ContactCall | ContactListConversationsResponse.ContactChat>;
329
+
330
+ /**
331
+ * Pagination key for the next page.
332
+ */
333
+ pagination_key?: string;
334
+ }
335
+
336
+ export namespace ContactListConversationsResponse {
337
+ export interface ContactCall {
338
+ call_id: string;
339
+
340
+ type: 'call';
341
+
342
+ /**
343
+ * Direction of the call.
344
+ */
345
+ direction?: 'inbound' | 'outbound';
346
+
347
+ /**
348
+ * Reason the call ended.
349
+ */
350
+ disconnection_reason?: string;
351
+
352
+ /**
353
+ * Duration of the call in milliseconds.
354
+ */
355
+ duration_ms?: number;
356
+
357
+ /**
358
+ * User sentiment from post-call analysis.
359
+ */
360
+ sentiment?: 'Negative' | 'Positive' | 'Neutral' | 'Unknown';
361
+
362
+ /**
363
+ * Epoch milliseconds when the call started.
364
+ */
365
+ start_timestamp?: number;
366
+
367
+ /**
368
+ * Whether the call was deemed successful by post-call analysis.
369
+ */
370
+ successful?: boolean;
371
+
372
+ /**
373
+ * Post-call analysis summary.
374
+ */
375
+ summary?: string;
376
+ }
377
+
378
+ export interface ContactChat {
379
+ chat_id: string;
380
+
381
+ type: 'chat';
382
+
383
+ /**
384
+ * Direction of the chat.
385
+ */
386
+ direction?: 'inbound' | 'outbound';
387
+
388
+ /**
389
+ * Reason the chat ended.
390
+ */
391
+ disconnection_reason?: string;
392
+
393
+ /**
394
+ * Duration of the chat in milliseconds.
395
+ */
396
+ duration_ms?: number;
397
+
398
+ /**
399
+ * User sentiment from post-chat analysis.
400
+ */
401
+ sentiment?: 'Negative' | 'Positive' | 'Neutral' | 'Unknown';
402
+
403
+ /**
404
+ * Epoch milliseconds when the chat started.
405
+ */
406
+ start_timestamp?: number;
407
+
408
+ /**
409
+ * Whether the chat was deemed successful by post-chat analysis.
410
+ */
411
+ successful?: boolean;
412
+
413
+ /**
414
+ * Post-chat analysis summary.
415
+ */
416
+ summary?: string;
417
+ }
418
+ }
419
+
420
+ export interface ContactUploadImportFileResponse {
421
+ file_name?: string;
422
+
423
+ upload_id?: string;
424
+ }
425
+
426
+ export interface ContactCreateParams {
427
+ /**
428
+ * Phone number of the contact.
429
+ */
430
+ phone_number: string;
431
+
432
+ /**
433
+ * Values must match the types defined in CRM config custom fields. Set a value to
434
+ * null to clear it.
435
+ */
436
+ custom_fields?: unknown;
437
+
438
+ do_not_call?: boolean;
439
+
440
+ /**
441
+ * First name of the contact.
442
+ */
443
+ first_name?: string;
444
+
445
+ /**
446
+ * Last name of the contact.
447
+ */
448
+ last_name?: string;
449
+
450
+ /**
451
+ * Full set of tags for the contact.
452
+ */
453
+ tags?: Array<string>;
454
+ }
455
+
456
+ export interface ContactUpdateParams {
457
+ /**
458
+ * Values must match the types defined in CRM config custom fields. Set a value to
459
+ * null to clear it.
460
+ */
461
+ custom_fields?: unknown;
462
+
463
+ do_not_call?: boolean;
464
+
465
+ /**
466
+ * First name of the contact.
467
+ */
468
+ first_name?: string;
469
+
470
+ /**
471
+ * Last name of the contact.
472
+ */
473
+ last_name?: string;
474
+
475
+ /**
476
+ * Full replacement set of tags for the contact.
477
+ */
478
+ tags?: Array<string>;
479
+ }
480
+
481
+ export interface ContactListParams {
482
+ /**
483
+ * Filter criteria for contacts. All conditions are implicitly connected with AND.
484
+ * first_name and last_name are not filterable here; use search_query to match on
485
+ * those.
486
+ */
487
+ filter_criteria?: ContactListParams.FilterCriteria;
488
+
489
+ /**
490
+ * Maximum number of contacts to return.
491
+ */
492
+ limit?: number;
493
+
494
+ /**
495
+ * Base64url-encoded pagination key from a previous response.
496
+ */
497
+ pagination_key?: string;
498
+
499
+ /**
500
+ * Case-insensitive substring match against phone number, first name, last name,
501
+ * external ID, and custom field values. This is the only way to match on a
502
+ * contact's name.
503
+ */
504
+ search_query?: string;
505
+
506
+ /**
507
+ * Number of records to skip for offset-based pagination.
508
+ */
509
+ skip?: number;
510
+
511
+ /**
512
+ * Sort contacts by `last_conversation_timestamp` in ascending or descending order.
513
+ * Contacts that have never been contacted sort as if their timestamp were 0.
514
+ */
515
+ sort_order?: 'asc' | 'desc';
516
+ }
517
+
518
+ export namespace ContactListParams {
519
+ /**
520
+ * Filter criteria for contacts. All conditions are implicitly connected with AND.
521
+ * first_name and last_name are not filterable here; use search_query to match on
522
+ * those.
523
+ */
524
+ export interface FilterCriteria {
525
+ contact_id?: FilterCriteria.ContactID;
526
+
527
+ /**
528
+ * Filter by custom contact fields defined in CRM config.
529
+ */
530
+ custom_fields?: Array<
531
+ | FilterCriteria.StringFilter
532
+ | FilterCriteria.NumberFilter
533
+ | FilterCriteria.BooleanFilter
534
+ | FilterCriteria.RangeFilter
535
+ | FilterCriteria.EnumFilter
536
+ | FilterCriteria.PresentFilter
537
+ >;
538
+
539
+ /**
540
+ * Filter by whether the contact is marked do-not-call.
541
+ */
542
+ do_not_call?: FilterCriteria.DoNotCall;
543
+
544
+ /**
545
+ * Filter by the record id in the connected CRM. Use a `present` filter to separate
546
+ * synced from unsynced contacts.
547
+ */
548
+ external_id?: FilterCriteria.StringFilter | FilterCriteria.PresentFilter;
549
+
550
+ /**
551
+ * Filter by when the contact was last spoken to, in epoch milliseconds.
552
+ */
553
+ last_conversation_timestamp?: FilterCriteria.NumberFilter | FilterCriteria.RangeFilter;
554
+
555
+ /**
556
+ * Filter by phone number. Stored in E.164, so an `eq` filter needs the full
557
+ * number.
558
+ */
559
+ phone_number?: FilterCriteria.PhoneNumber;
560
+
561
+ /**
562
+ * Match contacts that have any of the listed tags.
563
+ */
564
+ tags?: FilterCriteria.Tags;
565
+ }
566
+
567
+ export namespace FilterCriteria {
568
+ export interface ContactID {
569
+ /**
570
+ * eq: equal, ne: not equal, sw: starts with, ew: ends with, co: contains
571
+ */
572
+ op: 'eq' | 'ne' | 'sw' | 'ew' | 'co';
573
+
574
+ type: 'string';
575
+
576
+ value: string;
577
+ }
578
+
579
+ export interface StringFilter {
580
+ /**
581
+ * eq: equal, ne: not equal, sw: starts with, ew: ends with, co: contains
582
+ */
583
+ op: 'eq' | 'ne' | 'sw' | 'ew' | 'co';
584
+
585
+ type: 'string';
586
+
587
+ value: string;
588
+
589
+ /**
590
+ * The field name to filter on.
591
+ */
592
+ key?: string;
593
+ }
594
+
595
+ export interface NumberFilter {
596
+ /**
597
+ * eq: equal, ne: not equal, gt: greater than, ge: greater than or equal, lt: less
598
+ * than, le: less than or equal
599
+ */
600
+ op: 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le';
601
+
602
+ type: 'number';
603
+
604
+ value: number;
605
+
606
+ /**
607
+ * The field name to filter on.
608
+ */
609
+ key?: string;
610
+ }
611
+
612
+ export interface BooleanFilter {
613
+ op: 'eq';
614
+
615
+ type: 'boolean';
616
+
617
+ value: boolean;
618
+
619
+ /**
620
+ * The field name to filter on.
621
+ */
622
+ key?: string;
623
+ }
624
+
625
+ export interface RangeFilter {
626
+ /**
627
+ * bt: between
628
+ */
629
+ op: 'bt';
630
+
631
+ type: 'range';
632
+
633
+ /**
634
+ * [lower_bound, upper_bound]
635
+ */
636
+ value: Array<number>;
637
+
638
+ /**
639
+ * The field name to filter on.
640
+ */
641
+ key?: string;
642
+ }
643
+
644
+ export interface EnumFilter {
645
+ /**
646
+ * in: value is one of the listed values
647
+ */
648
+ op: 'in';
649
+
650
+ type: 'enum';
651
+
652
+ value: Array<string>;
653
+
654
+ /**
655
+ * The field name to filter on.
656
+ */
657
+ key?: string;
658
+ }
659
+
660
+ export interface PresentFilter {
661
+ /**
662
+ * pr: present (has value), np: not present
663
+ */
664
+ op: 'pr' | 'np';
665
+
666
+ type: 'present';
667
+
668
+ /**
669
+ * The field name to filter on.
670
+ */
671
+ key?: string;
672
+ }
673
+
674
+ /**
675
+ * Filter by whether the contact is marked do-not-call.
676
+ */
677
+ export interface DoNotCall {
678
+ op: 'eq';
679
+
680
+ type: 'boolean';
681
+
682
+ value: boolean;
683
+ }
684
+
685
+ export interface StringFilter {
686
+ /**
687
+ * eq: equal, ne: not equal, sw: starts with, ew: ends with, co: contains
688
+ */
689
+ op: 'eq' | 'ne' | 'sw' | 'ew' | 'co';
690
+
691
+ type: 'string';
692
+
693
+ value: string;
694
+ }
695
+
696
+ export interface PresentFilter {
697
+ /**
698
+ * pr: present (has value), np: not present
699
+ */
700
+ op: 'pr' | 'np';
701
+
702
+ type: 'present';
703
+ }
704
+
705
+ export interface NumberFilter {
706
+ /**
707
+ * eq: equal, ne: not equal, gt: greater than, ge: greater than or equal, lt: less
708
+ * than, le: less than or equal
709
+ */
710
+ op: 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le';
711
+
712
+ type: 'number';
713
+
714
+ value: number;
715
+ }
716
+
717
+ export interface RangeFilter {
718
+ /**
719
+ * bt: between
720
+ */
721
+ op: 'bt';
722
+
723
+ type: 'range';
724
+
725
+ /**
726
+ * [lower_bound, upper_bound]
727
+ */
728
+ value: Array<number>;
729
+ }
730
+
731
+ /**
732
+ * Filter by phone number. Stored in E.164, so an `eq` filter needs the full
733
+ * number.
734
+ */
735
+ export interface PhoneNumber {
736
+ /**
737
+ * eq: equal, ne: not equal, sw: starts with, ew: ends with, co: contains
738
+ */
739
+ op: 'eq' | 'ne' | 'sw' | 'ew' | 'co';
740
+
741
+ type: 'string';
742
+
743
+ value: string;
744
+ }
745
+
746
+ /**
747
+ * Match contacts that have any of the listed tags.
748
+ */
749
+ export interface Tags {
750
+ /**
751
+ * in: value is one of the listed values
752
+ */
753
+ op: 'in';
754
+
755
+ type: 'enum';
756
+
757
+ value: Array<string>;
758
+ }
759
+ }
760
+ }
761
+
762
+ export interface ContactBackfillAnalysisDataParams {
763
+ /**
764
+ * Contact fields to recompute. Each one must still exist as a contact field and
765
+ * have an analysis data mapping configured, otherwise the request is rejected
766
+ * rather than running a job that writes nothing.
767
+ */
768
+ backfill_attributes: Array<string>;
769
+
770
+ /**
771
+ * Optional call filter to scope which calls are processed. Supports agent and
772
+ * start_timestamp from the standard call filter.
773
+ */
774
+ backfill_call_filter?: ContactBackfillAnalysisDataParams.BackfillCallFilter;
775
+ }
776
+
777
+ export namespace ContactBackfillAnalysisDataParams {
778
+ /**
779
+ * Optional call filter to scope which calls are processed. Supports agent and
780
+ * start_timestamp from the standard call filter.
781
+ */
782
+ export interface BackfillCallFilter {
783
+ /**
784
+ * Filter calls by agent. Agents are OR-connected.
785
+ */
786
+ agent?: Array<BackfillCallFilter.Agent>;
787
+
788
+ /**
789
+ * Filter calls by start timestamp (epoch ms).
790
+ */
791
+ start_timestamp?: BackfillCallFilter.NumberFilter | BackfillCallFilter.RangeFilter;
792
+ }
793
+
794
+ export namespace BackfillCallFilter {
795
+ export interface Agent {
796
+ /**
797
+ * The agent ID to filter on.
798
+ */
799
+ agent_id: string;
800
+
801
+ /**
802
+ * Specific versions to filter on. If omitted or empty, all versions are included.
803
+ */
804
+ version?: Array<number>;
805
+ }
806
+
807
+ export interface NumberFilter {
808
+ /**
809
+ * eq: equal, ne: not equal, gt: greater than, ge: greater than or equal, lt: less
810
+ * than, le: less than or equal
811
+ */
812
+ op: 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le';
813
+
814
+ type: 'number';
815
+
816
+ value: number;
817
+ }
818
+
819
+ export interface RangeFilter {
820
+ /**
821
+ * bt: between
822
+ */
823
+ op: 'bt';
824
+
825
+ type: 'range';
826
+
827
+ /**
828
+ * [lower_bound, upper_bound]
829
+ */
830
+ value: Array<number>;
831
+ }
832
+ }
833
+ }
834
+
835
+ export interface ContactCreateImportParams {
836
+ /**
837
+ * CSV headers mapped to contact fields. field_name is the contact field and
838
+ * external_field_name is the CSV header. Exactly one mapping must target
839
+ * phone_number. Unmapped columns are ignored.
840
+ */
841
+ column_mapping: Array<ContactCreateImportParams.ColumnMapping>;
842
+
843
+ /**
844
+ * Id returned by upload-contact-import-file.
845
+ */
846
+ upload_id: string;
847
+
848
+ /**
849
+ * Country for parsing phone numbers without a country code. Defaults to US.
850
+ */
851
+ default_country?: string;
852
+
853
+ /**
854
+ * Tags added to every contact in this import. Existing tags are preserved. Omit to
855
+ * leave tags unchanged.
856
+ */
857
+ tags?: Array<string>;
858
+ }
859
+
860
+ export namespace ContactCreateImportParams {
861
+ export interface ColumnMapping {
862
+ /**
863
+ * Field on the CRM's contact object to map to. A name that does not exist there
864
+ * surfaces as an error on the sync job rather than at configuration time.
865
+ */
866
+ external_field_name: string;
867
+
868
+ /**
869
+ * Retell contact field, built-in or custom, to map. Types must be compatible with
870
+ * the CRM field on both sides of the sync.
871
+ */
872
+ field_name: string;
873
+ }
874
+ }
875
+
876
+ export interface ContactListConversationsParams {
877
+ /**
878
+ * Maximum number of items to return.
879
+ */
880
+ limit?: number;
881
+
882
+ /**
883
+ * Pagination key for fetching the next page.
884
+ */
885
+ pagination_key?: string;
886
+ }
887
+
888
+ export interface ContactUploadImportFileParams {
889
+ file: Uploadable;
890
+ }
891
+
892
+ export declare namespace Contact {
893
+ export {
894
+ type ContactResponse as ContactResponse,
895
+ type ContactListResponse as ContactListResponse,
896
+ type ContactBackfillAnalysisDataResponse as ContactBackfillAnalysisDataResponse,
897
+ type ContactCreateImportResponse as ContactCreateImportResponse,
898
+ type ContactGetBackfillJobStatusResponse as ContactGetBackfillJobStatusResponse,
899
+ type ContactGetImportResponse as ContactGetImportResponse,
900
+ type ContactListConversationsResponse as ContactListConversationsResponse,
901
+ type ContactUploadImportFileResponse as ContactUploadImportFileResponse,
902
+ type ContactCreateParams as ContactCreateParams,
903
+ type ContactUpdateParams as ContactUpdateParams,
904
+ type ContactListParams as ContactListParams,
905
+ type ContactBackfillAnalysisDataParams as ContactBackfillAnalysisDataParams,
906
+ type ContactCreateImportParams as ContactCreateImportParams,
907
+ type ContactListConversationsParams as ContactListConversationsParams,
908
+ type ContactUploadImportFileParams as ContactUploadImportFileParams,
909
+ };
910
+ }