retell-sdk 6.0.1 → 6.1.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.
- package/CHANGELOG.md +12 -0
- package/client.d.mts +2 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +2 -2
- package/client.d.ts.map +1 -1
- package/client.js.map +1 -1
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/agent.d.mts +3222 -526
- package/resources/agent.d.mts.map +1 -1
- package/resources/agent.d.ts +3222 -526
- package/resources/agent.d.ts.map +1 -1
- package/resources/app.d.mts +122 -5
- package/resources/app.d.mts.map +1 -1
- package/resources/app.d.ts +122 -5
- package/resources/app.d.ts.map +1 -1
- package/resources/app.js +17 -1
- package/resources/app.js.map +1 -1
- package/resources/app.mjs +17 -1
- package/resources/app.mjs.map +1 -1
- package/resources/batch-call.d.mts +912 -13
- package/resources/batch-call.d.mts.map +1 -1
- package/resources/batch-call.d.ts +912 -13
- package/resources/batch-call.d.ts.map +1 -1
- package/resources/call.d.mts +7843 -3792
- package/resources/call.d.mts.map +1 -1
- package/resources/call.d.ts +7843 -3792
- package/resources/call.d.ts.map +1 -1
- package/resources/call.js +1 -1
- package/resources/call.mjs +1 -1
- package/resources/chat-agent.d.mts +3125 -453
- package/resources/chat-agent.d.mts.map +1 -1
- package/resources/chat-agent.d.ts +3125 -453
- package/resources/chat-agent.d.ts.map +1 -1
- package/resources/chat.d.mts +892 -26
- package/resources/chat.d.mts.map +1 -1
- package/resources/chat.d.ts +892 -26
- package/resources/chat.d.ts.map +1 -1
- package/resources/contact.d.mts +162 -20
- package/resources/contact.d.mts.map +1 -1
- package/resources/contact.d.ts +162 -20
- package/resources/contact.d.ts.map +1 -1
- package/resources/contact.js +98 -4
- package/resources/contact.js.map +1 -1
- package/resources/contact.mjs +98 -4
- package/resources/contact.mjs.map +1 -1
- package/resources/conversation-flow-component.d.mts +3282 -243
- package/resources/conversation-flow-component.d.mts.map +1 -1
- package/resources/conversation-flow-component.d.ts +3282 -243
- package/resources/conversation-flow-component.d.ts.map +1 -1
- package/resources/conversation-flow.d.mts +7347 -1269
- package/resources/conversation-flow.d.mts.map +1 -1
- package/resources/conversation-flow.d.ts +7347 -1269
- package/resources/conversation-flow.d.ts.map +1 -1
- package/resources/crm.d.mts +37 -5
- package/resources/crm.d.mts.map +1 -1
- package/resources/crm.d.ts +37 -5
- package/resources/crm.d.ts.map +1 -1
- package/resources/identity.d.mts +4 -0
- package/resources/identity.d.mts.map +1 -1
- package/resources/identity.d.ts +4 -0
- package/resources/identity.d.ts.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/llm.d.mts +867 -9
- package/resources/llm.d.mts.map +1 -1
- package/resources/llm.d.ts +867 -9
- package/resources/llm.d.ts.map +1 -1
- package/resources/tests.d.mts +3 -3
- package/resources/tests.d.mts.map +1 -1
- package/resources/tests.d.ts +3 -3
- package/resources/tests.d.ts.map +1 -1
- package/src/client.ts +4 -0
- package/src/resources/agent.ts +4786 -1504
- package/src/resources/app.ts +144 -4
- package/src/resources/batch-call.ts +1115 -10
- package/src/resources/call.ts +9825 -4806
- package/src/resources/chat-agent.ts +3958 -698
- package/src/resources/chat.ts +1133 -50
- package/src/resources/contact.ts +168 -20
- package/src/resources/conversation-flow-component.ts +4466 -191
- package/src/resources/conversation-flow.ts +9084 -525
- package/src/resources/crm.ts +44 -5
- package/src/resources/identity.ts +5 -0
- package/src/resources/index.ts +2 -0
- package/src/resources/llm.ts +1045 -46
- package/src/resources/tests.ts +21 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/resources/contact.ts
CHANGED
|
@@ -11,6 +11,13 @@ import { path } from '../internal/utils/path';
|
|
|
11
11
|
export class Contact extends APIResource {
|
|
12
12
|
/**
|
|
13
13
|
* Create a new contact.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const contactResponse = await client.contact.create({
|
|
18
|
+
* phone_number: 'phone_number',
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
14
21
|
*/
|
|
15
22
|
create(body: ContactCreateParams, options?: RequestOptions): APIPromise<ContactResponse> {
|
|
16
23
|
return this._client.post('/create-contact', { body, ...options });
|
|
@@ -18,6 +25,13 @@ export class Contact extends APIResource {
|
|
|
18
25
|
|
|
19
26
|
/**
|
|
20
27
|
* Update an existing contact.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const contactResponse = await client.contact.update(
|
|
32
|
+
* 'contact_id',
|
|
33
|
+
* );
|
|
34
|
+
* ```
|
|
21
35
|
*/
|
|
22
36
|
update(
|
|
23
37
|
contactID: string,
|
|
@@ -28,10 +42,15 @@ export class Contact extends APIResource {
|
|
|
28
42
|
}
|
|
29
43
|
|
|
30
44
|
/**
|
|
31
|
-
* List contacts, newest
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* repeat or miss rows as contacts are
|
|
45
|
+
* List contacts, newest created first by default, with the total count of matches
|
|
46
|
+
* alongside the page. Page through results with `pagination_key`; `skip` is
|
|
47
|
+
* available for offset-style paging but is slower on large contact sets and can
|
|
48
|
+
* repeat or miss rows as contacts are added or deleted.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const contacts = await client.contact.list();
|
|
53
|
+
* ```
|
|
35
54
|
*/
|
|
36
55
|
list(
|
|
37
56
|
body: ContactListParams | null | undefined = {},
|
|
@@ -44,6 +63,11 @@ export class Contact extends APIResource {
|
|
|
44
63
|
* Delete a contact. A contact linked to a record in a connected CRM cannot be
|
|
45
64
|
* deleted while two-way sync is active — unlink the CRM app first, otherwise the
|
|
46
65
|
* next sync would recreate it.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* await client.contact.delete('contact_id');
|
|
70
|
+
* ```
|
|
47
71
|
*/
|
|
48
72
|
delete(contactID: string, options?: RequestOptions): APIPromise<void> {
|
|
49
73
|
return this._client.delete(path`/delete-contact/${contactID}`, {
|
|
@@ -52,6 +76,24 @@ export class Contact extends APIResource {
|
|
|
52
76
|
});
|
|
53
77
|
}
|
|
54
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Trigger a backfill job that re-applies analysis data mappings to contacts using
|
|
81
|
+
* historical call and SMS chat data. Only one backfill job can run per
|
|
82
|
+
* organization at a time. Select contact_memory to rewrite memory from matching
|
|
83
|
+
* ended phone calls and SMS chats in chronological order, one conversation at a
|
|
84
|
+
* time, with no conversation-count cap. Backfill starts with the contact's
|
|
85
|
+
* existing memory. Each rewrite builds on the previous result, and the final
|
|
86
|
+
* successful result is saved once per contact. When mapped analysis fields and
|
|
87
|
+
* contact_memory are selected together, they are saved together in one contact
|
|
88
|
+
* update. Memory rewrites use the currently stored contact fields.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* const response = await client.contact.backfillAnalysisData({
|
|
93
|
+
* backfill_attributes: ['contact_memory'],
|
|
94
|
+
* });
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
55
97
|
backfillAnalysisData(
|
|
56
98
|
body: ContactBackfillAnalysisDataParams,
|
|
57
99
|
options?: RequestOptions,
|
|
@@ -64,6 +106,19 @@ export class Contact extends APIResource {
|
|
|
64
106
|
* and updates existing ones matched by phone number. Mapped columns overwrite the
|
|
65
107
|
* matched contact's fields; unmapped columns are ignored. Runs asynchronously —
|
|
66
108
|
* poll get-contact-import for progress.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* const response = await client.contact.createImport({
|
|
113
|
+
* column_mapping: [
|
|
114
|
+
* {
|
|
115
|
+
* external_field_name: 'external_field_name',
|
|
116
|
+
* field_name: 'field_name',
|
|
117
|
+
* },
|
|
118
|
+
* ],
|
|
119
|
+
* upload_id: 'upload_26f1cbdf5713',
|
|
120
|
+
* });
|
|
121
|
+
* ```
|
|
67
122
|
*/
|
|
68
123
|
createImport(
|
|
69
124
|
body: ContactCreateImportParams,
|
|
@@ -74,6 +129,13 @@ export class Contact extends APIResource {
|
|
|
74
129
|
|
|
75
130
|
/**
|
|
76
131
|
* Retrieve a contact by ID.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```ts
|
|
135
|
+
* const contactResponse = await client.contact.get(
|
|
136
|
+
* 'contact_id',
|
|
137
|
+
* );
|
|
138
|
+
* ```
|
|
77
139
|
*/
|
|
78
140
|
get(contactID: string, options?: RequestOptions): APIPromise<ContactResponse> {
|
|
79
141
|
return this._client.get(path`/get-contact/${contactID}`, options);
|
|
@@ -81,6 +143,12 @@ export class Contact extends APIResource {
|
|
|
81
143
|
|
|
82
144
|
/**
|
|
83
145
|
* Get the status of the contact analysis data backfill job.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts
|
|
149
|
+
* const response =
|
|
150
|
+
* await client.contact.getBackfillJobStatus();
|
|
151
|
+
* ```
|
|
84
152
|
*/
|
|
85
153
|
getBackfillJobStatus(options?: RequestOptions): APIPromise<ContactGetBackfillJobStatusResponse> {
|
|
86
154
|
return this._client.get('/get-backfill-contact-job-status', options);
|
|
@@ -89,6 +157,13 @@ export class Contact extends APIResource {
|
|
|
89
157
|
/**
|
|
90
158
|
* Retrieve a contact by phone number. At most one contact exists per phone number
|
|
91
159
|
* in an organization.
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```ts
|
|
163
|
+
* const contactResponse = await client.contact.getByPhone(
|
|
164
|
+
* 'phone_number',
|
|
165
|
+
* );
|
|
166
|
+
* ```
|
|
92
167
|
*/
|
|
93
168
|
getByPhone(phoneNumber: string, options?: RequestOptions): APIPromise<ContactResponse> {
|
|
94
169
|
return this._client.get(path`/get-contact-by-phone/${phoneNumber}`, options);
|
|
@@ -96,6 +171,11 @@ export class Contact extends APIResource {
|
|
|
96
171
|
|
|
97
172
|
/**
|
|
98
173
|
* Status and counts for the org's current or latest contact import.
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```ts
|
|
177
|
+
* const response = await client.contact.getImport();
|
|
178
|
+
* ```
|
|
99
179
|
*/
|
|
100
180
|
getImport(options?: RequestOptions): APIPromise<ContactGetImportResponse> {
|
|
101
181
|
return this._client.get('/get-contact-import', options);
|
|
@@ -105,6 +185,13 @@ export class Contact extends APIResource {
|
|
|
105
185
|
* List a contact's conversations (inbound calls, outbound calls, and chats) merged
|
|
106
186
|
* into a single timeline, most recent first. Results are matched by the contact's
|
|
107
187
|
* phone number. Use the returned `pagination_key` to fetch the next page.
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```ts
|
|
191
|
+
* const response = await client.contact.listConversations(
|
|
192
|
+
* 'contact_id',
|
|
193
|
+
* );
|
|
194
|
+
* ```
|
|
108
195
|
*/
|
|
109
196
|
listConversations(
|
|
110
197
|
contactID: string,
|
|
@@ -117,6 +204,13 @@ export class Contact extends APIResource {
|
|
|
117
204
|
/**
|
|
118
205
|
* Upload a CSV file for a contact import. The file is stored privately and
|
|
119
206
|
* referenced by the returned upload_id in create-contact-import.
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ```ts
|
|
210
|
+
* const response = await client.contact.uploadImportFile({
|
|
211
|
+
* file: fs.createReadStream('path/to/file'),
|
|
212
|
+
* });
|
|
213
|
+
* ```
|
|
120
214
|
*/
|
|
121
215
|
uploadImportFile(
|
|
122
216
|
body: ContactUploadImportFileParams,
|
|
@@ -151,9 +245,16 @@ export interface ContactResponse {
|
|
|
151
245
|
phone_number: string;
|
|
152
246
|
|
|
153
247
|
/**
|
|
154
|
-
*
|
|
248
|
+
* Running brief shared across this contact's phone calls and SMS chats. Omitted
|
|
249
|
+
* when unset.
|
|
155
250
|
*/
|
|
156
|
-
|
|
251
|
+
contact_memory?: string;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Assigned tag IDs and labels from the organization's CRM config. IDs absent from
|
|
255
|
+
* the config are omitted.
|
|
256
|
+
*/
|
|
257
|
+
contact_tags?: Array<ContactResponse.ContactTag>;
|
|
157
258
|
|
|
158
259
|
/**
|
|
159
260
|
* Number of conversations (calls and chats) associated with this contact.
|
|
@@ -196,6 +297,20 @@ export interface ContactResponse {
|
|
|
196
297
|
user_modified_timestamp?: number;
|
|
197
298
|
}
|
|
198
299
|
|
|
300
|
+
export namespace ContactResponse {
|
|
301
|
+
export interface ContactTag {
|
|
302
|
+
/**
|
|
303
|
+
* Unique identifier for the tag.
|
|
304
|
+
*/
|
|
305
|
+
id: string;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Human-readable label for the tag.
|
|
309
|
+
*/
|
|
310
|
+
label: string;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
199
314
|
export interface ContactListResponse {
|
|
200
315
|
/**
|
|
201
316
|
* Whether more results are available.
|
|
@@ -426,9 +541,14 @@ export interface ContactCreateParams {
|
|
|
426
541
|
phone_number: string;
|
|
427
542
|
|
|
428
543
|
/**
|
|
429
|
-
*
|
|
544
|
+
* Contact memory text.
|
|
430
545
|
*/
|
|
431
|
-
|
|
546
|
+
contact_memory?: string | null;
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* Full set of tag IDs for the contact.
|
|
550
|
+
*/
|
|
551
|
+
contact_tag_ids?: Array<string>;
|
|
432
552
|
|
|
433
553
|
/**
|
|
434
554
|
* Values must match the types defined in CRM config custom fields. Set a value to
|
|
@@ -451,9 +571,14 @@ export interface ContactCreateParams {
|
|
|
451
571
|
|
|
452
572
|
export interface ContactUpdateParams {
|
|
453
573
|
/**
|
|
454
|
-
*
|
|
574
|
+
* Contact memory text. Pass null to clear.
|
|
455
575
|
*/
|
|
456
|
-
|
|
576
|
+
contact_memory?: string | null;
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* Full replacement set of tag IDs for the contact.
|
|
580
|
+
*/
|
|
581
|
+
contact_tag_ids?: Array<string>;
|
|
457
582
|
|
|
458
583
|
/**
|
|
459
584
|
* Values must match the types defined in CRM config custom fields. Set a value to
|
|
@@ -475,6 +600,11 @@ export interface ContactUpdateParams {
|
|
|
475
600
|
}
|
|
476
601
|
|
|
477
602
|
export interface ContactListParams {
|
|
603
|
+
/**
|
|
604
|
+
* Contact IDs to leave out of both the results and `total`.
|
|
605
|
+
*/
|
|
606
|
+
excluded_contact_ids?: Array<string>;
|
|
607
|
+
|
|
478
608
|
/**
|
|
479
609
|
* Filter criteria for contacts. All conditions are implicitly connected with AND.
|
|
480
610
|
* first_name and last_name are not filterable here; use search_query to match on
|
|
@@ -505,8 +635,8 @@ export interface ContactListParams {
|
|
|
505
635
|
skip?: number;
|
|
506
636
|
|
|
507
637
|
/**
|
|
508
|
-
* Sort contacts by `
|
|
509
|
-
*
|
|
638
|
+
* Sort contacts by `created_timestamp` in ascending or descending order (newest
|
|
639
|
+
* first by default). Ties are broken by contact ID in the same direction.
|
|
510
640
|
*/
|
|
511
641
|
sort_order?: 'asc' | 'desc';
|
|
512
642
|
}
|
|
@@ -521,9 +651,9 @@ export namespace ContactListParams {
|
|
|
521
651
|
contact_id?: FilterCriteria.ContactID;
|
|
522
652
|
|
|
523
653
|
/**
|
|
524
|
-
* Match contacts that have any of the listed
|
|
654
|
+
* Match contacts that have any of the listed tag IDs.
|
|
525
655
|
*/
|
|
526
|
-
|
|
656
|
+
contact_tag_ids?: FilterCriteria.ContactTagIDs;
|
|
527
657
|
|
|
528
658
|
/**
|
|
529
659
|
* Filter by custom contact fields defined in CRM config.
|
|
@@ -573,9 +703,9 @@ export namespace ContactListParams {
|
|
|
573
703
|
}
|
|
574
704
|
|
|
575
705
|
/**
|
|
576
|
-
* Match contacts that have any of the listed
|
|
706
|
+
* Match contacts that have any of the listed tag IDs.
|
|
577
707
|
*/
|
|
578
|
-
export interface
|
|
708
|
+
export interface ContactTagIDs {
|
|
579
709
|
/**
|
|
580
710
|
* in: value is one of the listed values
|
|
581
711
|
*/
|
|
@@ -756,20 +886,37 @@ export namespace ContactListParams {
|
|
|
756
886
|
}
|
|
757
887
|
|
|
758
888
|
export interface ContactBackfillAnalysisDataParams {
|
|
889
|
+
/**
|
|
890
|
+
* Contact fields to recompute. Each one must still exist as a contact field and
|
|
891
|
+
* have an analysis data mapping configured, except for the built-in contact_memory
|
|
892
|
+
* attribute, which requires no mapping and supports requests on its own or
|
|
893
|
+
* alongside mapped fields. Memory backfill skips conversations without retained
|
|
894
|
+
* transcripts.
|
|
895
|
+
*/
|
|
759
896
|
backfill_attributes: Array<string>;
|
|
760
897
|
|
|
898
|
+
/**
|
|
899
|
+
* Optional filter to scope which conversations are processed. Supports agent and
|
|
900
|
+
* start_timestamp from the standard call filter. The same filter applies to phone
|
|
901
|
+
* calls and SMS chats for both analysis data mappings and contact_memory.
|
|
902
|
+
*/
|
|
761
903
|
backfill_call_filter?: ContactBackfillAnalysisDataParams.BackfillCallFilter;
|
|
762
904
|
}
|
|
763
905
|
|
|
764
906
|
export namespace ContactBackfillAnalysisDataParams {
|
|
907
|
+
/**
|
|
908
|
+
* Optional filter to scope which conversations are processed. Supports agent and
|
|
909
|
+
* start_timestamp from the standard call filter. The same filter applies to phone
|
|
910
|
+
* calls and SMS chats for both analysis data mappings and contact_memory.
|
|
911
|
+
*/
|
|
765
912
|
export interface BackfillCallFilter {
|
|
766
913
|
/**
|
|
767
|
-
* Filter
|
|
914
|
+
* Filter conversations by agent. Agents are OR-connected.
|
|
768
915
|
*/
|
|
769
916
|
agent?: Array<BackfillCallFilter.Agent>;
|
|
770
917
|
|
|
771
918
|
/**
|
|
772
|
-
* Filter
|
|
919
|
+
* Filter conversations by start timestamp (epoch ms).
|
|
773
920
|
*/
|
|
774
921
|
start_timestamp?: BackfillCallFilter.NumberFilter | BackfillCallFilter.RangeFilter;
|
|
775
922
|
}
|
|
@@ -829,8 +976,9 @@ export interface ContactCreateImportParams {
|
|
|
829
976
|
upload_id: string;
|
|
830
977
|
|
|
831
978
|
/**
|
|
832
|
-
*
|
|
833
|
-
*
|
|
979
|
+
* Tag labels added to every contact in this import. Labels are trimmed and
|
|
980
|
+
* deduplicated. New labels are added to the org's CRM config with generated tag
|
|
981
|
+
* IDs.
|
|
834
982
|
*/
|
|
835
983
|
contact_tags?: Array<string>;
|
|
836
984
|
|