@roarkanalytics/sdk 7.7.0 → 7.9.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.
@@ -0,0 +1,1299 @@
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 { RequestOptions } from '../internal/request-options';
6
+ import { path } from '../internal/utils/path';
7
+
8
+ export class CustomerProfile extends APIResource {
9
+ /**
10
+ * Returns the people who have talked to your agents in this project. Customers we
11
+ * hold nothing about beyond their identifier are left out unless includeNoData is
12
+ * true.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const customerProfiles =
17
+ * await client.customerProfile.list();
18
+ * ```
19
+ */
20
+ list(
21
+ query: CustomerProfileListParams | null | undefined = {},
22
+ options?: RequestOptions,
23
+ ): APIPromise<CustomerProfileListResponse> {
24
+ return this._client.get('/v1/customer-profile', { query, ...options });
25
+ }
26
+
27
+ /**
28
+ * Permanently removes the profile, its fields, evidence and notes. Conversations
29
+ * are kept. A new conversation from the same identifier creates a new profile.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * const customerProfile = await client.customerProfile.delete(
34
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
35
+ * );
36
+ * ```
37
+ */
38
+ delete(customerProfileID: string, options?: RequestOptions): APIPromise<CustomerProfileDeleteResponse> {
39
+ return this._client.delete(path`/v1/customer-profile/${customerProfileID}`, options);
40
+ }
41
+
42
+ /**
43
+ * Removes the value and any lock, so a later conversation can fill it again.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * const response =
48
+ * await client.customerProfile.clearAttribute('FULL_NAME', {
49
+ * customerProfileId:
50
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
51
+ * });
52
+ * ```
53
+ */
54
+ clearAttribute(
55
+ key:
56
+ | 'FULL_NAME'
57
+ | 'PREFERRED_NAME'
58
+ | 'ACCOUNT_ID'
59
+ | 'COMPANY'
60
+ | 'JOB_TITLE'
61
+ | 'EMAIL'
62
+ | 'ALTERNATE_PHONE'
63
+ | 'AGE'
64
+ | 'GENDER'
65
+ | 'LANGUAGE'
66
+ | 'LOCATION'
67
+ | 'TIMEZONE'
68
+ | 'BEST_TIME_TO_REACH'
69
+ | 'PREFERRED_CHANNEL',
70
+ params: CustomerProfileClearAttributeParams,
71
+ options?: RequestOptions,
72
+ ): APIPromise<CustomerProfileClearAttributeResponse> {
73
+ const { customerProfileId } = params;
74
+ return this._client.delete(path`/v1/customer-profile/${customerProfileId}/attributes/${key}`, options);
75
+ }
76
+
77
+ /**
78
+ * Get a customer profile
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * const response = await client.customerProfile.getByID(
83
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
84
+ * );
85
+ * ```
86
+ */
87
+ getByID(customerProfileID: string, options?: RequestOptions): APIPromise<CustomerProfileGetByIDResponse> {
88
+ return this._client.get(path`/v1/customer-profile/${customerProfileID}`, options);
89
+ }
90
+
91
+ /**
92
+ * Calls and chats with this customer, newest first.
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * const response =
97
+ * await client.customerProfile.listConversations(
98
+ * 'customerProfileId',
99
+ * );
100
+ * ```
101
+ */
102
+ listConversations(
103
+ customerProfileID: string,
104
+ query: CustomerProfileListConversationsParams | null | undefined = {},
105
+ options?: RequestOptions,
106
+ ): APIPromise<CustomerProfileListConversationsResponse> {
107
+ return this._client.get(path`/v1/customer-profile/${customerProfileID}/conversations`, {
108
+ query,
109
+ ...options,
110
+ });
111
+ }
112
+
113
+ /**
114
+ * Sets the value and locks the field, so newer conversations cannot change it.
115
+ *
116
+ * @example
117
+ * ```ts
118
+ * const response = await client.customerProfile.setAttribute(
119
+ * 'FULL_NAME',
120
+ * {
121
+ * customerProfileId:
122
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
123
+ * value: 'x',
124
+ * },
125
+ * );
126
+ * ```
127
+ */
128
+ setAttribute(
129
+ key:
130
+ | 'FULL_NAME'
131
+ | 'PREFERRED_NAME'
132
+ | 'ACCOUNT_ID'
133
+ | 'COMPANY'
134
+ | 'JOB_TITLE'
135
+ | 'EMAIL'
136
+ | 'ALTERNATE_PHONE'
137
+ | 'AGE'
138
+ | 'GENDER'
139
+ | 'LANGUAGE'
140
+ | 'LOCATION'
141
+ | 'TIMEZONE'
142
+ | 'BEST_TIME_TO_REACH'
143
+ | 'PREFERRED_CHANNEL',
144
+ params: CustomerProfileSetAttributeParams,
145
+ options?: RequestOptions,
146
+ ): APIPromise<CustomerProfileSetAttributeResponse> {
147
+ const { customerProfileId, ...body } = params;
148
+ return this._client.put(path`/v1/customer-profile/${customerProfileId}/attributes/${key}`, {
149
+ body,
150
+ ...options,
151
+ });
152
+ }
153
+
154
+ /**
155
+ * Lets newer conversations change this field again. The current value stays until
156
+ * one does.
157
+ *
158
+ * @example
159
+ * ```ts
160
+ * const response =
161
+ * await client.customerProfile.unlockAttribute(
162
+ * 'FULL_NAME',
163
+ * {
164
+ * customerProfileId:
165
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
166
+ * },
167
+ * );
168
+ * ```
169
+ */
170
+ unlockAttribute(
171
+ key:
172
+ | 'FULL_NAME'
173
+ | 'PREFERRED_NAME'
174
+ | 'ACCOUNT_ID'
175
+ | 'COMPANY'
176
+ | 'JOB_TITLE'
177
+ | 'EMAIL'
178
+ | 'ALTERNATE_PHONE'
179
+ | 'AGE'
180
+ | 'GENDER'
181
+ | 'LANGUAGE'
182
+ | 'LOCATION'
183
+ | 'TIMEZONE'
184
+ | 'BEST_TIME_TO_REACH'
185
+ | 'PREFERRED_CHANNEL',
186
+ params: CustomerProfileUnlockAttributeParams,
187
+ options?: RequestOptions,
188
+ ): APIPromise<CustomerProfileUnlockAttributeResponse> {
189
+ const { customerProfileId } = params;
190
+ return this._client.post(
191
+ path`/v1/customer-profile/${customerProfileId}/attributes/${key}/unlock`,
192
+ options,
193
+ );
194
+ }
195
+
196
+ /**
197
+ * Replaces your team's shared notes. Null or empty clears them. The last save
198
+ * wins.
199
+ *
200
+ * @example
201
+ * ```ts
202
+ * const response = await client.customerProfile.updateNotes(
203
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
204
+ * { notes: 'notes' },
205
+ * );
206
+ * ```
207
+ */
208
+ updateNotes(
209
+ customerProfileID: string,
210
+ body: CustomerProfileUpdateNotesParams,
211
+ options?: RequestOptions,
212
+ ): APIPromise<CustomerProfileUpdateNotesResponse> {
213
+ return this._client.put(path`/v1/customer-profile/${customerProfileID}/notes`, { body, ...options });
214
+ }
215
+ }
216
+
217
+ export interface CustomerProfileListResponse {
218
+ data: CustomerProfileListResponse.Data;
219
+ }
220
+
221
+ export namespace CustomerProfileListResponse {
222
+ export interface Data {
223
+ items: Array<Data.Item>;
224
+
225
+ page: number;
226
+
227
+ totalCount: number;
228
+ }
229
+
230
+ export namespace Data {
231
+ export interface Item {
232
+ /**
233
+ * Unique identifier of the customer profile
234
+ */
235
+ id: string;
236
+
237
+ agentIds: Array<string>;
238
+
239
+ attributes: Array<Item.Attribute>;
240
+
241
+ chatCount: number;
242
+
243
+ conversationCount: number;
244
+
245
+ /**
246
+ * Null until a name is known, which is common
247
+ */
248
+ displayName: string | null;
249
+
250
+ externalId: string | null;
251
+
252
+ firstSeenAt: string | null;
253
+
254
+ lastSeenAt: string | null;
255
+
256
+ /**
257
+ * Your team's shared notes. Never sent to the agent.
258
+ */
259
+ notes: string | null;
260
+
261
+ notesUpdatedAt: string | null;
262
+
263
+ phoneNumberE164: string | null;
264
+
265
+ summary: string | null;
266
+
267
+ /**
268
+ * Voice only. Chat time is not included.
269
+ */
270
+ talkTimeMs: number;
271
+
272
+ voiceCount: number;
273
+ }
274
+
275
+ export namespace Item {
276
+ export interface Attribute {
277
+ /**
278
+ * What a newer conversation said while this field was locked
279
+ */
280
+ blockedValue: string | null;
281
+
282
+ /**
283
+ * The moment the current value was heard. Null for a value set by a person or the
284
+ * API.
285
+ */
286
+ evidence: Attribute.Evidence | null;
287
+
288
+ /**
289
+ * Other values this field has held or been offered, newest first
290
+ */
291
+ history: Array<Attribute.History>;
292
+
293
+ /**
294
+ * True when newer conversations cannot change this field
295
+ */
296
+ isLocked: boolean;
297
+
298
+ key:
299
+ | 'FULL_NAME'
300
+ | 'PREFERRED_NAME'
301
+ | 'ACCOUNT_ID'
302
+ | 'COMPANY'
303
+ | 'JOB_TITLE'
304
+ | 'EMAIL'
305
+ | 'ALTERNATE_PHONE'
306
+ | 'AGE'
307
+ | 'GENDER'
308
+ | 'LANGUAGE'
309
+ | 'LOCATION'
310
+ | 'TIMEZONE'
311
+ | 'BEST_TIME_TO_REACH'
312
+ | 'PREFERRED_CHANNEL';
313
+
314
+ observedAt: string;
315
+
316
+ /**
317
+ * Where the current value came from. LIVE and POST_CALL extraction are read from
318
+ * conversations.
319
+ */
320
+ source: 'LIVE_EXTRACTION' | 'POST_CALL_EXTRACTION' | 'API' | 'USER';
321
+
322
+ value: string;
323
+ }
324
+
325
+ export namespace Attribute {
326
+ /**
327
+ * The moment the current value was heard. Null for a value set by a person or the
328
+ * API.
329
+ */
330
+ export interface Evidence {
331
+ callId: string | null;
332
+
333
+ chatId: string | null;
334
+
335
+ observedAt: string;
336
+
337
+ /**
338
+ * Where in the conversation this was said
339
+ */
340
+ offsetMs: number | null;
341
+
342
+ /**
343
+ * The customer's words. Null on a project with redaction on.
344
+ */
345
+ quote: string | null;
346
+
347
+ source: 'LIVE_EXTRACTION' | 'POST_CALL_EXTRACTION' | 'API' | 'USER';
348
+
349
+ value: string;
350
+ }
351
+
352
+ export interface History {
353
+ callId: string | null;
354
+
355
+ chatId: string | null;
356
+
357
+ observedAt: string;
358
+
359
+ /**
360
+ * Where in the conversation this was said
361
+ */
362
+ offsetMs: number | null;
363
+
364
+ /**
365
+ * The customer's words. Null on a project with redaction on.
366
+ */
367
+ quote: string | null;
368
+
369
+ source: 'LIVE_EXTRACTION' | 'POST_CALL_EXTRACTION' | 'API' | 'USER';
370
+
371
+ value: string;
372
+ }
373
+ }
374
+ }
375
+ }
376
+ }
377
+
378
+ export interface CustomerProfileDeleteResponse {
379
+ data: CustomerProfileDeleteResponse.Data;
380
+ }
381
+
382
+ export namespace CustomerProfileDeleteResponse {
383
+ export interface Data {
384
+ success: boolean;
385
+ }
386
+ }
387
+
388
+ export interface CustomerProfileClearAttributeResponse {
389
+ data: CustomerProfileClearAttributeResponse.Data;
390
+ }
391
+
392
+ export namespace CustomerProfileClearAttributeResponse {
393
+ export interface Data {
394
+ /**
395
+ * Unique identifier of the customer profile
396
+ */
397
+ id: string;
398
+
399
+ agentIds: Array<string>;
400
+
401
+ attributes: Array<Data.Attribute>;
402
+
403
+ chatCount: number;
404
+
405
+ conversationCount: number;
406
+
407
+ /**
408
+ * Null until a name is known, which is common
409
+ */
410
+ displayName: string | null;
411
+
412
+ externalId: string | null;
413
+
414
+ firstSeenAt: string | null;
415
+
416
+ lastSeenAt: string | null;
417
+
418
+ /**
419
+ * Your team's shared notes. Never sent to the agent.
420
+ */
421
+ notes: string | null;
422
+
423
+ notesUpdatedAt: string | null;
424
+
425
+ phoneNumberE164: string | null;
426
+
427
+ summary: string | null;
428
+
429
+ /**
430
+ * Voice only. Chat time is not included.
431
+ */
432
+ talkTimeMs: number;
433
+
434
+ voiceCount: number;
435
+ }
436
+
437
+ export namespace Data {
438
+ export interface Attribute {
439
+ /**
440
+ * What a newer conversation said while this field was locked
441
+ */
442
+ blockedValue: string | null;
443
+
444
+ /**
445
+ * The moment the current value was heard. Null for a value set by a person or the
446
+ * API.
447
+ */
448
+ evidence: Attribute.Evidence | null;
449
+
450
+ /**
451
+ * Other values this field has held or been offered, newest first
452
+ */
453
+ history: Array<Attribute.History>;
454
+
455
+ /**
456
+ * True when newer conversations cannot change this field
457
+ */
458
+ isLocked: boolean;
459
+
460
+ key:
461
+ | 'FULL_NAME'
462
+ | 'PREFERRED_NAME'
463
+ | 'ACCOUNT_ID'
464
+ | 'COMPANY'
465
+ | 'JOB_TITLE'
466
+ | 'EMAIL'
467
+ | 'ALTERNATE_PHONE'
468
+ | 'AGE'
469
+ | 'GENDER'
470
+ | 'LANGUAGE'
471
+ | 'LOCATION'
472
+ | 'TIMEZONE'
473
+ | 'BEST_TIME_TO_REACH'
474
+ | 'PREFERRED_CHANNEL';
475
+
476
+ observedAt: string;
477
+
478
+ /**
479
+ * Where the current value came from. LIVE and POST_CALL extraction are read from
480
+ * conversations.
481
+ */
482
+ source: 'LIVE_EXTRACTION' | 'POST_CALL_EXTRACTION' | 'API' | 'USER';
483
+
484
+ value: string;
485
+ }
486
+
487
+ export namespace Attribute {
488
+ /**
489
+ * The moment the current value was heard. Null for a value set by a person or the
490
+ * API.
491
+ */
492
+ export interface Evidence {
493
+ callId: string | null;
494
+
495
+ chatId: string | null;
496
+
497
+ observedAt: string;
498
+
499
+ /**
500
+ * Where in the conversation this was said
501
+ */
502
+ offsetMs: number | null;
503
+
504
+ /**
505
+ * The customer's words. Null on a project with redaction on.
506
+ */
507
+ quote: string | null;
508
+
509
+ source: 'LIVE_EXTRACTION' | 'POST_CALL_EXTRACTION' | 'API' | 'USER';
510
+
511
+ value: string;
512
+ }
513
+
514
+ export interface History {
515
+ callId: string | null;
516
+
517
+ chatId: string | null;
518
+
519
+ observedAt: string;
520
+
521
+ /**
522
+ * Where in the conversation this was said
523
+ */
524
+ offsetMs: number | null;
525
+
526
+ /**
527
+ * The customer's words. Null on a project with redaction on.
528
+ */
529
+ quote: string | null;
530
+
531
+ source: 'LIVE_EXTRACTION' | 'POST_CALL_EXTRACTION' | 'API' | 'USER';
532
+
533
+ value: string;
534
+ }
535
+ }
536
+ }
537
+ }
538
+
539
+ export interface CustomerProfileGetByIDResponse {
540
+ data: CustomerProfileGetByIDResponse.Data;
541
+ }
542
+
543
+ export namespace CustomerProfileGetByIDResponse {
544
+ export interface Data {
545
+ /**
546
+ * Unique identifier of the customer profile
547
+ */
548
+ id: string;
549
+
550
+ agentIds: Array<string>;
551
+
552
+ attributes: Array<Data.Attribute>;
553
+
554
+ chatCount: number;
555
+
556
+ conversationCount: number;
557
+
558
+ /**
559
+ * Null until a name is known, which is common
560
+ */
561
+ displayName: string | null;
562
+
563
+ externalId: string | null;
564
+
565
+ firstSeenAt: string | null;
566
+
567
+ lastSeenAt: string | null;
568
+
569
+ /**
570
+ * Your team's shared notes. Never sent to the agent.
571
+ */
572
+ notes: string | null;
573
+
574
+ notesUpdatedAt: string | null;
575
+
576
+ phoneNumberE164: string | null;
577
+
578
+ summary: string | null;
579
+
580
+ /**
581
+ * Voice only. Chat time is not included.
582
+ */
583
+ talkTimeMs: number;
584
+
585
+ voiceCount: number;
586
+ }
587
+
588
+ export namespace Data {
589
+ export interface Attribute {
590
+ /**
591
+ * What a newer conversation said while this field was locked
592
+ */
593
+ blockedValue: string | null;
594
+
595
+ /**
596
+ * The moment the current value was heard. Null for a value set by a person or the
597
+ * API.
598
+ */
599
+ evidence: Attribute.Evidence | null;
600
+
601
+ /**
602
+ * Other values this field has held or been offered, newest first
603
+ */
604
+ history: Array<Attribute.History>;
605
+
606
+ /**
607
+ * True when newer conversations cannot change this field
608
+ */
609
+ isLocked: boolean;
610
+
611
+ key:
612
+ | 'FULL_NAME'
613
+ | 'PREFERRED_NAME'
614
+ | 'ACCOUNT_ID'
615
+ | 'COMPANY'
616
+ | 'JOB_TITLE'
617
+ | 'EMAIL'
618
+ | 'ALTERNATE_PHONE'
619
+ | 'AGE'
620
+ | 'GENDER'
621
+ | 'LANGUAGE'
622
+ | 'LOCATION'
623
+ | 'TIMEZONE'
624
+ | 'BEST_TIME_TO_REACH'
625
+ | 'PREFERRED_CHANNEL';
626
+
627
+ observedAt: string;
628
+
629
+ /**
630
+ * Where the current value came from. LIVE and POST_CALL extraction are read from
631
+ * conversations.
632
+ */
633
+ source: 'LIVE_EXTRACTION' | 'POST_CALL_EXTRACTION' | 'API' | 'USER';
634
+
635
+ value: string;
636
+ }
637
+
638
+ export namespace Attribute {
639
+ /**
640
+ * The moment the current value was heard. Null for a value set by a person or the
641
+ * API.
642
+ */
643
+ export interface Evidence {
644
+ callId: string | null;
645
+
646
+ chatId: string | null;
647
+
648
+ observedAt: string;
649
+
650
+ /**
651
+ * Where in the conversation this was said
652
+ */
653
+ offsetMs: number | null;
654
+
655
+ /**
656
+ * The customer's words. Null on a project with redaction on.
657
+ */
658
+ quote: string | null;
659
+
660
+ source: 'LIVE_EXTRACTION' | 'POST_CALL_EXTRACTION' | 'API' | 'USER';
661
+
662
+ value: string;
663
+ }
664
+
665
+ export interface History {
666
+ callId: string | null;
667
+
668
+ chatId: string | null;
669
+
670
+ observedAt: string;
671
+
672
+ /**
673
+ * Where in the conversation this was said
674
+ */
675
+ offsetMs: number | null;
676
+
677
+ /**
678
+ * The customer's words. Null on a project with redaction on.
679
+ */
680
+ quote: string | null;
681
+
682
+ source: 'LIVE_EXTRACTION' | 'POST_CALL_EXTRACTION' | 'API' | 'USER';
683
+
684
+ value: string;
685
+ }
686
+ }
687
+ }
688
+ }
689
+
690
+ export interface CustomerProfileListConversationsResponse {
691
+ data: CustomerProfileListConversationsResponse.Data;
692
+ }
693
+
694
+ export namespace CustomerProfileListConversationsResponse {
695
+ export interface Data {
696
+ items: Array<Data.Item>;
697
+
698
+ page: number;
699
+
700
+ totalCount: number;
701
+ }
702
+
703
+ export namespace Data {
704
+ export interface Item {
705
+ id: string;
706
+
707
+ conversationType: 'call' | 'chat';
708
+
709
+ durationMs: number | null;
710
+
711
+ startedAt: string;
712
+
713
+ summary: string | null;
714
+
715
+ title: string | null;
716
+ }
717
+ }
718
+ }
719
+
720
+ export interface CustomerProfileSetAttributeResponse {
721
+ data: CustomerProfileSetAttributeResponse.Data;
722
+ }
723
+
724
+ export namespace CustomerProfileSetAttributeResponse {
725
+ export interface Data {
726
+ /**
727
+ * Unique identifier of the customer profile
728
+ */
729
+ id: string;
730
+
731
+ agentIds: Array<string>;
732
+
733
+ attributes: Array<Data.Attribute>;
734
+
735
+ chatCount: number;
736
+
737
+ conversationCount: number;
738
+
739
+ /**
740
+ * Null until a name is known, which is common
741
+ */
742
+ displayName: string | null;
743
+
744
+ externalId: string | null;
745
+
746
+ firstSeenAt: string | null;
747
+
748
+ lastSeenAt: string | null;
749
+
750
+ /**
751
+ * Your team's shared notes. Never sent to the agent.
752
+ */
753
+ notes: string | null;
754
+
755
+ notesUpdatedAt: string | null;
756
+
757
+ phoneNumberE164: string | null;
758
+
759
+ summary: string | null;
760
+
761
+ /**
762
+ * Voice only. Chat time is not included.
763
+ */
764
+ talkTimeMs: number;
765
+
766
+ voiceCount: number;
767
+ }
768
+
769
+ export namespace Data {
770
+ export interface Attribute {
771
+ /**
772
+ * What a newer conversation said while this field was locked
773
+ */
774
+ blockedValue: string | null;
775
+
776
+ /**
777
+ * The moment the current value was heard. Null for a value set by a person or the
778
+ * API.
779
+ */
780
+ evidence: Attribute.Evidence | null;
781
+
782
+ /**
783
+ * Other values this field has held or been offered, newest first
784
+ */
785
+ history: Array<Attribute.History>;
786
+
787
+ /**
788
+ * True when newer conversations cannot change this field
789
+ */
790
+ isLocked: boolean;
791
+
792
+ key:
793
+ | 'FULL_NAME'
794
+ | 'PREFERRED_NAME'
795
+ | 'ACCOUNT_ID'
796
+ | 'COMPANY'
797
+ | 'JOB_TITLE'
798
+ | 'EMAIL'
799
+ | 'ALTERNATE_PHONE'
800
+ | 'AGE'
801
+ | 'GENDER'
802
+ | 'LANGUAGE'
803
+ | 'LOCATION'
804
+ | 'TIMEZONE'
805
+ | 'BEST_TIME_TO_REACH'
806
+ | 'PREFERRED_CHANNEL';
807
+
808
+ observedAt: string;
809
+
810
+ /**
811
+ * Where the current value came from. LIVE and POST_CALL extraction are read from
812
+ * conversations.
813
+ */
814
+ source: 'LIVE_EXTRACTION' | 'POST_CALL_EXTRACTION' | 'API' | 'USER';
815
+
816
+ value: string;
817
+ }
818
+
819
+ export namespace Attribute {
820
+ /**
821
+ * The moment the current value was heard. Null for a value set by a person or the
822
+ * API.
823
+ */
824
+ export interface Evidence {
825
+ callId: string | null;
826
+
827
+ chatId: string | null;
828
+
829
+ observedAt: string;
830
+
831
+ /**
832
+ * Where in the conversation this was said
833
+ */
834
+ offsetMs: number | null;
835
+
836
+ /**
837
+ * The customer's words. Null on a project with redaction on.
838
+ */
839
+ quote: string | null;
840
+
841
+ source: 'LIVE_EXTRACTION' | 'POST_CALL_EXTRACTION' | 'API' | 'USER';
842
+
843
+ value: string;
844
+ }
845
+
846
+ export interface History {
847
+ callId: string | null;
848
+
849
+ chatId: string | null;
850
+
851
+ observedAt: string;
852
+
853
+ /**
854
+ * Where in the conversation this was said
855
+ */
856
+ offsetMs: number | null;
857
+
858
+ /**
859
+ * The customer's words. Null on a project with redaction on.
860
+ */
861
+ quote: string | null;
862
+
863
+ source: 'LIVE_EXTRACTION' | 'POST_CALL_EXTRACTION' | 'API' | 'USER';
864
+
865
+ value: string;
866
+ }
867
+ }
868
+ }
869
+ }
870
+
871
+ export interface CustomerProfileUnlockAttributeResponse {
872
+ data: CustomerProfileUnlockAttributeResponse.Data;
873
+ }
874
+
875
+ export namespace CustomerProfileUnlockAttributeResponse {
876
+ export interface Data {
877
+ /**
878
+ * Unique identifier of the customer profile
879
+ */
880
+ id: string;
881
+
882
+ agentIds: Array<string>;
883
+
884
+ attributes: Array<Data.Attribute>;
885
+
886
+ chatCount: number;
887
+
888
+ conversationCount: number;
889
+
890
+ /**
891
+ * Null until a name is known, which is common
892
+ */
893
+ displayName: string | null;
894
+
895
+ externalId: string | null;
896
+
897
+ firstSeenAt: string | null;
898
+
899
+ lastSeenAt: string | null;
900
+
901
+ /**
902
+ * Your team's shared notes. Never sent to the agent.
903
+ */
904
+ notes: string | null;
905
+
906
+ notesUpdatedAt: string | null;
907
+
908
+ phoneNumberE164: string | null;
909
+
910
+ summary: string | null;
911
+
912
+ /**
913
+ * Voice only. Chat time is not included.
914
+ */
915
+ talkTimeMs: number;
916
+
917
+ voiceCount: number;
918
+ }
919
+
920
+ export namespace Data {
921
+ export interface Attribute {
922
+ /**
923
+ * What a newer conversation said while this field was locked
924
+ */
925
+ blockedValue: string | null;
926
+
927
+ /**
928
+ * The moment the current value was heard. Null for a value set by a person or the
929
+ * API.
930
+ */
931
+ evidence: Attribute.Evidence | null;
932
+
933
+ /**
934
+ * Other values this field has held or been offered, newest first
935
+ */
936
+ history: Array<Attribute.History>;
937
+
938
+ /**
939
+ * True when newer conversations cannot change this field
940
+ */
941
+ isLocked: boolean;
942
+
943
+ key:
944
+ | 'FULL_NAME'
945
+ | 'PREFERRED_NAME'
946
+ | 'ACCOUNT_ID'
947
+ | 'COMPANY'
948
+ | 'JOB_TITLE'
949
+ | 'EMAIL'
950
+ | 'ALTERNATE_PHONE'
951
+ | 'AGE'
952
+ | 'GENDER'
953
+ | 'LANGUAGE'
954
+ | 'LOCATION'
955
+ | 'TIMEZONE'
956
+ | 'BEST_TIME_TO_REACH'
957
+ | 'PREFERRED_CHANNEL';
958
+
959
+ observedAt: string;
960
+
961
+ /**
962
+ * Where the current value came from. LIVE and POST_CALL extraction are read from
963
+ * conversations.
964
+ */
965
+ source: 'LIVE_EXTRACTION' | 'POST_CALL_EXTRACTION' | 'API' | 'USER';
966
+
967
+ value: string;
968
+ }
969
+
970
+ export namespace Attribute {
971
+ /**
972
+ * The moment the current value was heard. Null for a value set by a person or the
973
+ * API.
974
+ */
975
+ export interface Evidence {
976
+ callId: string | null;
977
+
978
+ chatId: string | null;
979
+
980
+ observedAt: string;
981
+
982
+ /**
983
+ * Where in the conversation this was said
984
+ */
985
+ offsetMs: number | null;
986
+
987
+ /**
988
+ * The customer's words. Null on a project with redaction on.
989
+ */
990
+ quote: string | null;
991
+
992
+ source: 'LIVE_EXTRACTION' | 'POST_CALL_EXTRACTION' | 'API' | 'USER';
993
+
994
+ value: string;
995
+ }
996
+
997
+ export interface History {
998
+ callId: string | null;
999
+
1000
+ chatId: string | null;
1001
+
1002
+ observedAt: string;
1003
+
1004
+ /**
1005
+ * Where in the conversation this was said
1006
+ */
1007
+ offsetMs: number | null;
1008
+
1009
+ /**
1010
+ * The customer's words. Null on a project with redaction on.
1011
+ */
1012
+ quote: string | null;
1013
+
1014
+ source: 'LIVE_EXTRACTION' | 'POST_CALL_EXTRACTION' | 'API' | 'USER';
1015
+
1016
+ value: string;
1017
+ }
1018
+ }
1019
+ }
1020
+ }
1021
+
1022
+ export interface CustomerProfileUpdateNotesResponse {
1023
+ data: CustomerProfileUpdateNotesResponse.Data;
1024
+ }
1025
+
1026
+ export namespace CustomerProfileUpdateNotesResponse {
1027
+ export interface Data {
1028
+ /**
1029
+ * Unique identifier of the customer profile
1030
+ */
1031
+ id: string;
1032
+
1033
+ agentIds: Array<string>;
1034
+
1035
+ attributes: Array<Data.Attribute>;
1036
+
1037
+ chatCount: number;
1038
+
1039
+ conversationCount: number;
1040
+
1041
+ /**
1042
+ * Null until a name is known, which is common
1043
+ */
1044
+ displayName: string | null;
1045
+
1046
+ externalId: string | null;
1047
+
1048
+ firstSeenAt: string | null;
1049
+
1050
+ lastSeenAt: string | null;
1051
+
1052
+ /**
1053
+ * Your team's shared notes. Never sent to the agent.
1054
+ */
1055
+ notes: string | null;
1056
+
1057
+ notesUpdatedAt: string | null;
1058
+
1059
+ phoneNumberE164: string | null;
1060
+
1061
+ summary: string | null;
1062
+
1063
+ /**
1064
+ * Voice only. Chat time is not included.
1065
+ */
1066
+ talkTimeMs: number;
1067
+
1068
+ voiceCount: number;
1069
+ }
1070
+
1071
+ export namespace Data {
1072
+ export interface Attribute {
1073
+ /**
1074
+ * What a newer conversation said while this field was locked
1075
+ */
1076
+ blockedValue: string | null;
1077
+
1078
+ /**
1079
+ * The moment the current value was heard. Null for a value set by a person or the
1080
+ * API.
1081
+ */
1082
+ evidence: Attribute.Evidence | null;
1083
+
1084
+ /**
1085
+ * Other values this field has held or been offered, newest first
1086
+ */
1087
+ history: Array<Attribute.History>;
1088
+
1089
+ /**
1090
+ * True when newer conversations cannot change this field
1091
+ */
1092
+ isLocked: boolean;
1093
+
1094
+ key:
1095
+ | 'FULL_NAME'
1096
+ | 'PREFERRED_NAME'
1097
+ | 'ACCOUNT_ID'
1098
+ | 'COMPANY'
1099
+ | 'JOB_TITLE'
1100
+ | 'EMAIL'
1101
+ | 'ALTERNATE_PHONE'
1102
+ | 'AGE'
1103
+ | 'GENDER'
1104
+ | 'LANGUAGE'
1105
+ | 'LOCATION'
1106
+ | 'TIMEZONE'
1107
+ | 'BEST_TIME_TO_REACH'
1108
+ | 'PREFERRED_CHANNEL';
1109
+
1110
+ observedAt: string;
1111
+
1112
+ /**
1113
+ * Where the current value came from. LIVE and POST_CALL extraction are read from
1114
+ * conversations.
1115
+ */
1116
+ source: 'LIVE_EXTRACTION' | 'POST_CALL_EXTRACTION' | 'API' | 'USER';
1117
+
1118
+ value: string;
1119
+ }
1120
+
1121
+ export namespace Attribute {
1122
+ /**
1123
+ * The moment the current value was heard. Null for a value set by a person or the
1124
+ * API.
1125
+ */
1126
+ export interface Evidence {
1127
+ callId: string | null;
1128
+
1129
+ chatId: string | null;
1130
+
1131
+ observedAt: string;
1132
+
1133
+ /**
1134
+ * Where in the conversation this was said
1135
+ */
1136
+ offsetMs: number | null;
1137
+
1138
+ /**
1139
+ * The customer's words. Null on a project with redaction on.
1140
+ */
1141
+ quote: string | null;
1142
+
1143
+ source: 'LIVE_EXTRACTION' | 'POST_CALL_EXTRACTION' | 'API' | 'USER';
1144
+
1145
+ value: string;
1146
+ }
1147
+
1148
+ export interface History {
1149
+ callId: string | null;
1150
+
1151
+ chatId: string | null;
1152
+
1153
+ observedAt: string;
1154
+
1155
+ /**
1156
+ * Where in the conversation this was said
1157
+ */
1158
+ offsetMs: number | null;
1159
+
1160
+ /**
1161
+ * The customer's words. Null on a project with redaction on.
1162
+ */
1163
+ quote: string | null;
1164
+
1165
+ source: 'LIVE_EXTRACTION' | 'POST_CALL_EXTRACTION' | 'API' | 'USER';
1166
+
1167
+ value: string;
1168
+ }
1169
+ }
1170
+ }
1171
+ }
1172
+
1173
+ export interface CustomerProfileListParams {
1174
+ agentId?: string;
1175
+
1176
+ /**
1177
+ * Filter by this field. Use with fieldOperator and, unless checking presence,
1178
+ * fieldValue.
1179
+ */
1180
+ fieldKey?:
1181
+ | 'FULL_NAME'
1182
+ | 'PREFERRED_NAME'
1183
+ | 'ACCOUNT_ID'
1184
+ | 'COMPANY'
1185
+ | 'JOB_TITLE'
1186
+ | 'EMAIL'
1187
+ | 'ALTERNATE_PHONE'
1188
+ | 'AGE'
1189
+ | 'GENDER'
1190
+ | 'LANGUAGE'
1191
+ | 'LOCATION'
1192
+ | 'TIMEZONE'
1193
+ | 'BEST_TIME_TO_REACH'
1194
+ | 'PREFERRED_CHANNEL';
1195
+
1196
+ /**
1197
+ * How fieldValue is compared, ignoring case. NOT_EQUALS includes customers without
1198
+ * the field.
1199
+ */
1200
+ fieldOperator?: 'EQUALS' | 'NOT_EQUALS' | 'CONTAINS' | 'STARTS_WITH' | 'IS_SET' | 'IS_NOT_SET';
1201
+
1202
+ fieldValue?: string;
1203
+
1204
+ /**
1205
+ * Include customers we hold nothing about beyond their identifier. Defaults to
1206
+ * false.
1207
+ */
1208
+ includeNoData?: 'true' | 'false';
1209
+
1210
+ limit?: number;
1211
+
1212
+ modality?: 'call' | 'chat';
1213
+
1214
+ page?: number;
1215
+
1216
+ search?: string;
1217
+
1218
+ /**
1219
+ * A column, or field.<KEY> (for example field.COMPANY) to sort by a field's value.
1220
+ * Customers without a value sort last.
1221
+ */
1222
+ sortBy?:
1223
+ | 'lastSeenAt'
1224
+ | 'firstSeenAt'
1225
+ | 'conversationCount'
1226
+ | 'voiceCount'
1227
+ | 'chatCount'
1228
+ | 'talkTimeMs'
1229
+ | 'displayName'
1230
+ | 'field.FULL_NAME'
1231
+ | 'field.PREFERRED_NAME'
1232
+ | 'field.ACCOUNT_ID'
1233
+ | 'field.COMPANY'
1234
+ | 'field.JOB_TITLE'
1235
+ | 'field.EMAIL'
1236
+ | 'field.ALTERNATE_PHONE'
1237
+ | 'field.AGE'
1238
+ | 'field.GENDER'
1239
+ | 'field.LANGUAGE'
1240
+ | 'field.LOCATION'
1241
+ | 'field.TIMEZONE'
1242
+ | 'field.BEST_TIME_TO_REACH'
1243
+ | 'field.PREFERRED_CHANNEL';
1244
+
1245
+ sortDirection?: 'asc' | 'desc';
1246
+ }
1247
+
1248
+ export interface CustomerProfileClearAttributeParams {
1249
+ customerProfileId: string;
1250
+ }
1251
+
1252
+ export interface CustomerProfileListConversationsParams {
1253
+ limit?: number;
1254
+
1255
+ page?: number;
1256
+ }
1257
+
1258
+ export interface CustomerProfileSetAttributeParams {
1259
+ /**
1260
+ * Path param
1261
+ */
1262
+ customerProfileId: string;
1263
+
1264
+ /**
1265
+ * Body param: The new value. Setting a field locks it, so newer conversations
1266
+ * cannot change it.
1267
+ */
1268
+ value: string;
1269
+ }
1270
+
1271
+ export interface CustomerProfileUnlockAttributeParams {
1272
+ customerProfileId: string;
1273
+ }
1274
+
1275
+ export interface CustomerProfileUpdateNotesParams {
1276
+ /**
1277
+ * Replaces the existing notes. Null or empty clears them.
1278
+ */
1279
+ notes: string | null;
1280
+ }
1281
+
1282
+ export declare namespace CustomerProfile {
1283
+ export {
1284
+ type CustomerProfileListResponse as CustomerProfileListResponse,
1285
+ type CustomerProfileDeleteResponse as CustomerProfileDeleteResponse,
1286
+ type CustomerProfileClearAttributeResponse as CustomerProfileClearAttributeResponse,
1287
+ type CustomerProfileGetByIDResponse as CustomerProfileGetByIDResponse,
1288
+ type CustomerProfileListConversationsResponse as CustomerProfileListConversationsResponse,
1289
+ type CustomerProfileSetAttributeResponse as CustomerProfileSetAttributeResponse,
1290
+ type CustomerProfileUnlockAttributeResponse as CustomerProfileUnlockAttributeResponse,
1291
+ type CustomerProfileUpdateNotesResponse as CustomerProfileUpdateNotesResponse,
1292
+ type CustomerProfileListParams as CustomerProfileListParams,
1293
+ type CustomerProfileClearAttributeParams as CustomerProfileClearAttributeParams,
1294
+ type CustomerProfileListConversationsParams as CustomerProfileListConversationsParams,
1295
+ type CustomerProfileSetAttributeParams as CustomerProfileSetAttributeParams,
1296
+ type CustomerProfileUnlockAttributeParams as CustomerProfileUnlockAttributeParams,
1297
+ type CustomerProfileUpdateNotesParams as CustomerProfileUpdateNotesParams,
1298
+ };
1299
+ }