@dialgem/sdk 0.1.0-beta.1 → 0.1.0-beta.2
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 +17 -1
- package/README.md +89 -10
- package/dist/index.cjs +490 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1639 -37
- package/dist/index.d.ts +1639 -37
- package/dist/index.js +490 -3
- package/dist/index.js.map +1 -1
- package/examples/webhook-express.ts +12 -4
- package/examples/webhook-fastify.ts +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -138,7 +138,7 @@ interface RequestOptions {
|
|
|
138
138
|
/**
|
|
139
139
|
* Retries on 408/429/5xx and connection failures.
|
|
140
140
|
*
|
|
141
|
-
* GET, PATCH and DELETE use the client's `maxRetries` unless overridden here.
|
|
141
|
+
* GET, PUT, PATCH and DELETE use the client's `maxRetries` unless overridden here.
|
|
142
142
|
* **POST is never retried unless you set this explicitly**: most POSTs create
|
|
143
143
|
* things, and an outbound call retried after an ambiguous 502 dials the person twice.
|
|
144
144
|
*/
|
|
@@ -160,7 +160,7 @@ interface HttpClientOptions {
|
|
|
160
160
|
fetch: Fetch;
|
|
161
161
|
defaultHeaders: Record<string, string>;
|
|
162
162
|
}
|
|
163
|
-
type Method = "GET" | "POST" | "PATCH" | "DELETE";
|
|
163
|
+
type Method = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
164
164
|
declare class HttpClient {
|
|
165
165
|
#private;
|
|
166
166
|
readonly baseURL: string;
|
|
@@ -175,6 +175,7 @@ declare class HttpClient {
|
|
|
175
175
|
* header ourselves produces a request no server can parse.
|
|
176
176
|
*/
|
|
177
177
|
postForm<T>(path: string, form: FormData, options?: RequestOptions): Promise<T>;
|
|
178
|
+
put<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
178
179
|
patch<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
179
180
|
delete<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
180
181
|
request<T>(method: Method, path: string, { query, body, options }: {
|
|
@@ -190,6 +191,11 @@ interface components {
|
|
|
190
191
|
schemas: {
|
|
191
192
|
/** AgentCreate */
|
|
192
193
|
AgentCreate: {
|
|
194
|
+
/**
|
|
195
|
+
* Adaptive Response Wait
|
|
196
|
+
* @default false
|
|
197
|
+
*/
|
|
198
|
+
adaptive_response_wait?: boolean;
|
|
193
199
|
/**
|
|
194
200
|
* Agent Type
|
|
195
201
|
* @default llm
|
|
@@ -224,6 +230,16 @@ interface components {
|
|
|
224
230
|
begin_message_delay_ms?: number;
|
|
225
231
|
/** Boosted Keywords */
|
|
226
232
|
boosted_keywords?: string[];
|
|
233
|
+
/**
|
|
234
|
+
* Call Screen Handling Enabled
|
|
235
|
+
* @default false
|
|
236
|
+
*/
|
|
237
|
+
call_screen_handling_enabled?: boolean;
|
|
238
|
+
/**
|
|
239
|
+
* Call Screen Message
|
|
240
|
+
* @default
|
|
241
|
+
*/
|
|
242
|
+
call_screen_message?: string;
|
|
227
243
|
/** Data Retention Days */
|
|
228
244
|
data_retention_days?: number | null;
|
|
229
245
|
/**
|
|
@@ -241,7 +257,17 @@ interface components {
|
|
|
241
257
|
* @default off
|
|
242
258
|
* @enum {string}
|
|
243
259
|
*/
|
|
244
|
-
denoising_mode?: "off" | "noise-cancellation";
|
|
260
|
+
denoising_mode?: "off" | "noise-cancellation" | "noise-and-background-speech-cancellation";
|
|
261
|
+
/**
|
|
262
|
+
* Denoising Strength
|
|
263
|
+
* @default 0.5
|
|
264
|
+
*/
|
|
265
|
+
denoising_strength?: number;
|
|
266
|
+
/**
|
|
267
|
+
* Dnc Detection Enabled
|
|
268
|
+
* @default false
|
|
269
|
+
*/
|
|
270
|
+
dnc_detection_enabled?: boolean;
|
|
245
271
|
/**
|
|
246
272
|
* Enable Backchannel
|
|
247
273
|
* @default false
|
|
@@ -266,16 +292,30 @@ interface components {
|
|
|
266
292
|
/** First Message */
|
|
267
293
|
first_message?: string | null;
|
|
268
294
|
flow_config?: components["schemas"]["FlowConfig"] | null;
|
|
295
|
+
/** Flow Id */
|
|
296
|
+
flow_id?: string | null;
|
|
269
297
|
/**
|
|
270
298
|
* Interruption Sensitivity
|
|
271
299
|
* @default 1
|
|
272
300
|
*/
|
|
273
301
|
interruption_sensitivity?: number;
|
|
302
|
+
/**
|
|
303
|
+
* Ivr Hangup Enabled
|
|
304
|
+
* @default false
|
|
305
|
+
*/
|
|
306
|
+
ivr_hangup_enabled?: boolean;
|
|
307
|
+
/**
|
|
308
|
+
* Ivr Prompt
|
|
309
|
+
* @default
|
|
310
|
+
*/
|
|
311
|
+
ivr_prompt?: string;
|
|
274
312
|
/**
|
|
275
313
|
* Language
|
|
276
314
|
* @default en
|
|
277
315
|
*/
|
|
278
316
|
language?: string;
|
|
317
|
+
/** Llm Id */
|
|
318
|
+
llm_id?: string | null;
|
|
279
319
|
/** Llm Model */
|
|
280
320
|
llm_model?: string;
|
|
281
321
|
/**
|
|
@@ -319,6 +359,7 @@ interface components {
|
|
|
319
359
|
* @default claude-sonnet-4-6
|
|
320
360
|
*/
|
|
321
361
|
post_call_analysis_model?: string;
|
|
362
|
+
post_call_builtin_fields?: components["schemas"]["BuiltinAnalysisFields"];
|
|
322
363
|
/** Pronunciation Dictionary */
|
|
323
364
|
pronunciation_dictionary?: components["schemas"]["PronunciationEntry"][];
|
|
324
365
|
/** Reminder Max Count */
|
|
@@ -347,6 +388,12 @@ interface components {
|
|
|
347
388
|
starting_state?: string | null;
|
|
348
389
|
/** States */
|
|
349
390
|
states?: components["schemas"]["PromptState"][];
|
|
391
|
+
/**
|
|
392
|
+
* Stt Mode
|
|
393
|
+
* @default fast
|
|
394
|
+
* @enum {string}
|
|
395
|
+
*/
|
|
396
|
+
stt_mode?: "fast" | "accurate";
|
|
350
397
|
/**
|
|
351
398
|
* Stt Model
|
|
352
399
|
* @enum {string}
|
|
@@ -368,6 +415,12 @@ interface components {
|
|
|
368
415
|
*/
|
|
369
416
|
tts_engine?: string;
|
|
370
417
|
user_dtmf_options?: components["schemas"]["UserDtmfOptions"];
|
|
418
|
+
/**
|
|
419
|
+
* Vocab Specialization
|
|
420
|
+
* @default general
|
|
421
|
+
* @enum {string}
|
|
422
|
+
*/
|
|
423
|
+
vocab_specialization?: "general" | "medical";
|
|
371
424
|
/**
|
|
372
425
|
* Voice Id
|
|
373
426
|
* @default
|
|
@@ -399,10 +452,20 @@ interface components {
|
|
|
399
452
|
* @default
|
|
400
453
|
*/
|
|
401
454
|
voicemail_message?: string;
|
|
455
|
+
/**
|
|
456
|
+
* Voicemail Prompt
|
|
457
|
+
* @default
|
|
458
|
+
*/
|
|
459
|
+
voicemail_prompt?: string;
|
|
402
460
|
/** Webhook Events */
|
|
403
|
-
webhook_events?: ("call_started" | "call_ended" | "call_analyzed")[];
|
|
461
|
+
webhook_events?: ("call_started" | "call_ended" | "call_analyzed" | "transcript_updated" | "transfer_started" | "transfer_bridged" | "transfer_cancelled" | "transfer_ended" | "chat_started" | "chat_ended" | "chat_analyzed")[];
|
|
404
462
|
/** Webhook Signing Secret */
|
|
405
463
|
webhook_signing_secret?: string | null;
|
|
464
|
+
/**
|
|
465
|
+
* Webhook Timeout Ms
|
|
466
|
+
* @default 10000
|
|
467
|
+
*/
|
|
468
|
+
webhook_timeout_ms?: number;
|
|
406
469
|
/** Webhook Url */
|
|
407
470
|
webhook_url?: string | null;
|
|
408
471
|
};
|
|
@@ -450,6 +513,8 @@ interface components {
|
|
|
450
513
|
};
|
|
451
514
|
/** AgentUpdate */
|
|
452
515
|
AgentUpdate: {
|
|
516
|
+
/** Adaptive Response Wait */
|
|
517
|
+
adaptive_response_wait?: boolean | null;
|
|
453
518
|
/** Agent Type */
|
|
454
519
|
agent_type?: ("llm" | "multi_prompt" | "flow") | null;
|
|
455
520
|
/** Allow User Dtmf */
|
|
@@ -464,6 +529,10 @@ interface components {
|
|
|
464
529
|
begin_message_delay_ms?: number | null;
|
|
465
530
|
/** Boosted Keywords */
|
|
466
531
|
boosted_keywords?: string[] | null;
|
|
532
|
+
/** Call Screen Handling Enabled */
|
|
533
|
+
call_screen_handling_enabled?: boolean | null;
|
|
534
|
+
/** Call Screen Message */
|
|
535
|
+
call_screen_message?: string | null;
|
|
467
536
|
/** Data Retention Days */
|
|
468
537
|
data_retention_days?: number | null;
|
|
469
538
|
/** Data Storage Setting */
|
|
@@ -473,7 +542,11 @@ interface components {
|
|
|
473
542
|
[key: string]: string;
|
|
474
543
|
} | null;
|
|
475
544
|
/** Denoising Mode */
|
|
476
|
-
denoising_mode?: ("off" | "noise-cancellation") | null;
|
|
545
|
+
denoising_mode?: ("off" | "noise-cancellation" | "noise-and-background-speech-cancellation") | null;
|
|
546
|
+
/** Denoising Strength */
|
|
547
|
+
denoising_strength?: number | null;
|
|
548
|
+
/** Dnc Detection Enabled */
|
|
549
|
+
dnc_detection_enabled?: boolean | null;
|
|
477
550
|
/** Enable Backchannel */
|
|
478
551
|
enable_backchannel?: boolean | null;
|
|
479
552
|
/** Enable Transcription Formatting */
|
|
@@ -489,10 +562,20 @@ interface components {
|
|
|
489
562
|
/** First Message */
|
|
490
563
|
first_message?: string | null;
|
|
491
564
|
flow_config?: components["schemas"]["FlowConfig"] | null;
|
|
565
|
+
/** Flow Id */
|
|
566
|
+
flow_id?: string | null;
|
|
567
|
+
/** Folder Id */
|
|
568
|
+
folder_id?: string | null;
|
|
492
569
|
/** Interruption Sensitivity */
|
|
493
570
|
interruption_sensitivity?: number | null;
|
|
571
|
+
/** Ivr Hangup Enabled */
|
|
572
|
+
ivr_hangup_enabled?: boolean | null;
|
|
573
|
+
/** Ivr Prompt */
|
|
574
|
+
ivr_prompt?: string | null;
|
|
494
575
|
/** Language */
|
|
495
576
|
language?: string | null;
|
|
577
|
+
/** Llm Id */
|
|
578
|
+
llm_id?: string | null;
|
|
496
579
|
/** Llm Model */
|
|
497
580
|
llm_model?: string | null;
|
|
498
581
|
/** Llm Provider */
|
|
@@ -515,6 +598,7 @@ interface components {
|
|
|
515
598
|
post_call_analysis_data?: components["schemas"]["PostCallAnalysisVariable"][] | null;
|
|
516
599
|
/** Post Call Analysis Model */
|
|
517
600
|
post_call_analysis_model?: string | null;
|
|
601
|
+
post_call_builtin_fields?: components["schemas"]["BuiltinAnalysisFields"] | null;
|
|
518
602
|
/** Pronunciation Dictionary */
|
|
519
603
|
pronunciation_dictionary?: components["schemas"]["PronunciationEntry"][] | null;
|
|
520
604
|
/** Reminder Max Count */
|
|
@@ -531,6 +615,8 @@ interface components {
|
|
|
531
615
|
starting_state?: string | null;
|
|
532
616
|
/** States */
|
|
533
617
|
states?: components["schemas"]["PromptState"][] | null;
|
|
618
|
+
/** Stt Mode */
|
|
619
|
+
stt_mode?: ("fast" | "accurate") | null;
|
|
534
620
|
/** Stt Model */
|
|
535
621
|
stt_model?: ("whisper" | "conformer" | "deepgram") | null;
|
|
536
622
|
/** System Prompt */
|
|
@@ -540,6 +626,8 @@ interface components {
|
|
|
540
626
|
/** Tts Engine */
|
|
541
627
|
tts_engine?: string | null;
|
|
542
628
|
user_dtmf_options?: components["schemas"]["UserDtmfOptions"] | null;
|
|
629
|
+
/** Vocab Specialization */
|
|
630
|
+
vocab_specialization?: ("general" | "medical") | null;
|
|
543
631
|
/** Voice Id */
|
|
544
632
|
voice_id?: string | null;
|
|
545
633
|
/** Voice Speed */
|
|
@@ -552,10 +640,14 @@ interface components {
|
|
|
552
640
|
voicemail_detection_enabled?: boolean | null;
|
|
553
641
|
/** Voicemail Message */
|
|
554
642
|
voicemail_message?: string | null;
|
|
643
|
+
/** Voicemail Prompt */
|
|
644
|
+
voicemail_prompt?: string | null;
|
|
555
645
|
/** Webhook Events */
|
|
556
|
-
webhook_events?: ("call_started" | "call_ended" | "call_analyzed")[] | null;
|
|
646
|
+
webhook_events?: ("call_started" | "call_ended" | "call_analyzed" | "transcript_updated" | "transfer_started" | "transfer_bridged" | "transfer_cancelled" | "transfer_ended" | "chat_started" | "chat_ended" | "chat_analyzed")[] | null;
|
|
557
647
|
/** Webhook Signing Secret */
|
|
558
648
|
webhook_signing_secret?: string | null;
|
|
649
|
+
/** Webhook Timeout Ms */
|
|
650
|
+
webhook_timeout_ms?: number | null;
|
|
559
651
|
/** Webhook Url */
|
|
560
652
|
webhook_url?: string | null;
|
|
561
653
|
};
|
|
@@ -623,6 +715,24 @@ interface components {
|
|
|
623
715
|
} & {
|
|
624
716
|
[key: string]: unknown;
|
|
625
717
|
};
|
|
718
|
+
/** BuiltinAnalysisField */
|
|
719
|
+
BuiltinAnalysisField: {
|
|
720
|
+
/** Choices */
|
|
721
|
+
choices?: string[] | null;
|
|
722
|
+
/** Description */
|
|
723
|
+
description?: string | null;
|
|
724
|
+
/**
|
|
725
|
+
* Enabled
|
|
726
|
+
* @default true
|
|
727
|
+
*/
|
|
728
|
+
enabled?: boolean;
|
|
729
|
+
};
|
|
730
|
+
/** BuiltinAnalysisFields */
|
|
731
|
+
BuiltinAnalysisFields: {
|
|
732
|
+
call_successful?: components["schemas"]["BuiltinAnalysisField"] | null;
|
|
733
|
+
call_summary?: components["schemas"]["BuiltinAnalysisField"] | null;
|
|
734
|
+
user_sentiment?: components["schemas"]["BuiltinAnalysisField"] | null;
|
|
735
|
+
};
|
|
626
736
|
/** CallPatch */
|
|
627
737
|
CallPatch: {
|
|
628
738
|
/** Amd Result */
|
|
@@ -656,6 +766,204 @@ interface components {
|
|
|
656
766
|
/** Transcript */
|
|
657
767
|
transcript?: unknown[] | null;
|
|
658
768
|
};
|
|
769
|
+
/** CaseBody */
|
|
770
|
+
CaseBody: {
|
|
771
|
+
/** Caller */
|
|
772
|
+
caller: {
|
|
773
|
+
[key: string]: unknown;
|
|
774
|
+
};
|
|
775
|
+
/** Checks */
|
|
776
|
+
checks: {
|
|
777
|
+
[key: string]: unknown;
|
|
778
|
+
}[];
|
|
779
|
+
/** Dynamic Variables */
|
|
780
|
+
dynamic_variables?: {
|
|
781
|
+
[key: string]: unknown;
|
|
782
|
+
};
|
|
783
|
+
/** Name */
|
|
784
|
+
name: string;
|
|
785
|
+
/** Tool Mocks */
|
|
786
|
+
tool_mocks?: {
|
|
787
|
+
[key: string]: unknown;
|
|
788
|
+
};
|
|
789
|
+
};
|
|
790
|
+
/** CaseUpdate */
|
|
791
|
+
CaseUpdate: {
|
|
792
|
+
/** Caller */
|
|
793
|
+
caller?: {
|
|
794
|
+
[key: string]: unknown;
|
|
795
|
+
} | null;
|
|
796
|
+
/** Checks */
|
|
797
|
+
checks?: {
|
|
798
|
+
[key: string]: unknown;
|
|
799
|
+
}[] | null;
|
|
800
|
+
/** Dynamic Variables */
|
|
801
|
+
dynamic_variables?: {
|
|
802
|
+
[key: string]: unknown;
|
|
803
|
+
} | null;
|
|
804
|
+
/** Name */
|
|
805
|
+
name?: string | null;
|
|
806
|
+
/** Tool Mocks */
|
|
807
|
+
tool_mocks?: {
|
|
808
|
+
[key: string]: unknown;
|
|
809
|
+
} | null;
|
|
810
|
+
};
|
|
811
|
+
/** ChatCreate */
|
|
812
|
+
ChatCreate: {
|
|
813
|
+
/** Agent Id */
|
|
814
|
+
agent_id: string;
|
|
815
|
+
/** Agent Version */
|
|
816
|
+
agent_version?: number | null;
|
|
817
|
+
/** Dynamic Variables */
|
|
818
|
+
dynamic_variables?: {
|
|
819
|
+
[key: string]: unknown;
|
|
820
|
+
} | null;
|
|
821
|
+
/** Metadata */
|
|
822
|
+
metadata?: {
|
|
823
|
+
[key: string]: unknown;
|
|
824
|
+
} | null;
|
|
825
|
+
};
|
|
826
|
+
/** ChatMessageCreate */
|
|
827
|
+
ChatMessageCreate: {
|
|
828
|
+
/** Content */
|
|
829
|
+
content: string;
|
|
830
|
+
};
|
|
831
|
+
/** ChatUpdate */
|
|
832
|
+
ChatUpdate: {
|
|
833
|
+
/** Metadata */
|
|
834
|
+
metadata?: {
|
|
835
|
+
[key: string]: unknown;
|
|
836
|
+
} | null;
|
|
837
|
+
};
|
|
838
|
+
/** CodeNode */
|
|
839
|
+
CodeNode: {
|
|
840
|
+
/** Code */
|
|
841
|
+
code?: string | null;
|
|
842
|
+
display_position?: components["schemas"]["DisplayPosition"] | null;
|
|
843
|
+
/** Edges */
|
|
844
|
+
edges?: components["schemas"]["Edge"][];
|
|
845
|
+
else_edge?: components["schemas"]["Edge"] | null;
|
|
846
|
+
/** Enable Typing Sound */
|
|
847
|
+
enable_typing_sound?: boolean | null;
|
|
848
|
+
/** Execution Status Variable */
|
|
849
|
+
execution_status_variable?: string | null;
|
|
850
|
+
/** Finetune Transition Examples */
|
|
851
|
+
finetune_transition_examples?: unknown[] | null;
|
|
852
|
+
global_node_setting?: components["schemas"]["GlobalNodeSetting"] | null;
|
|
853
|
+
/** Id */
|
|
854
|
+
id: string;
|
|
855
|
+
instruction?: components["schemas"]["Instruction"] | null;
|
|
856
|
+
/** Name */
|
|
857
|
+
name?: string | null;
|
|
858
|
+
/** Response Variables */
|
|
859
|
+
response_variables?: {
|
|
860
|
+
[key: string]: string;
|
|
861
|
+
} | null;
|
|
862
|
+
/** Speak During Execution */
|
|
863
|
+
speak_during_execution?: boolean | null;
|
|
864
|
+
/** Timeout Ms */
|
|
865
|
+
timeout_ms?: number | null;
|
|
866
|
+
/**
|
|
867
|
+
* Type
|
|
868
|
+
* @constant
|
|
869
|
+
*/
|
|
870
|
+
type: "code";
|
|
871
|
+
/** Wait For Result */
|
|
872
|
+
wait_for_result?: boolean | null;
|
|
873
|
+
} & {
|
|
874
|
+
[key: string]: unknown;
|
|
875
|
+
};
|
|
876
|
+
/** ContactCreate */
|
|
877
|
+
ContactCreate: {
|
|
878
|
+
/** Attributes */
|
|
879
|
+
attributes?: {
|
|
880
|
+
[key: string]: unknown;
|
|
881
|
+
};
|
|
882
|
+
/** Default Country */
|
|
883
|
+
default_country?: string | null;
|
|
884
|
+
/** Email */
|
|
885
|
+
email?: string | null;
|
|
886
|
+
/** First Name */
|
|
887
|
+
first_name?: string | null;
|
|
888
|
+
/** Last Name */
|
|
889
|
+
last_name?: string | null;
|
|
890
|
+
/** List Ids */
|
|
891
|
+
list_ids?: string[];
|
|
892
|
+
/** Phone */
|
|
893
|
+
phone: string;
|
|
894
|
+
/** Timezone */
|
|
895
|
+
timezone?: string | null;
|
|
896
|
+
};
|
|
897
|
+
/** ContactCsvInspectRequest */
|
|
898
|
+
ContactCsvInspectRequest: {
|
|
899
|
+
/** Csv */
|
|
900
|
+
csv: string;
|
|
901
|
+
};
|
|
902
|
+
/** ContactImportCreate */
|
|
903
|
+
ContactImportCreate: {
|
|
904
|
+
/** Attribute Columns */
|
|
905
|
+
attribute_columns?: string[] | null;
|
|
906
|
+
/** Csv */
|
|
907
|
+
csv: string;
|
|
908
|
+
/** Default Country */
|
|
909
|
+
default_country?: string | null;
|
|
910
|
+
/**
|
|
911
|
+
* Dry Run
|
|
912
|
+
* @default false
|
|
913
|
+
*/
|
|
914
|
+
dry_run?: boolean;
|
|
915
|
+
/** Filename */
|
|
916
|
+
filename?: string | null;
|
|
917
|
+
/** List Id */
|
|
918
|
+
list_id?: string | null;
|
|
919
|
+
/** Mapping */
|
|
920
|
+
mapping?: {
|
|
921
|
+
[key: string]: string;
|
|
922
|
+
} | null;
|
|
923
|
+
/**
|
|
924
|
+
* On Duplicate
|
|
925
|
+
* @default update
|
|
926
|
+
*/
|
|
927
|
+
on_duplicate?: string;
|
|
928
|
+
};
|
|
929
|
+
/** ContactListCreate */
|
|
930
|
+
ContactListCreate: {
|
|
931
|
+
/** Description */
|
|
932
|
+
description?: string | null;
|
|
933
|
+
/** Name */
|
|
934
|
+
name: string;
|
|
935
|
+
};
|
|
936
|
+
/** ContactListMembersAdd */
|
|
937
|
+
ContactListMembersAdd: {
|
|
938
|
+
/** Contact Ids */
|
|
939
|
+
contact_ids: string[];
|
|
940
|
+
};
|
|
941
|
+
/** ContactListUpdate */
|
|
942
|
+
ContactListUpdate: {
|
|
943
|
+
/** Description */
|
|
944
|
+
description?: string | null;
|
|
945
|
+
/** Name */
|
|
946
|
+
name?: string | null;
|
|
947
|
+
};
|
|
948
|
+
/** ContactUpdate */
|
|
949
|
+
ContactUpdate: {
|
|
950
|
+
/** Attributes */
|
|
951
|
+
attributes?: {
|
|
952
|
+
[key: string]: unknown;
|
|
953
|
+
} | null;
|
|
954
|
+
/** Default Country */
|
|
955
|
+
default_country?: string | null;
|
|
956
|
+
/** Email */
|
|
957
|
+
email?: string | null;
|
|
958
|
+
/** First Name */
|
|
959
|
+
first_name?: string | null;
|
|
960
|
+
/** Last Name */
|
|
961
|
+
last_name?: string | null;
|
|
962
|
+
/** Phone */
|
|
963
|
+
phone?: string | null;
|
|
964
|
+
/** Timezone */
|
|
965
|
+
timezone?: string | null;
|
|
966
|
+
};
|
|
659
967
|
/** ConversationNode */
|
|
660
968
|
ConversationNode: {
|
|
661
969
|
/** Allow Dtmf Interruption */
|
|
@@ -850,7 +1158,7 @@ interface components {
|
|
|
850
1158
|
/** Model Temperature */
|
|
851
1159
|
model_temperature?: number | null;
|
|
852
1160
|
/** Nodes */
|
|
853
|
-
nodes?: (components["schemas"]["ConversationNode"] | components["schemas"]["SubagentNode"] | components["schemas"]["FunctionNode"] | components["schemas"]["McpNode"] | components["schemas"]["BranchNode"] | components["schemas"]["ExtractDynamicVariablesNode"] | components["schemas"]["TransferCallNode"] | components["schemas"]["PressDigitNode"] | components["schemas"]["AgentSwapNode"] | components["schemas"]["SmsNode"] | components["schemas"]["EndNode"] | components["schemas"]["OpaqueNode"])[];
|
|
1161
|
+
nodes?: (components["schemas"]["ConversationNode"] | components["schemas"]["SubagentNode"] | components["schemas"]["FunctionNode"] | components["schemas"]["McpNode"] | components["schemas"]["CodeNode"] | components["schemas"]["BranchNode"] | components["schemas"]["ExtractDynamicVariablesNode"] | components["schemas"]["TransferCallNode"] | components["schemas"]["PressDigitNode"] | components["schemas"]["AgentSwapNode"] | components["schemas"]["SmsNode"] | components["schemas"]["EndNode"] | components["schemas"]["OpaqueNode"])[];
|
|
854
1162
|
/** Notes */
|
|
855
1163
|
notes?: unknown[] | null;
|
|
856
1164
|
/** Start Node Id */
|
|
@@ -866,6 +1174,17 @@ interface components {
|
|
|
866
1174
|
} & {
|
|
867
1175
|
[key: string]: unknown;
|
|
868
1176
|
};
|
|
1177
|
+
/** FlowCreate */
|
|
1178
|
+
FlowCreate: {
|
|
1179
|
+
flow_config: components["schemas"]["FlowConfig"];
|
|
1180
|
+
/**
|
|
1181
|
+
* Language
|
|
1182
|
+
* @default en
|
|
1183
|
+
*/
|
|
1184
|
+
language?: string;
|
|
1185
|
+
/** Name */
|
|
1186
|
+
name: string;
|
|
1187
|
+
};
|
|
869
1188
|
/** FlowTool */
|
|
870
1189
|
FlowTool: {
|
|
871
1190
|
/** Description */
|
|
@@ -897,6 +1216,14 @@ interface components {
|
|
|
897
1216
|
} & {
|
|
898
1217
|
[key: string]: unknown;
|
|
899
1218
|
};
|
|
1219
|
+
/** FlowUpdate */
|
|
1220
|
+
FlowUpdate: {
|
|
1221
|
+
flow_config?: components["schemas"]["FlowConfig"] | null;
|
|
1222
|
+
/** Language */
|
|
1223
|
+
language?: string | null;
|
|
1224
|
+
/** Name */
|
|
1225
|
+
name?: string | null;
|
|
1226
|
+
};
|
|
900
1227
|
/** FunctionCreate */
|
|
901
1228
|
FunctionCreate: {
|
|
902
1229
|
/**
|
|
@@ -920,7 +1247,7 @@ interface components {
|
|
|
920
1247
|
* @default custom
|
|
921
1248
|
* @enum {string}
|
|
922
1249
|
*/
|
|
923
|
-
kind?: "custom" | "end_call" | "transfer_call" | "press_digit" | "agent_swap" | "check_availability_cal" | "book_appointment_cal";
|
|
1250
|
+
kind?: "custom" | "end_call" | "transfer_call" | "press_digit" | "agent_swap" | "check_availability_cal" | "book_appointment_cal" | "cancel_appointment_cal" | "reschedule_appointment_cal" | "check_availability_gcal" | "book_appointment_gcal";
|
|
924
1251
|
/**
|
|
925
1252
|
* Method
|
|
926
1253
|
* @default POST
|
|
@@ -981,7 +1308,7 @@ interface components {
|
|
|
981
1308
|
* @default custom
|
|
982
1309
|
* @enum {string}
|
|
983
1310
|
*/
|
|
984
|
-
kind?: "custom" | "check_availability_cal" | "book_appointment_cal" | "end_call" | "transfer_call" | "press_digit" | "agent_swap";
|
|
1311
|
+
kind?: "custom" | "check_availability_cal" | "book_appointment_cal" | "cancel_appointment_cal" | "reschedule_appointment_cal" | "check_availability_gcal" | "book_appointment_gcal" | "end_call" | "transfer_call" | "press_digit" | "agent_swap";
|
|
985
1312
|
/**
|
|
986
1313
|
* Method
|
|
987
1314
|
* @default POST
|
|
@@ -1158,6 +1485,56 @@ interface components {
|
|
|
1158
1485
|
/** Value */
|
|
1159
1486
|
value: string;
|
|
1160
1487
|
};
|
|
1488
|
+
/** LLMCreate */
|
|
1489
|
+
LLMCreate: {
|
|
1490
|
+
/** Default Dynamic Variables */
|
|
1491
|
+
default_dynamic_variables?: {
|
|
1492
|
+
[key: string]: string;
|
|
1493
|
+
} | null;
|
|
1494
|
+
/** Fallback Llm Model */
|
|
1495
|
+
fallback_llm_model?: string | null;
|
|
1496
|
+
/** Fallback Llm Provider */
|
|
1497
|
+
fallback_llm_provider?: ("anthropic" | "openai") | null;
|
|
1498
|
+
/** First Message */
|
|
1499
|
+
first_message?: string | null;
|
|
1500
|
+
/** Llm Model */
|
|
1501
|
+
llm_model?: string | null;
|
|
1502
|
+
/** Llm Provider */
|
|
1503
|
+
llm_provider?: ("anthropic" | "openai") | null;
|
|
1504
|
+
/** Max Tokens */
|
|
1505
|
+
max_tokens?: number | null;
|
|
1506
|
+
/** Name */
|
|
1507
|
+
name: string;
|
|
1508
|
+
/** System Prompt */
|
|
1509
|
+
system_prompt?: string | null;
|
|
1510
|
+
/** Temperature */
|
|
1511
|
+
temperature?: number | null;
|
|
1512
|
+
};
|
|
1513
|
+
/** LLMUpdate */
|
|
1514
|
+
LLMUpdate: {
|
|
1515
|
+
/** Default Dynamic Variables */
|
|
1516
|
+
default_dynamic_variables?: {
|
|
1517
|
+
[key: string]: string;
|
|
1518
|
+
} | null;
|
|
1519
|
+
/** Fallback Llm Model */
|
|
1520
|
+
fallback_llm_model?: string | null;
|
|
1521
|
+
/** Fallback Llm Provider */
|
|
1522
|
+
fallback_llm_provider?: ("anthropic" | "openai") | null;
|
|
1523
|
+
/** First Message */
|
|
1524
|
+
first_message?: string | null;
|
|
1525
|
+
/** Llm Model */
|
|
1526
|
+
llm_model?: string | null;
|
|
1527
|
+
/** Llm Provider */
|
|
1528
|
+
llm_provider?: ("anthropic" | "openai") | null;
|
|
1529
|
+
/** Max Tokens */
|
|
1530
|
+
max_tokens?: number | null;
|
|
1531
|
+
/** Name */
|
|
1532
|
+
name?: string | null;
|
|
1533
|
+
/** System Prompt */
|
|
1534
|
+
system_prompt?: string | null;
|
|
1535
|
+
/** Temperature */
|
|
1536
|
+
temperature?: number | null;
|
|
1537
|
+
};
|
|
1161
1538
|
/** McpNode */
|
|
1162
1539
|
McpNode: {
|
|
1163
1540
|
display_position?: components["schemas"]["DisplayPosition"] | null;
|
|
@@ -1318,6 +1695,8 @@ interface components {
|
|
|
1318
1695
|
inbound_agent_version?: number | "latest_published";
|
|
1319
1696
|
/** Inbound Agents */
|
|
1320
1697
|
inbound_agents?: components["schemas"]["AgentWeightIn"][] | null;
|
|
1698
|
+
/** Inbound Webhook Url */
|
|
1699
|
+
inbound_webhook_url?: string | null;
|
|
1321
1700
|
/** Nickname */
|
|
1322
1701
|
nickname?: string | null;
|
|
1323
1702
|
/** Number */
|
|
@@ -1359,6 +1738,8 @@ interface components {
|
|
|
1359
1738
|
inbound_agent_version?: number | "latest_published" | null;
|
|
1360
1739
|
/** Inbound Agents */
|
|
1361
1740
|
inbound_agents?: components["schemas"]["AgentWeightIn"][] | null;
|
|
1741
|
+
/** Inbound Webhook Url */
|
|
1742
|
+
inbound_webhook_url?: string | null;
|
|
1362
1743
|
/** Nickname */
|
|
1363
1744
|
nickname?: string | null;
|
|
1364
1745
|
/** Outbound Agent Id */
|
|
@@ -1529,13 +1910,20 @@ interface components {
|
|
|
1529
1910
|
};
|
|
1530
1911
|
/** PronunciationEntry */
|
|
1531
1912
|
PronunciationEntry: {
|
|
1532
|
-
/**
|
|
1533
|
-
|
|
1913
|
+
/**
|
|
1914
|
+
* Alias
|
|
1915
|
+
* @default
|
|
1916
|
+
*/
|
|
1917
|
+
alias?: string;
|
|
1918
|
+
/** Alphabet */
|
|
1919
|
+
alphabet?: ("ipa" | "cmu") | null;
|
|
1534
1920
|
/**
|
|
1535
1921
|
* Case Sensitive
|
|
1536
1922
|
* @default false
|
|
1537
1923
|
*/
|
|
1538
1924
|
case_sensitive?: boolean;
|
|
1925
|
+
/** Phoneme */
|
|
1926
|
+
phoneme?: string | null;
|
|
1539
1927
|
/** Word */
|
|
1540
1928
|
word: string;
|
|
1541
1929
|
};
|
|
@@ -1577,6 +1965,40 @@ interface components {
|
|
|
1577
1965
|
/** Stream Url */
|
|
1578
1966
|
stream_url: string;
|
|
1579
1967
|
};
|
|
1968
|
+
/** RunCreate */
|
|
1969
|
+
RunCreate: {
|
|
1970
|
+
/**
|
|
1971
|
+
* Agent Version
|
|
1972
|
+
* @default 0
|
|
1973
|
+
*/
|
|
1974
|
+
agent_version?: unknown;
|
|
1975
|
+
/**
|
|
1976
|
+
* Fresh
|
|
1977
|
+
* @default false
|
|
1978
|
+
*/
|
|
1979
|
+
fresh?: boolean;
|
|
1980
|
+
/** Max Model Turns */
|
|
1981
|
+
max_model_turns?: number | null;
|
|
1982
|
+
};
|
|
1983
|
+
/** SessionSay */
|
|
1984
|
+
SessionSay: {
|
|
1985
|
+
/**
|
|
1986
|
+
* Interrupt
|
|
1987
|
+
* @default false
|
|
1988
|
+
*/
|
|
1989
|
+
interrupt?: boolean;
|
|
1990
|
+
/** Text */
|
|
1991
|
+
text: string;
|
|
1992
|
+
};
|
|
1993
|
+
/** SessionUpdate */
|
|
1994
|
+
SessionUpdate: {
|
|
1995
|
+
/** Dynamic Variables */
|
|
1996
|
+
dynamic_variables?: {
|
|
1997
|
+
[key: string]: unknown;
|
|
1998
|
+
} | null;
|
|
1999
|
+
/** System Prompt */
|
|
2000
|
+
system_prompt?: string | null;
|
|
2001
|
+
};
|
|
1580
2002
|
/** SipOutboundTrunkConfigIn */
|
|
1581
2003
|
SipOutboundTrunkConfigIn: {
|
|
1582
2004
|
/** Auth Password */
|
|
@@ -1676,6 +2098,29 @@ interface components {
|
|
|
1676
2098
|
} & {
|
|
1677
2099
|
[key: string]: unknown;
|
|
1678
2100
|
};
|
|
2101
|
+
/** SuiteCreate */
|
|
2102
|
+
SuiteCreate: {
|
|
2103
|
+
/** Agent Id */
|
|
2104
|
+
agent_id: string;
|
|
2105
|
+
/** Description */
|
|
2106
|
+
description?: string | null;
|
|
2107
|
+
/** Name */
|
|
2108
|
+
name: string;
|
|
2109
|
+
/**
|
|
2110
|
+
* Publish Gate
|
|
2111
|
+
* @default off
|
|
2112
|
+
*/
|
|
2113
|
+
publish_gate?: string;
|
|
2114
|
+
};
|
|
2115
|
+
/** SuiteUpdate */
|
|
2116
|
+
SuiteUpdate: {
|
|
2117
|
+
/** Description */
|
|
2118
|
+
description?: string | null;
|
|
2119
|
+
/** Name */
|
|
2120
|
+
name?: string | null;
|
|
2121
|
+
/** Publish Gate */
|
|
2122
|
+
publish_gate?: string | null;
|
|
2123
|
+
};
|
|
1679
2124
|
/** TransferAgent */
|
|
1680
2125
|
TransferAgent: {
|
|
1681
2126
|
/** Agent Id */
|
|
@@ -1758,7 +2203,7 @@ interface components {
|
|
|
1758
2203
|
/** Digit Limit */
|
|
1759
2204
|
digit_limit?: number | null;
|
|
1760
2205
|
/** Termination Key */
|
|
1761
|
-
termination_key?: ("#" | "*") | null;
|
|
2206
|
+
termination_key?: ("0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "#" | "*") | null;
|
|
1762
2207
|
/**
|
|
1763
2208
|
* Timeout Ms
|
|
1764
2209
|
* @default 2500
|
|
@@ -1778,6 +2223,29 @@ interface components {
|
|
|
1778
2223
|
/** Error Type */
|
|
1779
2224
|
type: string;
|
|
1780
2225
|
};
|
|
2226
|
+
/** WebCallRequest */
|
|
2227
|
+
WebCallRequest: {
|
|
2228
|
+
/** Agent Id */
|
|
2229
|
+
agent_id: string;
|
|
2230
|
+
/**
|
|
2231
|
+
* Agent Version
|
|
2232
|
+
* @default 0
|
|
2233
|
+
*/
|
|
2234
|
+
agent_version?: number | "latest_published";
|
|
2235
|
+
/** Dialgem Llm Dynamic Variables */
|
|
2236
|
+
dialgem_llm_dynamic_variables?: {
|
|
2237
|
+
[key: string]: unknown;
|
|
2238
|
+
} | null;
|
|
2239
|
+
/** Metadata */
|
|
2240
|
+
metadata?: {
|
|
2241
|
+
[key: string]: unknown;
|
|
2242
|
+
} | null;
|
|
2243
|
+
};
|
|
2244
|
+
/** WebCallSettings */
|
|
2245
|
+
WebCallSettings: {
|
|
2246
|
+
/** Allowed Origins */
|
|
2247
|
+
allowed_origins: string[];
|
|
2248
|
+
};
|
|
1781
2249
|
};
|
|
1782
2250
|
responses: never;
|
|
1783
2251
|
parameters: never;
|
|
@@ -1792,7 +2260,7 @@ interface components {
|
|
|
1792
2260
|
* (snake_case); the SDK sends bodies as-is.
|
|
1793
2261
|
*/
|
|
1794
2262
|
|
|
1795
|
-
type Schemas = components["schemas"];
|
|
2263
|
+
type Schemas$5 = components["schemas"];
|
|
1796
2264
|
/**
|
|
1797
2265
|
* Adds `| undefined` to the optional top-level fields of a request body, so
|
|
1798
2266
|
* callers compiling with `exactOptionalPropertyTypes` can write
|
|
@@ -1802,34 +2270,36 @@ type Schemas = components["schemas"];
|
|
|
1802
2270
|
type RequestBody<T> = {
|
|
1803
2271
|
[K in keyof T]: {} extends Pick<T, K> ? T[K] | undefined : T[K];
|
|
1804
2272
|
};
|
|
1805
|
-
type AgentCreateParams = RequestBody<Schemas["AgentCreate"]>;
|
|
1806
|
-
type AgentUpdateParams = RequestBody<Schemas["AgentUpdate"]>;
|
|
1807
|
-
type FunctionCreateParams = RequestBody<Schemas["FunctionCreate"]>;
|
|
1808
|
-
type FunctionUpdateParams = RequestBody<Schemas["FunctionUpdate"]>;
|
|
1809
|
-
type FunctionReorderParams = RequestBody<Schemas["FunctionReorder"]>;
|
|
1810
|
-
type KnowledgeDocumentCreateParams = RequestBody<Schemas["DocumentCreate"]>;
|
|
1811
|
-
type MCPServerCreateParams = RequestBody<Schemas["MCPServerCreate"]>;
|
|
1812
|
-
type MCPServerUpdateParams = RequestBody<Schemas["MCPServerUpdate"]>;
|
|
1813
|
-
type PhoneNumberCreateParams = RequestBody<Schemas["PhoneNumberCreate"]>;
|
|
1814
|
-
type PhoneNumberUpdateParams = RequestBody<Schemas["PhoneNumberUpdate"]>;
|
|
1815
|
-
type PhoneNumberAssignParams = RequestBody<Schemas["PhoneNumberAssign"]>;
|
|
2273
|
+
type AgentCreateParams = RequestBody<Schemas$5["AgentCreate"]>;
|
|
2274
|
+
type AgentUpdateParams = RequestBody<Schemas$5["AgentUpdate"]>;
|
|
2275
|
+
type FunctionCreateParams = RequestBody<Schemas$5["FunctionCreate"]>;
|
|
2276
|
+
type FunctionUpdateParams = RequestBody<Schemas$5["FunctionUpdate"]>;
|
|
2277
|
+
type FunctionReorderParams = RequestBody<Schemas$5["FunctionReorder"]>;
|
|
2278
|
+
type KnowledgeDocumentCreateParams = RequestBody<Schemas$5["DocumentCreate"]>;
|
|
2279
|
+
type MCPServerCreateParams = RequestBody<Schemas$5["MCPServerCreate"]>;
|
|
2280
|
+
type MCPServerUpdateParams = RequestBody<Schemas$5["MCPServerUpdate"]>;
|
|
2281
|
+
type PhoneNumberCreateParams = RequestBody<Schemas$5["PhoneNumberCreate"]>;
|
|
2282
|
+
type PhoneNumberUpdateParams = RequestBody<Schemas$5["PhoneNumberUpdate"]>;
|
|
2283
|
+
type PhoneNumberAssignParams = RequestBody<Schemas$5["PhoneNumberAssign"]>;
|
|
1816
2284
|
/**
|
|
1817
2285
|
* `from_`, with the trailing underscore, is the wire name (`from` is a Python
|
|
1818
2286
|
* keyword on the server). It must be a number registered on your organization.
|
|
1819
2287
|
*/
|
|
1820
|
-
type CallCreatePhoneCallParams = RequestBody<Schemas["OutboundCallRequest"]>;
|
|
1821
|
-
type CallRegisterParams = RequestBody<Schemas["RegisterCallRequest"]>;
|
|
2288
|
+
type CallCreatePhoneCallParams = RequestBody<Schemas$5["OutboundCallRequest"]>;
|
|
2289
|
+
type CallRegisterParams = RequestBody<Schemas$5["RegisterCallRequest"]>;
|
|
1822
2290
|
/** A conversation-flow definition (`agent_type: "flow"`). */
|
|
1823
|
-
type FlowConfig = Schemas["FlowConfig"];
|
|
2291
|
+
type FlowConfig = Schemas$5["FlowConfig"];
|
|
1824
2292
|
/** One state of a `multi_prompt` agent. */
|
|
1825
|
-
type PromptState = Schemas["PromptState"];
|
|
2293
|
+
type PromptState = Schemas$5["PromptState"];
|
|
1826
2294
|
/** A field extracted from the transcript after the call ends. */
|
|
1827
|
-
type PostCallAnalysisVariable = Schemas["PostCallAnalysisVariable"];
|
|
1828
|
-
|
|
1829
|
-
type
|
|
1830
|
-
type
|
|
1831
|
-
type
|
|
1832
|
-
type
|
|
2295
|
+
type PostCallAnalysisVariable = Schemas$5["PostCallAnalysisVariable"];
|
|
2296
|
+
/** Settings for `call_summary`, `call_successful` and `user_sentiment`. */
|
|
2297
|
+
type PostCallBuiltinFields = Schemas$5["BuiltinAnalysisFields"];
|
|
2298
|
+
type KeyValuePair = Schemas$5["KVPair"];
|
|
2299
|
+
type AgentWeight = Schemas$5["AgentWeightIn"];
|
|
2300
|
+
type AgentType = NonNullable<Schemas$5["AgentCreate"]["agent_type"]>;
|
|
2301
|
+
type WebhookEventType = NonNullable<Schemas$5["AgentCreate"]["webhook_events"]>[number];
|
|
2302
|
+
type FunctionKind = NonNullable<Schemas$5["FunctionCreate"]["kind"]>;
|
|
1833
2303
|
|
|
1834
2304
|
/**
|
|
1835
2305
|
* An agent, as returned by `GET /v1/agents/{id}` and the create/update calls.
|
|
@@ -1857,6 +2327,11 @@ interface Agent {
|
|
|
1857
2327
|
/** Fallback values for `{{variables}}` not supplied by the call. */
|
|
1858
2328
|
default_dynamic_variables: Record<string, string>;
|
|
1859
2329
|
responsiveness: number;
|
|
2330
|
+
/**
|
|
2331
|
+
* Wait a little longer (up to 1.5 s) when the caller sounds unfinished: a
|
|
2332
|
+
* trailing "and", a comma, a half-read number. Off by default.
|
|
2333
|
+
*/
|
|
2334
|
+
adaptive_response_wait: boolean;
|
|
1860
2335
|
interruption_sensitivity: number;
|
|
1861
2336
|
enable_backchannel: boolean;
|
|
1862
2337
|
backchannel_frequency: number;
|
|
@@ -1870,7 +2345,22 @@ interface Agent {
|
|
|
1870
2345
|
language: string;
|
|
1871
2346
|
enable_transcription_formatting: boolean;
|
|
1872
2347
|
boosted_keywords: string[];
|
|
2348
|
+
/**
|
|
2349
|
+
* `noise-and-background-speech-cancellation` is a stronger setting of the same
|
|
2350
|
+
* stationary-noise filter, scaled by `denoising_strength`; it does not isolate
|
|
2351
|
+
* the caller from other voices.
|
|
2352
|
+
*/
|
|
1873
2353
|
denoising_mode: NonNullable<AgentCreateParams["denoising_mode"]>;
|
|
2354
|
+
/** 0-1. Only read by `noise-and-background-speech-cancellation`. */
|
|
2355
|
+
denoising_strength: number;
|
|
2356
|
+
/**
|
|
2357
|
+
* `fast` uses Deepgram; `accurate` uses AssemblyAI when the server has it
|
|
2358
|
+
* configured (English only) and falls back to Deepgram otherwise. Only
|
|
2359
|
+
* applies when `stt_model` is `deepgram`.
|
|
2360
|
+
*/
|
|
2361
|
+
stt_mode: NonNullable<AgentCreateParams["stt_mode"]>;
|
|
2362
|
+
/** `medical` uses Deepgram's medical model (English only), in either `stt_mode`. */
|
|
2363
|
+
vocab_specialization: NonNullable<AgentCreateParams["vocab_specialization"]>;
|
|
1874
2364
|
begin_message_delay_ms: number;
|
|
1875
2365
|
end_call_after_silence_ms: number;
|
|
1876
2366
|
max_call_duration_ms: number;
|
|
@@ -1878,8 +2368,27 @@ interface Agent {
|
|
|
1878
2368
|
voicemail_detection_enabled: boolean;
|
|
1879
2369
|
voicemail_action: NonNullable<AgentCreateParams["voicemail_action"]>;
|
|
1880
2370
|
voicemail_message: string;
|
|
2371
|
+
/** When set, the voicemail is written by the LLM from this instruction (outbound calls). */
|
|
2372
|
+
voicemail_prompt: string;
|
|
2373
|
+
/** Hang up when an automated phone menu is detected (outbound calls). */
|
|
2374
|
+
ivr_hangup_enabled: boolean;
|
|
2375
|
+
/** How the agent should handle a menu when `ivr_hangup_enabled` is off. */
|
|
2376
|
+
ivr_prompt: string;
|
|
2377
|
+
/** Say `call_screen_message` once to a phone's call-screening assistant (outbound calls). */
|
|
2378
|
+
call_screen_handling_enabled: boolean;
|
|
2379
|
+
call_screen_message: string;
|
|
2380
|
+
/**
|
|
2381
|
+
* Offer the agent a do-not-call tool: a contact who asks to stop being called is
|
|
2382
|
+
* added to the organization's do-not-call list and the call ends.
|
|
2383
|
+
*/
|
|
2384
|
+
dnc_detection_enabled: boolean;
|
|
1881
2385
|
post_call_analysis_data: PostCallAnalysisVariable[];
|
|
1882
2386
|
post_call_analysis_model: string;
|
|
2387
|
+
/**
|
|
2388
|
+
* Settings for the always-on analysis fields. A missing key means defaults;
|
|
2389
|
+
* `{ enabled: false }` stops that field being extracted (it is stored null).
|
|
2390
|
+
*/
|
|
2391
|
+
post_call_builtin_fields: PostCallBuiltinFields;
|
|
1883
2392
|
fallback_llm_provider: string | null;
|
|
1884
2393
|
fallback_llm_model: string | null;
|
|
1885
2394
|
fallback_voice_id: string | null;
|
|
@@ -1895,6 +2404,8 @@ interface Agent {
|
|
|
1895
2404
|
*/
|
|
1896
2405
|
webhook_signing_secret: string | null;
|
|
1897
2406
|
has_webhook_signing_secret: boolean;
|
|
2407
|
+
/** How long, in ms, a receiver gets to answer one delivery attempt. 1000–30000, default 10000. */
|
|
2408
|
+
webhook_timeout_ms: number;
|
|
1898
2409
|
/** ISO 8601, no timezone suffix (UTC). */
|
|
1899
2410
|
created_at: string | null;
|
|
1900
2411
|
call_count: number;
|
|
@@ -1969,6 +2480,18 @@ interface MCPServer {
|
|
|
1969
2480
|
last_status: MCPServerTestResult | null;
|
|
1970
2481
|
created_at: string | null;
|
|
1971
2482
|
}
|
|
2483
|
+
/** One tool an MCP server offers. */
|
|
2484
|
+
interface MCPTool {
|
|
2485
|
+
name: string;
|
|
2486
|
+
description: string;
|
|
2487
|
+
/** JSON Schema for the tool's arguments. */
|
|
2488
|
+
input_schema: Record<string, unknown>;
|
|
2489
|
+
}
|
|
2490
|
+
/** What `mcpServers.listTools` returns. When the server is unreachable `tools` is empty and `error` says why. */
|
|
2491
|
+
interface MCPToolList {
|
|
2492
|
+
tools: MCPTool[];
|
|
2493
|
+
error: string | null;
|
|
2494
|
+
}
|
|
1972
2495
|
interface MCPServerTestResult {
|
|
1973
2496
|
ok: boolean;
|
|
1974
2497
|
/** Tool names the server advertised. */
|
|
@@ -2116,6 +2639,11 @@ declare class AgentMCPServers extends APIResource {
|
|
|
2116
2639
|
update(agentId: string, serverId: string, body: MCPServerUpdateParams, options?: RequestOptions): Promise<MCPServer>;
|
|
2117
2640
|
delete(agentId: string, serverId: string, options?: RequestOptions): Promise<void>;
|
|
2118
2641
|
/** Connect to the server now, list its tools, and store the result as `last_status`. */
|
|
2642
|
+
/**
|
|
2643
|
+
* What the server offers right now, with each tool's description and argument schema. Connects live like
|
|
2644
|
+
* `test`, but stores nothing. An unreachable server is not an error: `tools` is empty and `error` says why.
|
|
2645
|
+
*/
|
|
2646
|
+
listTools(agentId: string, serverId: string, options?: RequestOptions): Promise<MCPToolList>;
|
|
2119
2647
|
test(agentId: string, serverId: string, options?: RequestOptions): Promise<MCPServerTestResult>;
|
|
2120
2648
|
}
|
|
2121
2649
|
|
|
@@ -2333,6 +2861,18 @@ declare class Calls extends APIResource {
|
|
|
2333
2861
|
* recording. A call still in progress is refused with `ConflictError`; stop it first.
|
|
2334
2862
|
*/
|
|
2335
2863
|
delete(callId: string, options?: RequestOptions): Promise<CallDeleteResponse>;
|
|
2864
|
+
/**
|
|
2865
|
+
* Run a finished call's post-call analysis again, with the agent's *current* analysis
|
|
2866
|
+
* settings, and return the updated call. Use it after changing the fields or the model
|
|
2867
|
+
* and wanting an older call read the new way.
|
|
2868
|
+
*
|
|
2869
|
+
* It replaces `analysis`; it does not bill the call again and does not send `call_analyzed`
|
|
2870
|
+
* again, so read the result from this response or from `retrieve`. The model call can take
|
|
2871
|
+
* a while. `ConflictError` with `errCode` `call_in_progress` until the call has ended,
|
|
2872
|
+
* `no_transcript` when there is nothing to analyze, `agent_deleted` if the agent is gone.
|
|
2873
|
+
* Not retried by default.
|
|
2874
|
+
*/
|
|
2875
|
+
rerunAnalysis(callId: string, options?: RequestOptions): Promise<Call>;
|
|
2336
2876
|
/**
|
|
2337
2877
|
* End an ongoing call now, as if the agent had hung up. The call becomes
|
|
2338
2878
|
* `completed` with `disconnection_reason: "manual_stopped"` a moment later, and
|
|
@@ -2381,6 +2921,23 @@ interface Voice {
|
|
|
2381
2921
|
created_at: string | null;
|
|
2382
2922
|
updated_at: string | null;
|
|
2383
2923
|
}
|
|
2924
|
+
/** A model usable for an agent's post-call analysis (`post_call_analysis_model`). */
|
|
2925
|
+
interface ExtractionModel {
|
|
2926
|
+
/** Put this in `post_call_analysis_model`. */
|
|
2927
|
+
id: string;
|
|
2928
|
+
provider: "anthropic" | "openai";
|
|
2929
|
+
label: string;
|
|
2930
|
+
/**
|
|
2931
|
+
* Estimated USD for one typical extraction, derived from list prices. For
|
|
2932
|
+
* comparing models; not a metered charge.
|
|
2933
|
+
*/
|
|
2934
|
+
est_cost_per_session: number;
|
|
2935
|
+
}
|
|
2936
|
+
interface ExtractionModelList {
|
|
2937
|
+
/** The model an agent gets when none is set. */
|
|
2938
|
+
default: string;
|
|
2939
|
+
models: ExtractionModel[];
|
|
2940
|
+
}
|
|
2384
2941
|
/** One audio sample for cloning. `Blob` and `File` both satisfy this. */
|
|
2385
2942
|
type VoiceCloneFile = Blob | {
|
|
2386
2943
|
name?: string;
|
|
@@ -2496,6 +3053,10 @@ declare class Voices extends APIResource {
|
|
|
2496
3053
|
*/
|
|
2497
3054
|
delete(voiceId: string, options?: RequestOptions): Promise<VoiceDeleteResponse>;
|
|
2498
3055
|
}
|
|
3056
|
+
declare class ExtractionModels extends APIResource {
|
|
3057
|
+
/** Models an agent may use for post-call analysis, with an estimated cost per session. */
|
|
3058
|
+
list(options?: RequestOptions): Promise<ExtractionModelList>;
|
|
3059
|
+
}
|
|
2499
3060
|
declare class FlowTemplates extends APIResource {
|
|
2500
3061
|
/** Built-in conversation-flow templates (summaries, without `flow_config`). */
|
|
2501
3062
|
list(params?: TemplateListParams, options?: RequestOptions): Promise<FlowTemplateSummary[]>;
|
|
@@ -2507,6 +3068,667 @@ declare class PromptTemplates extends APIResource {
|
|
|
2507
3068
|
retrieve(templateId: string, options?: RequestOptions): Promise<PromptTemplate>;
|
|
2508
3069
|
}
|
|
2509
3070
|
|
|
3071
|
+
/** What an API key was granted. The secret is never returned. */
|
|
3072
|
+
interface ApiKeyDetails {
|
|
3073
|
+
id: string;
|
|
3074
|
+
name: string;
|
|
3075
|
+
/** The start of the key, to recognise it by. */
|
|
3076
|
+
prefix: string;
|
|
3077
|
+
/** True when the key has no scopes and can do everything. */
|
|
3078
|
+
full_access: boolean;
|
|
3079
|
+
/** For example `["calls:write", "agents:read"]`; `null` for a full-access key. */
|
|
3080
|
+
scopes: string[] | null;
|
|
3081
|
+
/** IP addresses or CIDR ranges the key may be used from; `null` for anywhere. */
|
|
3082
|
+
allowed_ips: string[] | null;
|
|
3083
|
+
expires_at: string | null;
|
|
3084
|
+
expired: boolean;
|
|
3085
|
+
last_used_at: string | null;
|
|
3086
|
+
created_at: string | null;
|
|
3087
|
+
revoked_at: string | null;
|
|
3088
|
+
}
|
|
3089
|
+
interface ApiKeyInfo {
|
|
3090
|
+
auth: "api_key" | "session" | "service" | (string & {});
|
|
3091
|
+
/** Your organization's slug. */
|
|
3092
|
+
organization: string;
|
|
3093
|
+
role: string;
|
|
3094
|
+
/** The key being used; `null` when the request was not made with an organization API key. */
|
|
3095
|
+
key: ApiKeyDetails | null;
|
|
3096
|
+
}
|
|
3097
|
+
|
|
3098
|
+
/**
|
|
3099
|
+
* A call in progress right now, as the service holds it in memory.
|
|
3100
|
+
*
|
|
3101
|
+
* This is live state, not a record: a finished call is a `Call`, reachable
|
|
3102
|
+
* through `calls.retrieve`. The shape of a session is not a stable contract
|
|
3103
|
+
* beyond the fields below, so it is deliberately open.
|
|
3104
|
+
*/
|
|
3105
|
+
interface AgentSession {
|
|
3106
|
+
session_id: string;
|
|
3107
|
+
agent_id: string;
|
|
3108
|
+
status: "active" | "ended" | (string & {});
|
|
3109
|
+
/** ISO 8601. */
|
|
3110
|
+
started_at?: string;
|
|
3111
|
+
[key: string]: unknown;
|
|
3112
|
+
}
|
|
3113
|
+
|
|
3114
|
+
type AgentSessionUpdateParams = RequestBody<components["schemas"]["SessionUpdate"]>;
|
|
3115
|
+
type AgentSessionSayParams = RequestBody<components["schemas"]["SessionSay"]>;
|
|
3116
|
+
/** What `sessions.say` returns: the line plays behind the call's audio, so this answers at once. */
|
|
3117
|
+
interface AgentSessionSayResult {
|
|
3118
|
+
status: "speaking";
|
|
3119
|
+
}
|
|
3120
|
+
/** What `sessions.release` returns. */
|
|
3121
|
+
interface AgentSessionReleaseResult {
|
|
3122
|
+
/** `not_taken_over` when nobody had the call. */
|
|
3123
|
+
status: "handed_back" | "not_taken_over";
|
|
3124
|
+
reason?: string;
|
|
3125
|
+
}
|
|
3126
|
+
/** What `sessions.update` returns. */
|
|
3127
|
+
interface AgentSessionUpdateResult {
|
|
3128
|
+
session_id: string;
|
|
3129
|
+
status: "active" | (string & {});
|
|
3130
|
+
/** Which of `system_prompt` and `dynamic_variables` were changed. */
|
|
3131
|
+
updated: Array<"system_prompt" | "dynamic_variables">;
|
|
3132
|
+
applies_from: "next_turn";
|
|
3133
|
+
}
|
|
3134
|
+
interface AgentSessionList {
|
|
3135
|
+
sessions: AgentSession[];
|
|
3136
|
+
/** How many are live. This is what "how busy am I right now?" asks for. */
|
|
3137
|
+
count: number;
|
|
3138
|
+
}
|
|
3139
|
+
|
|
3140
|
+
declare class ApiKey extends APIResource {
|
|
3141
|
+
/**
|
|
3142
|
+
* Who this key is: your organization and the key's name, prefix, scopes, allowed addresses
|
|
3143
|
+
* and expiry. It answers for any valid key whatever its scopes, so an integration can check
|
|
3144
|
+
* what it was given. Never returns the secret.
|
|
3145
|
+
*
|
|
3146
|
+
* ```ts
|
|
3147
|
+
* const { key } = await dialgem.apiKey.retrieve()
|
|
3148
|
+
* if (key && !key.full_access) console.log("scoped to", key.scopes)
|
|
3149
|
+
* ```
|
|
3150
|
+
*/
|
|
3151
|
+
retrieve(options?: RequestOptions): Promise<ApiKeyInfo>;
|
|
3152
|
+
}
|
|
3153
|
+
declare class Sessions extends APIResource {
|
|
3154
|
+
/**
|
|
3155
|
+
* The calls your organization has in progress right now, with a `count`.
|
|
3156
|
+
*
|
|
3157
|
+
* Live state read from the service's own registry — use it for a
|
|
3158
|
+
* concurrency check before placing a call. For finished calls use
|
|
3159
|
+
* `calls.list`; a call whose teardown never arrived is not counted here.
|
|
3160
|
+
*/
|
|
3161
|
+
list(options?: RequestOptions): Promise<AgentSessionList>;
|
|
3162
|
+
/**
|
|
3163
|
+
* Change a live call's prompt and/or variables. It applies from the agent's **next turn**.
|
|
3164
|
+
*
|
|
3165
|
+
* `sessionId` is a session's `session_id` from `list`, or the call's own `call_id`. Only this call changes:
|
|
3166
|
+
* the agent, its published versions and other calls are untouched, and the change is gone when the call ends.
|
|
3167
|
+
* A turn already being spoken finishes as it was. `dynamic_variables` are merged over the call's variables;
|
|
3168
|
+
* `system_prompt` replaces the prompt for the rest of the call.
|
|
3169
|
+
*
|
|
3170
|
+
* The call may be on any service instance. `NotFoundError` if it is not live (or is another organization's),
|
|
3171
|
+
* `ConflictError` with `errCode` `session_ended` once it is over, `UnprocessableEntityError` with `errCode`
|
|
3172
|
+
* `flow_agent_prompt` for a flow agent's prompt (its variables can still change). Not retried by default.
|
|
3173
|
+
*
|
|
3174
|
+
* ```ts
|
|
3175
|
+
* await dialgem.sessions.update(callId, { dynamic_variables: { plan: "pro" } })
|
|
3176
|
+
* ```
|
|
3177
|
+
*/
|
|
3178
|
+
update(sessionId: string, body: AgentSessionUpdateParams, options?: RequestOptions): Promise<AgentSessionUpdateResult>;
|
|
3179
|
+
/**
|
|
3180
|
+
* Make the agent say `text` on a live call, in its own voice. Answers at once; the line plays behind what the
|
|
3181
|
+
* agent is saying, or now with `interrupt: true`. The agent's conversation records it as something it said.
|
|
3182
|
+
*
|
|
3183
|
+
* Off unless the deployment enables live control: `ForbiddenError` with `errCode` `live_control_disabled`.
|
|
3184
|
+
* `ConflictError` `human_has_call` while a human has taken the call. Owners, admins and API keys only.
|
|
3185
|
+
* Not retried by default.
|
|
3186
|
+
*
|
|
3187
|
+
* ```ts
|
|
3188
|
+
* await dialgem.sessions.say(callId, { text: "One moment while I check that." })
|
|
3189
|
+
* ```
|
|
3190
|
+
*/
|
|
3191
|
+
say(sessionId: string, body: AgentSessionSayParams, options?: RequestOptions): Promise<AgentSessionSayResult>;
|
|
3192
|
+
/**
|
|
3193
|
+
* Hand a taken-over call back to the agent, for when the socket that took it is gone. The agent is told a
|
|
3194
|
+
* human had the call and that it did not hear what was said. Same availability and limits as `say`.
|
|
3195
|
+
* Listening in and taking over run over a WebSocket (`/v1/agent/sessions/{id}/live`), which this SDK does not wrap.
|
|
3196
|
+
*/
|
|
3197
|
+
release(sessionId: string, options?: RequestOptions): Promise<AgentSessionReleaseResult>;
|
|
3198
|
+
}
|
|
3199
|
+
|
|
3200
|
+
/**
|
|
3201
|
+
* Agent simulations: saved conversations that a simulated caller has with your agent, in text,
|
|
3202
|
+
* checked afterwards. Nothing is dialled, recorded or billed, and the agent's tools are never really called.
|
|
3203
|
+
*
|
|
3204
|
+
* The API accepts free-form objects for the caller, tool answers and checks, so they are typed here.
|
|
3205
|
+
*/
|
|
3206
|
+
/** What publishing a version of the agent does when the draft has not passed the suite. */
|
|
3207
|
+
type SimulationPublishGate = "off" | "warn" | "block";
|
|
3208
|
+
type SimulationCaller = {
|
|
3209
|
+
mode: "script";
|
|
3210
|
+
/** What the caller says, one line per turn (up to 20). */
|
|
3211
|
+
turns: string[];
|
|
3212
|
+
} | {
|
|
3213
|
+
mode: "persona";
|
|
3214
|
+
/** Who the caller is. A model plays them. */
|
|
3215
|
+
persona: string;
|
|
3216
|
+
/** What they want from the call. */
|
|
3217
|
+
goal?: string | undefined;
|
|
3218
|
+
/** Longest the conversation runs, in exchanges (1 to 12, default 6). */
|
|
3219
|
+
max_turns?: number | undefined;
|
|
3220
|
+
};
|
|
3221
|
+
interface CheckBase {
|
|
3222
|
+
/** Names the check in the results. */
|
|
3223
|
+
label?: string | undefined;
|
|
3224
|
+
}
|
|
3225
|
+
type SimulationCheck = (CheckBase & {
|
|
3226
|
+
type: "contains" | "not_contains";
|
|
3227
|
+
text: string;
|
|
3228
|
+
who?: "agent" | "caller" | "any" | undefined;
|
|
3229
|
+
}) | (CheckBase & {
|
|
3230
|
+
type: "tool_called";
|
|
3231
|
+
name: string;
|
|
3232
|
+
args?: Record<string, unknown> | undefined;
|
|
3233
|
+
}) | (CheckBase & {
|
|
3234
|
+
type: "tool_not_called";
|
|
3235
|
+
name: string;
|
|
3236
|
+
}) | (CheckBase & {
|
|
3237
|
+
type: "variable_equals";
|
|
3238
|
+
name: string;
|
|
3239
|
+
value: string;
|
|
3240
|
+
}) | (CheckBase & {
|
|
3241
|
+
type: "node_reached";
|
|
3242
|
+
node_id: string;
|
|
3243
|
+
}) | (CheckBase & {
|
|
3244
|
+
type: "ended";
|
|
3245
|
+
value?: boolean | undefined;
|
|
3246
|
+
}) | (CheckBase & {
|
|
3247
|
+
type: "rubric";
|
|
3248
|
+
criteria: string;
|
|
3249
|
+
});
|
|
3250
|
+
interface SimulationCaseInput {
|
|
3251
|
+
name: string;
|
|
3252
|
+
caller: SimulationCaller;
|
|
3253
|
+
/** Fills `{{placeholders}}` in the agent's prompt and first message. */
|
|
3254
|
+
dynamic_variables?: Record<string, string | number> | undefined;
|
|
3255
|
+
/** What each tool answers. A tool without an entry answers `{"status": "ok"}`. */
|
|
3256
|
+
tool_mocks?: Record<string, unknown> | undefined;
|
|
3257
|
+
/** At least one. The case passes when all of them hold. */
|
|
3258
|
+
checks: SimulationCheck[];
|
|
3259
|
+
}
|
|
3260
|
+
interface SimulationSuiteCreateParams {
|
|
3261
|
+
agent_id: string;
|
|
3262
|
+
name: string;
|
|
3263
|
+
description?: string | null | undefined;
|
|
3264
|
+
publish_gate?: SimulationPublishGate | undefined;
|
|
3265
|
+
}
|
|
3266
|
+
interface SimulationSuiteUpdateParams {
|
|
3267
|
+
name?: string | undefined;
|
|
3268
|
+
description?: string | null | undefined;
|
|
3269
|
+
publish_gate?: SimulationPublishGate | undefined;
|
|
3270
|
+
}
|
|
3271
|
+
interface SimulationRunCreateParams {
|
|
3272
|
+
/** `0` is the draft you are editing (the default), or a published version, or `"latest_published"`. */
|
|
3273
|
+
agent_version?: number | "latest_published" | undefined;
|
|
3274
|
+
/** Run every case again even if an identical one already ran against this exact agent. */
|
|
3275
|
+
fresh?: boolean | undefined;
|
|
3276
|
+
/** Spend at most this many model turns. When used up the remaining cases are skipped. */
|
|
3277
|
+
max_model_turns?: number | undefined;
|
|
3278
|
+
}
|
|
3279
|
+
interface SimulationCase extends Required<Pick<SimulationCaseInput, "name" | "caller" | "checks">> {
|
|
3280
|
+
id: string;
|
|
3281
|
+
suite_id: string;
|
|
3282
|
+
position: number;
|
|
3283
|
+
dynamic_variables: Record<string, string>;
|
|
3284
|
+
tool_mocks: Record<string, unknown>;
|
|
3285
|
+
created_at: string | null;
|
|
3286
|
+
updated_at: string | null;
|
|
3287
|
+
}
|
|
3288
|
+
type SimulationRunStatus = "queued" | "running" | "completed" | "cancelled" | "failed";
|
|
3289
|
+
interface SimulationRun {
|
|
3290
|
+
id: string;
|
|
3291
|
+
suite_id: string;
|
|
3292
|
+
agent_id: string;
|
|
3293
|
+
/** The version that was tested; `0` is the draft. */
|
|
3294
|
+
agent_version: number;
|
|
3295
|
+
status: SimulationRunStatus;
|
|
3296
|
+
trigger: string;
|
|
3297
|
+
fresh: boolean;
|
|
3298
|
+
total: number;
|
|
3299
|
+
passed: number;
|
|
3300
|
+
failed: number;
|
|
3301
|
+
/** The model or the case broke; this says nothing about your agent. */
|
|
3302
|
+
errored: number;
|
|
3303
|
+
/** Cancelled, or the run ran out of model turns. */
|
|
3304
|
+
skipped: number;
|
|
3305
|
+
model_turn_budget: number;
|
|
3306
|
+
model_turns_used: number;
|
|
3307
|
+
budget_exhausted: boolean;
|
|
3308
|
+
created_at: string | null;
|
|
3309
|
+
started_at: string | null;
|
|
3310
|
+
finished_at: string | null;
|
|
3311
|
+
}
|
|
3312
|
+
type SimulationResultStatus = "pending" | "passed" | "failed" | "errored" | "skipped";
|
|
3313
|
+
interface SimulationCheckResult {
|
|
3314
|
+
/** Position in the case's `checks`. */
|
|
3315
|
+
index: number;
|
|
3316
|
+
type: SimulationCheck["type"];
|
|
3317
|
+
label?: string | undefined;
|
|
3318
|
+
passed: boolean;
|
|
3319
|
+
detail: string;
|
|
3320
|
+
}
|
|
3321
|
+
interface SimulationResult {
|
|
3322
|
+
id: string;
|
|
3323
|
+
case_id: string | null;
|
|
3324
|
+
case_name: string;
|
|
3325
|
+
position: number;
|
|
3326
|
+
status: SimulationResultStatus;
|
|
3327
|
+
/** Why it failed, errored or was skipped. */
|
|
3328
|
+
reason: string | null;
|
|
3329
|
+
/** Taken from an earlier identical run rather than run again. */
|
|
3330
|
+
cached: boolean;
|
|
3331
|
+
transcript: {
|
|
3332
|
+
role: "caller" | "agent";
|
|
3333
|
+
text: string;
|
|
3334
|
+
node_id?: string | undefined;
|
|
3335
|
+
}[];
|
|
3336
|
+
tool_calls: {
|
|
3337
|
+
name: string;
|
|
3338
|
+
input: Record<string, unknown>;
|
|
3339
|
+
result: string;
|
|
3340
|
+
}[];
|
|
3341
|
+
/** A flow agent's variables at the end. */
|
|
3342
|
+
variables: Record<string, unknown>;
|
|
3343
|
+
checks: SimulationCheckResult[];
|
|
3344
|
+
model_turns: number;
|
|
3345
|
+
duration_ms: number;
|
|
3346
|
+
finished_at: string | null;
|
|
3347
|
+
}
|
|
3348
|
+
interface SimulationRunDetail extends SimulationRun {
|
|
3349
|
+
results: SimulationResult[];
|
|
3350
|
+
}
|
|
3351
|
+
interface SimulationSuite {
|
|
3352
|
+
id: string;
|
|
3353
|
+
agent_id: string;
|
|
3354
|
+
name: string;
|
|
3355
|
+
description: string | null;
|
|
3356
|
+
publish_gate: SimulationPublishGate;
|
|
3357
|
+
case_count: number;
|
|
3358
|
+
latest_run: SimulationRun | null;
|
|
3359
|
+
created_at: string | null;
|
|
3360
|
+
updated_at: string | null;
|
|
3361
|
+
}
|
|
3362
|
+
interface SimulationSuiteDetail extends SimulationSuite {
|
|
3363
|
+
cases: SimulationCase[];
|
|
3364
|
+
}
|
|
3365
|
+
interface SimulationSuiteList {
|
|
3366
|
+
/** Whether simulations are switched on for the platform. */
|
|
3367
|
+
enabled: boolean;
|
|
3368
|
+
suites: SimulationSuite[];
|
|
3369
|
+
}
|
|
3370
|
+
interface SimulationRunList {
|
|
3371
|
+
runs: SimulationRun[];
|
|
3372
|
+
}
|
|
3373
|
+
|
|
3374
|
+
/**
|
|
3375
|
+
* Test your agent before a change reaches a caller. A **suite** holds **cases**; in each, a simulated caller
|
|
3376
|
+
* talks to the agent in text and your **checks** decide whether it passed.
|
|
3377
|
+
*
|
|
3378
|
+
* A simulation is not a call: nothing is dialled, recorded or billed, and the agent's tools are never really
|
|
3379
|
+
* called. Simulations spend model usage, so they are switched on per platform; until then every method answers
|
|
3380
|
+
* 403 `simulations_disabled`.
|
|
3381
|
+
*
|
|
3382
|
+
* const suite = await dialgem.simulations.createSuite({ agent_id, name: "Refunds" })
|
|
3383
|
+
* await dialgem.simulations.createCase(suite.id, {
|
|
3384
|
+
* name: "Asks for a refund",
|
|
3385
|
+
* caller: { mode: "script", turns: ["I want my money back."] },
|
|
3386
|
+
* checks: [{ type: "not_contains", text: "full refund" }],
|
|
3387
|
+
* })
|
|
3388
|
+
* const run = await dialgem.simulations.run(suite.id)
|
|
3389
|
+
* // poll retrieveRun(run.id) until status is "completed"
|
|
3390
|
+
*/
|
|
3391
|
+
declare class Simulations extends APIResource {
|
|
3392
|
+
/** Make a suite for one of your agents. */
|
|
3393
|
+
createSuite(body: SimulationSuiteCreateParams, options?: RequestOptions): Promise<SimulationSuite>;
|
|
3394
|
+
/** Your suites, newest first, each with its latest run. Pass `agent_id` for one agent's. */
|
|
3395
|
+
listSuites(params?: {
|
|
3396
|
+
agent_id?: string;
|
|
3397
|
+
}, options?: RequestOptions): Promise<SimulationSuiteList>;
|
|
3398
|
+
/** One suite with its cases. */
|
|
3399
|
+
retrieveSuite(suiteId: string, options?: RequestOptions): Promise<SimulationSuiteDetail>;
|
|
3400
|
+
/**
|
|
3401
|
+
* Rename a suite or set its publish gate: `off`, `warn` (publishing a version succeeds and lists the suites the draft
|
|
3402
|
+
* has not passed) or `block` (publishing is refused with 409 `simulation_required` until it has).
|
|
3403
|
+
*/
|
|
3404
|
+
updateSuite(suiteId: string, body: SimulationSuiteUpdateParams, options?: RequestOptions): Promise<SimulationSuite>;
|
|
3405
|
+
/** Delete a suite and its cases. Past runs are deleted with it. */
|
|
3406
|
+
deleteSuite(suiteId: string, options?: RequestOptions): Promise<void>;
|
|
3407
|
+
/** Add a case (up to 50 per suite). 422 `invalid_case` says what to fix. */
|
|
3408
|
+
createCase(suiteId: string, body: SimulationCaseInput, options?: RequestOptions): Promise<SimulationCase>;
|
|
3409
|
+
/** Change a case. Fields you leave out keep their value. */
|
|
3410
|
+
updateCase(caseId: string, body: Partial<SimulationCaseInput>, options?: RequestOptions): Promise<SimulationCase>;
|
|
3411
|
+
deleteCase(caseId: string, options?: RequestOptions): Promise<void>;
|
|
3412
|
+
/**
|
|
3413
|
+
* Run every case of a suite against the draft, a published version or `"latest_published"`. Answers at once
|
|
3414
|
+
* (`202`); the run happens in the background, so poll `retrieveRun` until `status` is `completed`.
|
|
3415
|
+
*
|
|
3416
|
+
* 409 `suite_empty`, 422 `agent_type_not_supported` (multi-prompt agents), 429 `too_many_runs` or
|
|
3417
|
+
* `daily_run_limit`.
|
|
3418
|
+
*/
|
|
3419
|
+
run(suiteId: string, body?: SimulationRunCreateParams, options?: RequestOptions): Promise<SimulationRun>;
|
|
3420
|
+
/** Runs, newest first. Pass `suite_id` for one suite's. */
|
|
3421
|
+
listRuns(params?: {
|
|
3422
|
+
suite_id?: string;
|
|
3423
|
+
limit?: number;
|
|
3424
|
+
}, options?: RequestOptions): Promise<SimulationRunList>;
|
|
3425
|
+
/** A run with every case's transcript, tool calls and check results. */
|
|
3426
|
+
retrieveRun(runId: string, options?: RequestOptions): Promise<SimulationRunDetail>;
|
|
3427
|
+
/** Stop a run that has not finished. Cases already under way finish; the rest are skipped. */
|
|
3428
|
+
cancelRun(runId: string, options?: RequestOptions): Promise<SimulationRun>;
|
|
3429
|
+
}
|
|
3430
|
+
|
|
3431
|
+
/**
|
|
3432
|
+
* Browser calls. Request bodies come from the generated OpenAPI types (see `params.ts`); the response
|
|
3433
|
+
* shapes are written from the API's own serializers.
|
|
3434
|
+
*/
|
|
3435
|
+
|
|
3436
|
+
type Schemas$4 = components["schemas"];
|
|
3437
|
+
type WebCallCreateParams = RequestBody<Schemas$4["WebCallRequest"]>;
|
|
3438
|
+
type WebCallSettingsUpdateParams = RequestBody<Schemas$4["WebCallSettings"]>;
|
|
3439
|
+
/** What `webCalls.create` returns. Hand `access_token` to the page; keep your API key on the server. */
|
|
3440
|
+
interface WebCall {
|
|
3441
|
+
/** The call's id. The call record exists from now, with status `queued` until the browser connects. */
|
|
3442
|
+
call_id: string;
|
|
3443
|
+
agent_id: string;
|
|
3444
|
+
/** The published version this call will run (0 is the live draft). */
|
|
3445
|
+
agent_version: number;
|
|
3446
|
+
/**
|
|
3447
|
+
* A one-use credential for exactly this call and agent. It cannot be used for anything else, and it works
|
|
3448
|
+
* from the origins you have allowed, once.
|
|
3449
|
+
*/
|
|
3450
|
+
access_token: string;
|
|
3451
|
+
/** ISO 8601, UTC. 60 seconds after creation: long enough to reach the page, not to be stockpiled. */
|
|
3452
|
+
expires_at: string;
|
|
3453
|
+
expires_in: number;
|
|
3454
|
+
}
|
|
3455
|
+
interface WebCallSettings {
|
|
3456
|
+
/** The websites (origins, like `https://app.example.com`) browser calls may start from. Empty means none. */
|
|
3457
|
+
allowed_origins: string[];
|
|
3458
|
+
/** True when the list contains `*`: any website may start a call with a token it was given. */
|
|
3459
|
+
any_origin: boolean;
|
|
3460
|
+
limits: {
|
|
3461
|
+
/** Browser calls that can be live at once, per organization. */
|
|
3462
|
+
max_concurrent_calls: number;
|
|
3463
|
+
/** Calls that can be created per minute, per organization. */
|
|
3464
|
+
tokens_per_minute: number;
|
|
3465
|
+
token_ttl_s: number;
|
|
3466
|
+
};
|
|
3467
|
+
}
|
|
3468
|
+
|
|
3469
|
+
/**
|
|
3470
|
+
* Let a visitor talk to one of your agents from a web page, with `@dialgem/client`.
|
|
3471
|
+
*
|
|
3472
|
+
* Your **backend** calls `create` with your API key and gives the returned `access_token` to the page; the
|
|
3473
|
+
* page connects with that token alone. The key never reaches the browser. Before the first call, allow the
|
|
3474
|
+
* page's origin with `updateSettings`.
|
|
3475
|
+
*/
|
|
3476
|
+
declare class WebCalls extends APIResource {
|
|
3477
|
+
/**
|
|
3478
|
+
* Create a call for one visitor and get its access token.
|
|
3479
|
+
*
|
|
3480
|
+
* const { access_token } = await dialgem.webCalls.create({ agent_id, metadata: { visitor: "v_123" } })
|
|
3481
|
+
*
|
|
3482
|
+
* `metadata` and `dialgem_llm_dynamic_variables` are fixed here, by you, and cannot be changed by the page.
|
|
3483
|
+
* 409 `web_origins_not_configured` until an origin is allowed; 402 if the organization cannot pay for calls;
|
|
3484
|
+
* 429 when more than `limits.tokens_per_minute` calls are created in a minute.
|
|
3485
|
+
*/
|
|
3486
|
+
create(body: WebCallCreateParams, options?: RequestOptions): Promise<WebCall>;
|
|
3487
|
+
/** The origins browser calls may start from, and the limits that apply. */
|
|
3488
|
+
retrieveSettings(options?: RequestOptions): Promise<WebCallSettings>;
|
|
3489
|
+
/**
|
|
3490
|
+
* Replace the allowed origins. Each is `scheme://host[:port]`; `https://*.example.com` allows any subdomain
|
|
3491
|
+
* (not the bare domain) and `*` allows any website. Tokens already issued keep the list they were issued with.
|
|
3492
|
+
*/
|
|
3493
|
+
updateSettings(body: WebCallSettingsUpdateParams, options?: RequestOptions): Promise<WebCallSettings>;
|
|
3494
|
+
}
|
|
3495
|
+
|
|
3496
|
+
/**
|
|
3497
|
+
* Contacts, lists and CSV imports.
|
|
3498
|
+
*
|
|
3499
|
+
* Request bodies come from the generated OpenAPI types (see `params.ts`); the
|
|
3500
|
+
* response shapes are written here, from the API's own serializers.
|
|
3501
|
+
*/
|
|
3502
|
+
|
|
3503
|
+
type Schemas$3 = components["schemas"];
|
|
3504
|
+
type ContactCreateParams = RequestBody<Schemas$3["ContactCreate"]>;
|
|
3505
|
+
type ContactUpdateParams = RequestBody<Schemas$3["ContactUpdate"]>;
|
|
3506
|
+
type ContactListCreateParams = RequestBody<Schemas$3["ContactListCreate"]>;
|
|
3507
|
+
type ContactListUpdateParams = RequestBody<Schemas$3["ContactListUpdate"]>;
|
|
3508
|
+
type ContactImportCreateParams = RequestBody<Schemas$3["ContactImportCreate"]>;
|
|
3509
|
+
interface Contact {
|
|
3510
|
+
id: string;
|
|
3511
|
+
/** E.164, for example `+14155552671`. The number is the contact's identity: one contact per number. */
|
|
3512
|
+
phone: string;
|
|
3513
|
+
first_name: string | null;
|
|
3514
|
+
last_name: string | null;
|
|
3515
|
+
email: string | null;
|
|
3516
|
+
/** IANA zone name, for example `America/Chicago`. */
|
|
3517
|
+
timezone: string | null;
|
|
3518
|
+
/** Your own fields, as text. */
|
|
3519
|
+
attributes: Record<string, string>;
|
|
3520
|
+
source: "api" | "dashboard" | "import" | (string & {});
|
|
3521
|
+
/**
|
|
3522
|
+
* Whether the number is on your organization's do-not-call list. Read from that list
|
|
3523
|
+
* each time, never stored on the contact.
|
|
3524
|
+
*/
|
|
3525
|
+
do_not_call: boolean;
|
|
3526
|
+
/** ISO 8601, no timezone suffix (UTC). */
|
|
3527
|
+
created_at: string | null;
|
|
3528
|
+
updated_at: string | null;
|
|
3529
|
+
/** Present on `create`, `retrieve` and `update`. */
|
|
3530
|
+
lists?: {
|
|
3531
|
+
id: string;
|
|
3532
|
+
name: string;
|
|
3533
|
+
}[];
|
|
3534
|
+
/** Present on `retrieve`: calls to or from the number. */
|
|
3535
|
+
call_count?: number;
|
|
3536
|
+
last_call_at?: string | null;
|
|
3537
|
+
}
|
|
3538
|
+
interface ContactListParams {
|
|
3539
|
+
/** Matches name, email and phone digits. */
|
|
3540
|
+
q?: string | undefined;
|
|
3541
|
+
list_id?: string | undefined;
|
|
3542
|
+
/** 1 to 200. Default 50. */
|
|
3543
|
+
limit?: number | undefined;
|
|
3544
|
+
}
|
|
3545
|
+
interface ContactDeleteResponse {
|
|
3546
|
+
id: string;
|
|
3547
|
+
deleted: true;
|
|
3548
|
+
}
|
|
3549
|
+
interface ContactCallSummary {
|
|
3550
|
+
id: string;
|
|
3551
|
+
agent_id: string | null;
|
|
3552
|
+
direction: "inbound" | "outbound" | (string & {});
|
|
3553
|
+
status: string;
|
|
3554
|
+
started_at: string | null;
|
|
3555
|
+
ended_at: string | null;
|
|
3556
|
+
duration_s: number | null;
|
|
3557
|
+
disconnection_reason: string | null;
|
|
3558
|
+
/** The call's analysis summary, when it has one. No transcript. */
|
|
3559
|
+
summary: string | null;
|
|
3560
|
+
}
|
|
3561
|
+
interface ContactCallList {
|
|
3562
|
+
total: number;
|
|
3563
|
+
calls: ContactCallSummary[];
|
|
3564
|
+
}
|
|
3565
|
+
interface ContactListRecord {
|
|
3566
|
+
id: string;
|
|
3567
|
+
name: string;
|
|
3568
|
+
description: string | null;
|
|
3569
|
+
member_count: number;
|
|
3570
|
+
created_at: string | null;
|
|
3571
|
+
updated_at: string | null;
|
|
3572
|
+
}
|
|
3573
|
+
interface ContactListDeleteResponse {
|
|
3574
|
+
id: string;
|
|
3575
|
+
deleted: true;
|
|
3576
|
+
}
|
|
3577
|
+
interface ContactListMembersAddResponse {
|
|
3578
|
+
id: string;
|
|
3579
|
+
/** How many were not already in the list. */
|
|
3580
|
+
added: number;
|
|
3581
|
+
member_count: number;
|
|
3582
|
+
}
|
|
3583
|
+
interface ContactListMemberRemoveResponse {
|
|
3584
|
+
id: string;
|
|
3585
|
+
member_count: number;
|
|
3586
|
+
}
|
|
3587
|
+
type ContactImportStatus = "queued" | "running"
|
|
3588
|
+
/** A dry run finished; apply it with `commit`. */
|
|
3589
|
+
| "previewed" | "completed" | "failed" | "cancelled"
|
|
3590
|
+
/** A preview nobody confirmed within a day. */
|
|
3591
|
+
| "expired";
|
|
3592
|
+
interface ContactImport {
|
|
3593
|
+
id: string;
|
|
3594
|
+
status: ContactImportStatus;
|
|
3595
|
+
dry_run: boolean;
|
|
3596
|
+
filename: string | null;
|
|
3597
|
+
total_rows: number;
|
|
3598
|
+
/** For a preview, what would be created. */
|
|
3599
|
+
created: number;
|
|
3600
|
+
updated: number;
|
|
3601
|
+
/** Rows repeating an earlier number in the file, or existing contacts when `on_duplicate` is `skip`. */
|
|
3602
|
+
skipped: number;
|
|
3603
|
+
/** Rows that could not be used. See `imports.errors`. */
|
|
3604
|
+
errors: number;
|
|
3605
|
+
/** More rows were rejected than the report keeps (5,000). */
|
|
3606
|
+
errors_truncated: boolean;
|
|
3607
|
+
failure: string | null;
|
|
3608
|
+
mapping: Record<string, string> | null;
|
|
3609
|
+
attribute_columns: string[] | null;
|
|
3610
|
+
default_country: string | null;
|
|
3611
|
+
on_duplicate: "update" | "skip" | null;
|
|
3612
|
+
list_id: string | null;
|
|
3613
|
+
created_at: string | null;
|
|
3614
|
+
started_at: string | null;
|
|
3615
|
+
finished_at: string | null;
|
|
3616
|
+
}
|
|
3617
|
+
interface ContactImportList {
|
|
3618
|
+
imports: ContactImport[];
|
|
3619
|
+
}
|
|
3620
|
+
interface ContactCsvInspection {
|
|
3621
|
+
headers: string[];
|
|
3622
|
+
row_count: number;
|
|
3623
|
+
/** The guessed field-to-column mapping: `phone`, `first_name`, `last_name`, `full_name`, `email`, `timezone`. */
|
|
3624
|
+
mapping: Record<string, string>;
|
|
3625
|
+
/** Columns left over, offered as your own fields. */
|
|
3626
|
+
attribute_columns: string[];
|
|
3627
|
+
sample: Record<string, string | null>[];
|
|
3628
|
+
}
|
|
3629
|
+
interface ContactImportErrorRow {
|
|
3630
|
+
/** The line of the file, counting the header as line 1. */
|
|
3631
|
+
row: number;
|
|
3632
|
+
error: string;
|
|
3633
|
+
values: Record<string, string>;
|
|
3634
|
+
}
|
|
3635
|
+
interface ContactImportErrors {
|
|
3636
|
+
errors: ContactImportErrorRow[];
|
|
3637
|
+
total: number;
|
|
3638
|
+
truncated: boolean;
|
|
3639
|
+
}
|
|
3640
|
+
|
|
3641
|
+
/**
|
|
3642
|
+
* The people your organization calls. A phone number identifies each one: it is stored
|
|
3643
|
+
* in international form however you write it, and each number can be a contact once.
|
|
3644
|
+
*/
|
|
3645
|
+
declare class Contacts extends APIResource {
|
|
3646
|
+
/** Bulk import from CSV, with a dry-run preview. */
|
|
3647
|
+
readonly imports: ContactImports;
|
|
3648
|
+
constructor(client: HttpClient);
|
|
3649
|
+
/**
|
|
3650
|
+
* Add a contact. `phone` is any way of writing a valid number; without a leading `+`
|
|
3651
|
+
* also pass `default_country` (`"US"`). A number that is already a contact answers 409
|
|
3652
|
+
* with its `contact_id`.
|
|
3653
|
+
*/
|
|
3654
|
+
create(body: ContactCreateParams, options?: RequestOptions): Promise<Contact>;
|
|
3655
|
+
/**
|
|
3656
|
+
* Contacts, newest first. Await for one page, or iterate for every contact:
|
|
3657
|
+
*
|
|
3658
|
+
*/
|
|
3659
|
+
list(params?: ContactListParams, options?: RequestOptions): PagePromise<Contact>;
|
|
3660
|
+
/**
|
|
3661
|
+
* The contact with this phone number. The number is matched as E.164, so
|
|
3662
|
+
* `("(212) 220-0001", { default_country: "US" })` finds `+12122200001`. Throws
|
|
3663
|
+
* `NotFoundError` if you have no such contact, and `UnprocessableEntityError` if the text is
|
|
3664
|
+
* not a phone number.
|
|
3665
|
+
*/
|
|
3666
|
+
retrieveByPhone(phone: string, params?: {
|
|
3667
|
+
default_country?: string | undefined;
|
|
3668
|
+
}, options?: RequestOptions): Promise<Contact>;
|
|
3669
|
+
/** One contact, with its lists and how many calls it has had. */
|
|
3670
|
+
retrieve(contactId: string, options?: RequestOptions): Promise<Contact>;
|
|
3671
|
+
/**
|
|
3672
|
+
* Partial update: only the fields you send change, and `null` clears a field.
|
|
3673
|
+
* `attributes` replaces the whole set, so send every field you want kept.
|
|
3674
|
+
*/
|
|
3675
|
+
update(contactId: string, body: ContactUpdateParams, options?: RequestOptions): Promise<Contact>;
|
|
3676
|
+
/**
|
|
3677
|
+
* Erase a contact and its list memberships. Calls already made stay in the call log, and
|
|
3678
|
+
* a do-not-call entry for the number stays too, so forgetting a person never makes a number
|
|
3679
|
+
* that asked not to be called dialable again.
|
|
3680
|
+
*/
|
|
3681
|
+
delete(contactId: string, options?: RequestOptions): Promise<ContactDeleteResponse>;
|
|
3682
|
+
/** Calls to or from the contact's number, newest first. Summaries, not transcripts. */
|
|
3683
|
+
calls(contactId: string, params?: {
|
|
3684
|
+
limit?: number | undefined;
|
|
3685
|
+
}, options?: RequestOptions): Promise<ContactCallList>;
|
|
3686
|
+
}
|
|
3687
|
+
/**
|
|
3688
|
+
* CSV import runs in the background. Typical flow: `inspect` to see the columns, `create`
|
|
3689
|
+
* with `dry_run: true`, poll `retrieve` until `previewed`, look at the counts (and `errors`),
|
|
3690
|
+
* then `commit` and poll until `completed`.
|
|
3691
|
+
*
|
|
3692
|
+
* The CSV text is sent in the request. Downloading the rejected rows as a CSV, and exporting
|
|
3693
|
+
* contacts, are available over the REST API (`GET /v1/contacts/imports/{id}/errors?format=csv`,
|
|
3694
|
+
* `GET /v1/contacts/export`).
|
|
3695
|
+
*/
|
|
3696
|
+
declare class ContactImports extends APIResource {
|
|
3697
|
+
/** The file's headers, a guessed column mapping and a few rows. Imports nothing. */
|
|
3698
|
+
inspect(csv: string, options?: RequestOptions): Promise<ContactCsvInspection>;
|
|
3699
|
+
/**
|
|
3700
|
+
* Start an import. Without `mapping` the columns are guessed from the headers. With
|
|
3701
|
+
* `dry_run: true` nothing is written: the import only validates and reports.
|
|
3702
|
+
*/
|
|
3703
|
+
create(body: ContactImportCreateParams, options?: RequestOptions): Promise<ContactImport>;
|
|
3704
|
+
/** Recent imports, newest first. */
|
|
3705
|
+
list(options?: RequestOptions): Promise<ContactImportList>;
|
|
3706
|
+
/** Progress and counts. */
|
|
3707
|
+
retrieve(importId: string, options?: RequestOptions): Promise<ContactImport>;
|
|
3708
|
+
/** The rows that were rejected, with the line, the reason and what each held. */
|
|
3709
|
+
errors(importId: string, params?: {
|
|
3710
|
+
limit?: number | undefined;
|
|
3711
|
+
}, options?: RequestOptions): Promise<ContactImportErrors>;
|
|
3712
|
+
/** Apply a previewed import: the file is read again, so what is applied is what was previewed. */
|
|
3713
|
+
commit(importId: string, options?: RequestOptions): Promise<ContactImport>;
|
|
3714
|
+
/** Stop an import that has not finished. Contacts a running import already wrote stay. */
|
|
3715
|
+
cancel(importId: string, options?: RequestOptions): Promise<ContactImport>;
|
|
3716
|
+
}
|
|
3717
|
+
/** Named groups of contacts. Deleting a list never deletes its contacts. */
|
|
3718
|
+
declare class ContactLists extends APIResource {
|
|
3719
|
+
list(options?: RequestOptions): Promise<{
|
|
3720
|
+
lists: ContactListRecord[];
|
|
3721
|
+
}>;
|
|
3722
|
+
/** Names are unique within your organization, ignoring case. */
|
|
3723
|
+
create(body: ContactListCreateParams, options?: RequestOptions): Promise<ContactListRecord>;
|
|
3724
|
+
retrieve(listId: string, options?: RequestOptions): Promise<ContactListRecord>;
|
|
3725
|
+
update(listId: string, body: ContactListUpdateParams, options?: RequestOptions): Promise<ContactListRecord>;
|
|
3726
|
+
delete(listId: string, options?: RequestOptions): Promise<ContactListDeleteResponse>;
|
|
3727
|
+
/** Add up to 1000 of your contacts. Already-members are ignored; `added` says how many were new. */
|
|
3728
|
+
addContacts(listId: string, contactIds: string[], options?: RequestOptions): Promise<ContactListMembersAddResponse>;
|
|
3729
|
+
removeContact(listId: string, contactId: string, options?: RequestOptions): Promise<ContactListMemberRemoveResponse>;
|
|
3730
|
+
}
|
|
3731
|
+
|
|
2510
3732
|
/**
|
|
2511
3733
|
* Which published agent version a number answers on.
|
|
2512
3734
|
*
|
|
@@ -2547,6 +3769,35 @@ interface PhoneNumber {
|
|
|
2547
3769
|
/** Epoch milliseconds (0 if unknown). */
|
|
2548
3770
|
last_modification_timestamp: number;
|
|
2549
3771
|
sip_outbound_trunk_config: SipOutboundTrunkConfig | null;
|
|
3772
|
+
/** The inbound routing webhook, asked before an inbound call is answered. `null` when none is set. */
|
|
3773
|
+
inbound_webhook_url: string | null;
|
|
3774
|
+
/** The last four characters of the signing secret; `null` with no webhook. */
|
|
3775
|
+
inbound_webhook_secret_hint: string | null;
|
|
3776
|
+
/** The full signing secret. Present **only** in the response that created or rotated it, never again. */
|
|
3777
|
+
inbound_webhook_secret?: string;
|
|
3778
|
+
}
|
|
3779
|
+
/** What `phoneNumbers.testInboundWebhook` reports. */
|
|
3780
|
+
interface InboundWebhookTestResult {
|
|
3781
|
+
/** Your endpoint answered with a 2xx. */
|
|
3782
|
+
ok: boolean;
|
|
3783
|
+
status_code: number | null;
|
|
3784
|
+
latency_ms: number;
|
|
3785
|
+
/** The time your endpoint has for a real call (`INBOUND_ROUTING_TIMEOUT_S`). */
|
|
3786
|
+
budget_ms: number;
|
|
3787
|
+
error: string | null;
|
|
3788
|
+
/** What a real call would have done with the answer. */
|
|
3789
|
+
decision: {
|
|
3790
|
+
outcome: "unchanged" | "applied" | "rejected" | "fallback";
|
|
3791
|
+
note?: string;
|
|
3792
|
+
reject_reason?: string;
|
|
3793
|
+
agent_id?: string;
|
|
3794
|
+
agent_version?: number | null;
|
|
3795
|
+
/** Names of the dynamic variables that would be applied. */
|
|
3796
|
+
variables?: string[];
|
|
3797
|
+
metadata_keys?: string[];
|
|
3798
|
+
/** Fields that would be ignored, as `field: reason`. */
|
|
3799
|
+
ignored?: Record<string, string>;
|
|
3800
|
+
};
|
|
2550
3801
|
}
|
|
2551
3802
|
interface PhoneNumberAgentWeight {
|
|
2552
3803
|
agent_id: string;
|
|
@@ -2584,10 +3835,262 @@ declare class PhoneNumbers extends APIResource {
|
|
|
2584
3835
|
update(phoneNumberId: string, body: PhoneNumberUpdateParams, options?: RequestOptions): Promise<PhoneNumber>;
|
|
2585
3836
|
/** Set the number's **inbound** agent, or pass `agent_id: null` to clear it. For outbound, use `update`. */
|
|
2586
3837
|
assign(phoneNumberId: string, body: PhoneNumberAssignParams, options?: RequestOptions): Promise<PhoneNumber>;
|
|
3838
|
+
/**
|
|
3839
|
+
* Send one signed test request to the number's inbound routing webhook and report what a real call would have done
|
|
3840
|
+
* with your answer: the status, how long you took against the time budget, and any field that would be ignored.
|
|
3841
|
+
* Throws a `ConflictError` (`inbound_webhook_not_set`) when the number has no `inbound_webhook_url`.
|
|
3842
|
+
*/
|
|
3843
|
+
testInboundWebhook(phoneNumberId: string, options?: RequestOptions): Promise<InboundWebhookTestResult>;
|
|
3844
|
+
/**
|
|
3845
|
+
* Replace the inbound webhook's signing secret. The new secret is returned **once**, as `inbound_webhook_secret`
|
|
3846
|
+
* on the number; the old one stops working at once.
|
|
3847
|
+
*/
|
|
3848
|
+
rotateInboundWebhookSecret(phoneNumberId: string, options?: RequestOptions): Promise<PhoneNumber>;
|
|
2587
3849
|
/** Release the number from Dialgem. It stops routing calls and disappears from `list()`; your carrier account is untouched. */
|
|
2588
3850
|
delete(phoneNumberId: string, options?: RequestOptions): Promise<void>;
|
|
2589
3851
|
}
|
|
2590
3852
|
|
|
3853
|
+
/**
|
|
3854
|
+
* Chats. Request bodies come from the generated OpenAPI types; the response shapes are written from the
|
|
3855
|
+
* API's own serializer (`chat_to_dict`).
|
|
3856
|
+
*/
|
|
3857
|
+
|
|
3858
|
+
type Schemas$2 = components["schemas"];
|
|
3859
|
+
type ChatCreateParams = RequestBody<Schemas$2["ChatCreate"]>;
|
|
3860
|
+
type ChatUpdateParams = RequestBody<Schemas$2["ChatUpdate"]>;
|
|
3861
|
+
interface ChatListParams {
|
|
3862
|
+
agent_id?: string | undefined;
|
|
3863
|
+
status?: "ongoing" | "ended" | undefined;
|
|
3864
|
+
/** 1 to 100. Default 50. */
|
|
3865
|
+
limit?: number | undefined;
|
|
3866
|
+
}
|
|
3867
|
+
/** One entry in a chat. Tool use is shown between the user's message and the agent's reply. */
|
|
3868
|
+
interface ChatMessage {
|
|
3869
|
+
message_id: string;
|
|
3870
|
+
role: "user" | "agent" | "tool_call_invocation" | "tool_call_result" | (string & {});
|
|
3871
|
+
/** The text. Empty on a `tool_call_invocation`; the tool's answer on a `tool_call_result`. */
|
|
3872
|
+
content: string;
|
|
3873
|
+
/** Epoch milliseconds. */
|
|
3874
|
+
created_timestamp: number;
|
|
3875
|
+
/** On the two tool roles: ties an invocation to its result. */
|
|
3876
|
+
tool_call_id?: string;
|
|
3877
|
+
/** On `tool_call_invocation`. */
|
|
3878
|
+
name?: string;
|
|
3879
|
+
arguments?: Record<string, unknown>;
|
|
3880
|
+
}
|
|
3881
|
+
interface Chat {
|
|
3882
|
+
id: string;
|
|
3883
|
+
/** Same as `id`. */
|
|
3884
|
+
chat_id: string;
|
|
3885
|
+
chat_type: "api_chat" | (string & {});
|
|
3886
|
+
chat_status: "ongoing" | "ended" | (string & {});
|
|
3887
|
+
agent_id: string;
|
|
3888
|
+
/** The version the chat answers with; 0 is the live draft. */
|
|
3889
|
+
agent_version: number;
|
|
3890
|
+
metadata: Record<string, unknown>;
|
|
3891
|
+
dynamic_variables: Record<string, string>;
|
|
3892
|
+
/** Epoch milliseconds. */
|
|
3893
|
+
start_timestamp: number | null;
|
|
3894
|
+
end_timestamp: number | null;
|
|
3895
|
+
/** `user_ended`, `agent_ended`, ... `null` while ongoing. */
|
|
3896
|
+
end_reason: string | null;
|
|
3897
|
+
/** User and agent messages, not counting tool entries. */
|
|
3898
|
+
message_count: number;
|
|
3899
|
+
/** `User: ...` / `Agent: ...` lines. */
|
|
3900
|
+
transcript: string;
|
|
3901
|
+
/** Same shape as a call's `analysis`; `null` until it has run (a moment after the chat ends). */
|
|
3902
|
+
analysis: Record<string, unknown> | null;
|
|
3903
|
+
/**
|
|
3904
|
+
* What the chat has cost so far, in $0.0001 units (50 = $0.005), and how many agent messages it holds
|
|
3905
|
+
* (the greeting is one, and is not billed). `null` for a team-member session, as for a call's cost.
|
|
3906
|
+
* Estimates until the price list is published.
|
|
3907
|
+
*/
|
|
3908
|
+
chat_cost: {
|
|
3909
|
+
combined_cost: number;
|
|
3910
|
+
reply_count: number;
|
|
3911
|
+
} | null;
|
|
3912
|
+
/** Left out of `list` entries; fetch one chat for them. */
|
|
3913
|
+
messages?: ChatMessage[];
|
|
3914
|
+
}
|
|
3915
|
+
/** What `chats.sendMessage` returns: only the new entries, in order. */
|
|
3916
|
+
interface ChatReply {
|
|
3917
|
+
chat_id: string;
|
|
3918
|
+
chat_status: "ongoing" | "ended" | (string & {});
|
|
3919
|
+
messages: ChatMessage[];
|
|
3920
|
+
}
|
|
3921
|
+
interface ChatDeleteResponse {
|
|
3922
|
+
deleted: true;
|
|
3923
|
+
id: string;
|
|
3924
|
+
}
|
|
3925
|
+
|
|
3926
|
+
/**
|
|
3927
|
+
* Text conversations with one of your agents, from your backend.
|
|
3928
|
+
*
|
|
3929
|
+
* const chat = await dialgem.chats.create({ agent_id, dynamic_variables: { customer: "Ada" } })
|
|
3930
|
+
* const { messages } = await dialgem.chats.sendMessage(chat.id, "Can I come in on Tuesday?")
|
|
3931
|
+
* await dialgem.chats.end(chat.id)
|
|
3932
|
+
*
|
|
3933
|
+
* The agent is the one that answers your phone: same prompt, model and functions. Prompt agents only; an agent
|
|
3934
|
+
* that keeps no transcript cannot chat. Your API key stays on your server; to put a chat box on a web page,
|
|
3935
|
+
* have your backend call `sendMessage` for the visitor.
|
|
3936
|
+
*/
|
|
3937
|
+
declare class Chats extends APIResource {
|
|
3938
|
+
/**
|
|
3939
|
+
* Start a chat. If the agent has a first message it is already in `messages`.
|
|
3940
|
+
*
|
|
3941
|
+
* `UnprocessableEntityError` with `errCode` `agent_type_not_supported` (flow agents) or `chat_requires_storage`.
|
|
3942
|
+
* Not retried by default.
|
|
3943
|
+
*/
|
|
3944
|
+
create(body: ChatCreateParams, options?: RequestOptions): Promise<Chat>;
|
|
3945
|
+
/**
|
|
3946
|
+
* Chats, newest first. Await for one page, or iterate for every chat. Entries leave out `messages`;
|
|
3947
|
+
* `retrieve` a chat for them.
|
|
3948
|
+
*/
|
|
3949
|
+
list(params?: ChatListParams, options?: RequestOptions): PagePromise<Chat>;
|
|
3950
|
+
/** One chat with all its messages. */
|
|
3951
|
+
retrieve(chatId: string, options?: RequestOptions): Promise<Chat>;
|
|
3952
|
+
/** Replace the chat's `metadata` (the whole object). */
|
|
3953
|
+
update(chatId: string, body: ChatUpdateParams, options?: RequestOptions): Promise<Chat>;
|
|
3954
|
+
/** Delete a chat and its messages. */
|
|
3955
|
+
delete(chatId: string, options?: RequestOptions): Promise<ChatDeleteResponse>;
|
|
3956
|
+
/**
|
|
3957
|
+
* Send the user's message and wait for the agent's reply. Returns only the new entries, in order: the user's
|
|
3958
|
+
* message, any tool use, the agent's reply.
|
|
3959
|
+
*
|
|
3960
|
+
* If the agent's model fails (`ServerError`, `errCode` `model_error`) nothing is stored and the same message
|
|
3961
|
+
* can be sent again. `ConflictError` with `errCode` `chat_busy` while another reply is in progress,
|
|
3962
|
+
* `chat_ended` after the end, `message_limit` at the cap. If the agent calls its end-call tool, the reply's
|
|
3963
|
+
* `chat_status` is `ended`.
|
|
3964
|
+
*
|
|
3965
|
+
* Not retried by default: a retry after an ambiguous failure could send the message twice.
|
|
3966
|
+
*/
|
|
3967
|
+
sendMessage(chatId: string, content: string, options?: RequestOptions): Promise<ChatReply>;
|
|
3968
|
+
/** End the chat. Ending twice is fine. The analysis arrives a moment later; read it with `retrieve`. */
|
|
3969
|
+
end(chatId: string, options?: RequestOptions): Promise<Chat>;
|
|
3970
|
+
/**
|
|
3971
|
+
* Analyse an ended chat again with the agent's current analysis settings and return it. `ConflictError` with
|
|
3972
|
+
* `errCode` `chat_in_progress` until it has ended, `no_transcript` when it has no messages.
|
|
3973
|
+
*/
|
|
3974
|
+
rerunAnalysis(chatId: string, options?: RequestOptions): Promise<Chat>;
|
|
3975
|
+
}
|
|
3976
|
+
|
|
3977
|
+
/**
|
|
3978
|
+
* Saved flows. Request bodies come from the generated OpenAPI types; the response shape is written from the
|
|
3979
|
+
* API's own serializer (`flow_to_dict`).
|
|
3980
|
+
*/
|
|
3981
|
+
|
|
3982
|
+
type Schemas$1 = components["schemas"];
|
|
3983
|
+
type FlowCreateParams = RequestBody<Schemas$1["FlowCreate"]>;
|
|
3984
|
+
type FlowUpdateParams = RequestBody<Schemas$1["FlowUpdate"]>;
|
|
3985
|
+
interface FlowListParams {
|
|
3986
|
+
/** 1 to 100. Default 50. */
|
|
3987
|
+
limit?: number | undefined;
|
|
3988
|
+
}
|
|
3989
|
+
interface Flow {
|
|
3990
|
+
id: string;
|
|
3991
|
+
/** Same as `id`. */
|
|
3992
|
+
flow_id: string;
|
|
3993
|
+
name: string;
|
|
3994
|
+
language: string;
|
|
3995
|
+
/** Bumped by the server when the flow's content changes. */
|
|
3996
|
+
version: number | null;
|
|
3997
|
+
node_count: number;
|
|
3998
|
+
/** Epoch milliseconds. */
|
|
3999
|
+
created_timestamp: number | null;
|
|
4000
|
+
last_modification_timestamp: number | null;
|
|
4001
|
+
/** Left out of `list` entries; `retrieve` a flow for it. */
|
|
4002
|
+
flow_config?: FlowConfig;
|
|
4003
|
+
/** Present on `create` / `update` when the flow saved with warnings. */
|
|
4004
|
+
flow_validation?: {
|
|
4005
|
+
issues: ErrorIssue[];
|
|
4006
|
+
};
|
|
4007
|
+
}
|
|
4008
|
+
interface FlowDeleteResponse {
|
|
4009
|
+
deleted: true;
|
|
4010
|
+
id: string;
|
|
4011
|
+
}
|
|
4012
|
+
|
|
4013
|
+
/**
|
|
4014
|
+
* Conversation flows you save once and attach to agents.
|
|
4015
|
+
*
|
|
4016
|
+
* const flow = await dialgem.flows.create({ name: "Intake", flow_config })
|
|
4017
|
+
* await dialgem.agents.create({ name: "Front desk", agent_type: "flow", flow_id: flow.id })
|
|
4018
|
+
*
|
|
4019
|
+
* A flow is checked the way an agent's `flow_config` is, so a saved flow is one that would have saved on an
|
|
4020
|
+
* agent. **Attaching copies it**: `agents.create` / `agents.update` with `flow_id` takes a snapshot, and editing
|
|
4021
|
+
* or deleting the flow afterwards changes no agent, no published version and no call.
|
|
4022
|
+
*/
|
|
4023
|
+
declare class Flows extends APIResource {
|
|
4024
|
+
/** Validate and save a flow. `UnprocessableEntityError` (`errCode` `flow_invalid`) lists every problem. Not retried by default. */
|
|
4025
|
+
create(body: FlowCreateParams, options?: RequestOptions): Promise<Flow>;
|
|
4026
|
+
/** Flows, newest first. Await for one page, or iterate for every flow. Entries leave out `flow_config`. */
|
|
4027
|
+
list(params?: FlowListParams, options?: RequestOptions): PagePromise<Flow>;
|
|
4028
|
+
/** One flow with its `flow_config`. */
|
|
4029
|
+
retrieve(flowId: string, options?: RequestOptions): Promise<Flow>;
|
|
4030
|
+
/** Rename a flow and/or replace its `flow_config` (checked again). Agents it was attached to are not changed. */
|
|
4031
|
+
update(flowId: string, body: FlowUpdateParams, options?: RequestOptions): Promise<Flow>;
|
|
4032
|
+
/** Delete a saved flow. Agents it was attached to keep their copy. */
|
|
4033
|
+
delete(flowId: string, options?: RequestOptions): Promise<FlowDeleteResponse>;
|
|
4034
|
+
}
|
|
4035
|
+
|
|
4036
|
+
/**
|
|
4037
|
+
* Saved LLM settings. Request bodies come from the generated OpenAPI types; the response shape is written from
|
|
4038
|
+
* the API's own serializer (`llm_to_dict`).
|
|
4039
|
+
*/
|
|
4040
|
+
|
|
4041
|
+
type Schemas = components["schemas"];
|
|
4042
|
+
type LLMCreateParams = RequestBody<Schemas["LLMCreate"]>;
|
|
4043
|
+
type LLMUpdateParams = RequestBody<Schemas["LLMUpdate"]>;
|
|
4044
|
+
interface LLMListParams {
|
|
4045
|
+
/** 1 to 100. Default 50. */
|
|
4046
|
+
limit?: number | undefined;
|
|
4047
|
+
}
|
|
4048
|
+
interface LLM {
|
|
4049
|
+
id: string;
|
|
4050
|
+
/** Same as `id`. */
|
|
4051
|
+
llm_id: string;
|
|
4052
|
+
name: string;
|
|
4053
|
+
/** Epoch milliseconds. */
|
|
4054
|
+
created_timestamp: number | null;
|
|
4055
|
+
last_modification_timestamp: number | null;
|
|
4056
|
+
system_prompt: string;
|
|
4057
|
+
first_message: string | null;
|
|
4058
|
+
llm_provider: "anthropic" | "openai" | (string & {});
|
|
4059
|
+
llm_model: string;
|
|
4060
|
+
temperature: number;
|
|
4061
|
+
max_tokens: number;
|
|
4062
|
+
fallback_llm_provider: "anthropic" | "openai" | (string & {}) | null;
|
|
4063
|
+
fallback_llm_model: string | null;
|
|
4064
|
+
default_dynamic_variables: Record<string, string>;
|
|
4065
|
+
}
|
|
4066
|
+
interface LLMDeleteResponse {
|
|
4067
|
+
deleted: true;
|
|
4068
|
+
id: string;
|
|
4069
|
+
}
|
|
4070
|
+
|
|
4071
|
+
/**
|
|
4072
|
+
* A prompt and model you set up once and attach to agents.
|
|
4073
|
+
*
|
|
4074
|
+
* const llm = await dialgem.llms.create({ name: "Booking", system_prompt, llm_model: "gpt-4o-mini" })
|
|
4075
|
+
* await dialgem.agents.create({ name: "Front desk", llm_id: llm.id })
|
|
4076
|
+
*
|
|
4077
|
+
* It holds `system_prompt`, `first_message`, `llm_provider`, `llm_model`, `temperature`, `max_tokens`, the
|
|
4078
|
+
* fallback pair and `default_dynamic_variables`. **Attaching copies it**: `agents.create` / `agents.update` with
|
|
4079
|
+
* `llm_id` writes those values into the agent, and editing or deleting the saved LLM afterwards changes no
|
|
4080
|
+
* agent, no published version and no call. Sending `llm_id` together with any of those fields is refused.
|
|
4081
|
+
*/
|
|
4082
|
+
declare class LLMs extends APIResource {
|
|
4083
|
+
/** Save LLM settings. Anything left out takes the default a new agent gets. Not retried by default. */
|
|
4084
|
+
create(body: LLMCreateParams, options?: RequestOptions): Promise<LLM>;
|
|
4085
|
+
/** Saved LLMs, newest first. Await for one page, or iterate for every one. */
|
|
4086
|
+
list(params?: LLMListParams, options?: RequestOptions): PagePromise<LLM>;
|
|
4087
|
+
retrieve(llmId: string, options?: RequestOptions): Promise<LLM>;
|
|
4088
|
+
/** Change the fields you send. Agents it was attached to are not changed. */
|
|
4089
|
+
update(llmId: string, body: LLMUpdateParams, options?: RequestOptions): Promise<LLM>;
|
|
4090
|
+
/** Delete saved LLM settings. Agents they were attached to keep their copy. */
|
|
4091
|
+
delete(llmId: string, options?: RequestOptions): Promise<LLMDeleteResponse>;
|
|
4092
|
+
}
|
|
4093
|
+
|
|
2591
4094
|
/**
|
|
2592
4095
|
* Payloads Dialgem POSTs to an agent's `webhook_url`, for the events subscribed in
|
|
2593
4096
|
* `webhook_events`. Each carries the full call record; see the "Verify webhooks"
|
|
@@ -2596,7 +4099,7 @@ declare class PhoneNumbers extends APIResource {
|
|
|
2596
4099
|
* A failed delivery is retried up to three times, and every attempt carries the
|
|
2597
4100
|
* same `x-dialgem-delivery` id. Use it (or `event` + `call_id`) to drop duplicates.
|
|
2598
4101
|
*/
|
|
2599
|
-
type WebhookEvent = CallStartedEvent | CallEndedEvent | CallAnalyzedEvent;
|
|
4102
|
+
type WebhookEvent = CallStartedEvent | CallEndedEvent | CallAnalyzedEvent | TranscriptUpdatedEvent | TransferStartedEvent | TransferBridgedEvent | TransferCancelledEvent | TransferEndedEvent | ChatStartedEvent | ChatEndedEvent | ChatAnalyzedEvent;
|
|
2600
4103
|
interface CallEventBase {
|
|
2601
4104
|
call_id: string;
|
|
2602
4105
|
agent_id: string;
|
|
@@ -2614,6 +4117,77 @@ interface CallEndedEvent extends CallEventBase {
|
|
|
2614
4117
|
interface CallAnalyzedEvent extends CallEventBase {
|
|
2615
4118
|
event: "call_analyzed";
|
|
2616
4119
|
}
|
|
4120
|
+
interface ChatEventBase {
|
|
4121
|
+
chat_id: string;
|
|
4122
|
+
agent_id: string;
|
|
4123
|
+
/** The full chat record, with its messages, at the moment the event was sent. */
|
|
4124
|
+
chat: Chat;
|
|
4125
|
+
}
|
|
4126
|
+
/** A chat was started. Chat events carry `chat_id`, not `call_id`. */
|
|
4127
|
+
interface ChatStartedEvent extends ChatEventBase {
|
|
4128
|
+
event: "chat_started";
|
|
4129
|
+
}
|
|
4130
|
+
/** The chat ended (by `chats.end` or by the agent). Analysis follows in `chat_analyzed`. */
|
|
4131
|
+
interface ChatEndedEvent extends ChatEventBase {
|
|
4132
|
+
event: "chat_ended";
|
|
4133
|
+
}
|
|
4134
|
+
/** Sent once a chat's analysis has run. */
|
|
4135
|
+
interface ChatAnalyzedEvent extends ChatEventBase {
|
|
4136
|
+
event: "chat_analyzed";
|
|
4137
|
+
}
|
|
4138
|
+
/** A transcript turn as carried by `transcript_updated`. */
|
|
4139
|
+
interface WebhookTranscriptTurn {
|
|
4140
|
+
role: "user" | "agent";
|
|
4141
|
+
text: string;
|
|
4142
|
+
timestamp: string;
|
|
4143
|
+
start_ms?: number;
|
|
4144
|
+
}
|
|
4145
|
+
/**
|
|
4146
|
+
* Sent each time a caller or agent turn is added to the live transcript.
|
|
4147
|
+
*
|
|
4148
|
+
* `transcript` is the whole transcript so far, so a receiver that misses or
|
|
4149
|
+
* reorders a delivery still ends up correct. `turn_index` increases by one per
|
|
4150
|
+
* event within a call; keep the highest.
|
|
4151
|
+
*/
|
|
4152
|
+
interface TranscriptUpdatedEvent extends CallEventBase {
|
|
4153
|
+
event: "transcript_updated";
|
|
4154
|
+
/** Who spoke the turn that triggered this event. */
|
|
4155
|
+
role: "user" | "agent";
|
|
4156
|
+
turn_index: number;
|
|
4157
|
+
transcript: WebhookTranscriptTurn[];
|
|
4158
|
+
}
|
|
4159
|
+
/** What a transfer event says about the transfer. Fields are present only when known. */
|
|
4160
|
+
interface WebhookTransferInfo {
|
|
4161
|
+
/** The number the call is being transferred to. */
|
|
4162
|
+
target?: string;
|
|
4163
|
+
mode?: "cold" | "warm" | string;
|
|
4164
|
+
/** Why a transfer was cancelled: a carrier dial status (`busy`, `no-answer`, ...) or a failure reason. */
|
|
4165
|
+
reason?: string;
|
|
4166
|
+
}
|
|
4167
|
+
/** The agent asked for the call to be transferred. */
|
|
4168
|
+
interface TransferStartedEvent extends CallEventBase {
|
|
4169
|
+
event: "transfer_started";
|
|
4170
|
+
transfer: WebhookTransferInfo;
|
|
4171
|
+
}
|
|
4172
|
+
/**
|
|
4173
|
+
* The transferee answered and was connected to the caller. For a cold transfer
|
|
4174
|
+
* this is delivered when the transferred leg finishes, immediately followed by
|
|
4175
|
+
* `transfer_ended`.
|
|
4176
|
+
*/
|
|
4177
|
+
interface TransferBridgedEvent extends CallEventBase {
|
|
4178
|
+
event: "transfer_bridged";
|
|
4179
|
+
transfer: WebhookTransferInfo;
|
|
4180
|
+
}
|
|
4181
|
+
/** The transfer did not connect: busy, no answer, failed, or could not be placed. */
|
|
4182
|
+
interface TransferCancelledEvent extends CallEventBase {
|
|
4183
|
+
event: "transfer_cancelled";
|
|
4184
|
+
transfer: WebhookTransferInfo;
|
|
4185
|
+
}
|
|
4186
|
+
/** A connected transfer finished. */
|
|
4187
|
+
interface TransferEndedEvent extends CallEventBase {
|
|
4188
|
+
event: "transfer_ended";
|
|
4189
|
+
transfer: WebhookTransferInfo;
|
|
4190
|
+
}
|
|
2617
4191
|
/**
|
|
2618
4192
|
* The body Dialgem POSTs to a custom function's URL when the agent calls it,
|
|
2619
4193
|
* unless the function has `args_at_root`, in which case the body is `args` alone.
|
|
@@ -2640,6 +4214,12 @@ interface FunctionCallContext {
|
|
|
2640
4214
|
declare const WEBHOOK_SIGNATURE_HEADER = "x-dialgem-signature";
|
|
2641
4215
|
/** Header naming the event; the same value as the body's `event`. */
|
|
2642
4216
|
declare const WEBHOOK_EVENT_HEADER = "x-dialgem-event";
|
|
4217
|
+
/**
|
|
4218
|
+
* During a signing-secret rotation overlap, the same body signed with the PREVIOUS
|
|
4219
|
+
* secret. Verify `x-dialgem-signature` with the new secret; a receiver that has not
|
|
4220
|
+
* switched yet can verify this one with the old secret instead.
|
|
4221
|
+
*/
|
|
4222
|
+
declare const WEBHOOK_PREVIOUS_SIGNATURE_HEADER = "x-dialgem-signature-previous";
|
|
2643
4223
|
/** Header with an id that stays the same across retries of one delivery. */
|
|
2644
4224
|
declare const WEBHOOK_DELIVERY_HEADER = "x-dialgem-delivery";
|
|
2645
4225
|
/** Signatures older or newer than this are rejected, so a captured request cannot be replayed. */
|
|
@@ -2731,14 +4311,36 @@ declare class Dialgem {
|
|
|
2731
4311
|
readonly calls: Calls;
|
|
2732
4312
|
readonly phoneNumbers: PhoneNumbers;
|
|
2733
4313
|
readonly voices: Voices;
|
|
4314
|
+
/** Models available for post-call analysis. */
|
|
4315
|
+
readonly extractionModels: ExtractionModels;
|
|
2734
4316
|
readonly flowTemplates: FlowTemplates;
|
|
2735
4317
|
readonly promptTemplates: PromptTemplates;
|
|
4318
|
+
/** Calls in progress right now. */
|
|
4319
|
+
readonly sessions: Sessions;
|
|
4320
|
+
/** Text conversations with an agent. */
|
|
4321
|
+
readonly chats: Chats;
|
|
4322
|
+
readonly flows: Flows;
|
|
4323
|
+
readonly llms: LLMs;
|
|
4324
|
+
/** What this API key is and may do. */
|
|
4325
|
+
readonly apiKey: ApiKey;
|
|
4326
|
+
/**
|
|
4327
|
+
* Verify what Dialgem sends you: `dialgem.webhooks.constructEvent(rawBody, signatureHeader, secret)`.
|
|
4328
|
+
*/
|
|
2736
4329
|
readonly webhooks: Webhooks;
|
|
4330
|
+
/** The organization's webhook destinations: create, update, rotate the signing secret, test. */
|
|
4331
|
+
/** The people you call, with CSV import under `contacts.imports`. */
|
|
4332
|
+
readonly contacts: Contacts;
|
|
4333
|
+
/** Named groups of contacts. */
|
|
4334
|
+
readonly contactLists: ContactLists;
|
|
4335
|
+
/** Browser calls: tokens for `@dialgem/client`, and the origins allowed to start them. */
|
|
4336
|
+
readonly webCalls: WebCalls;
|
|
4337
|
+
/** Saved test conversations for an agent, run in text, with an optional publish gate. */
|
|
4338
|
+
readonly simulations: Simulations;
|
|
2737
4339
|
/** Always `https://api.dialgem.com`. */
|
|
2738
4340
|
readonly baseURL: string;
|
|
2739
4341
|
constructor(options?: ClientOptions);
|
|
2740
4342
|
}
|
|
2741
4343
|
|
|
2742
|
-
declare const VERSION = "0.1.0-beta.
|
|
4344
|
+
declare const VERSION = "0.1.0-beta.2";
|
|
2743
4345
|
|
|
2744
|
-
export { APIConnectionError, APIConnectionTimeoutError, APIError, APIUserAbortError, type Agent, type AgentCreateParams, type AgentDeleteResponse, type AgentFunction, AgentFunctions, AgentKnowledge, AgentMCPServers, type AgentType, type AgentUpdateParams, type AgentVersion, type AgentVersionConfig, type AgentVersionListParams, type AgentVersionListResponse, type AgentVersionMCPServer, type AgentVersionPublishParams, type AgentVersionRef, type AgentVersionSummary, AgentVersions, type AgentWeight, Agents, AuthenticationError, BASE_URL, BadRequestError, type Call, type CallAnalysis, type CallAnalyzedEvent, type CallCost, type CallCreatePhoneCallParams, type CallDeleteResponse, type CallEndedEvent, type CallLatency, type CallListParams, type CallRegisterParams, type CallRegisterResponse, type CallSessionStatus, type CallStartedEvent, type CallStatus, type CallStopResponse, type CallUpdateParams, Calls, type ClientOptions, ConflictError, DEFAULT_SIGNATURE_TOLERANCE_MS, Dialgem, DialgemError, type DisconnectionReason, type ErrorBody, type ErrorIssue, type Fetch, type FetchInit, type FetchResponse, type FlowConfig, type FlowTemplate, type FlowTemplateSummary, FlowTemplates, type FunctionCallContext, type FunctionCallRequest, type FunctionCreateParams, type FunctionKind, type FunctionReorderParams, type FunctionUpdateParams, type HeadersLike, InternalServerError, type KeyValuePair, type KnowledgeDocument, type KnowledgeDocumentCreateParams, type LatencyStats, type MCPServer, type MCPServerCreateParams, type MCPServerTestResult, type MCPServerUpdateParams, NotFoundError, Page, type PageData, PagePromise, PermissionDeniedError, type PhoneCallCreateResponse, type PhoneNumber, type PhoneNumberAgentWeight, type PhoneNumberAssignParams, type PhoneNumberCreateParams, type PhoneNumberUpdateParams, PhoneNumbers, type PostCallAnalysisVariable, type PromptState, type PromptTemplate, type PromptTemplateSummary, PromptTemplates, RateLimitError, type RequestBody, type RequestOptions, type SignatureHeader, type SipOutboundTrunkConfig, type TemplateListParams, type TranscriptTurn, UnprocessableEntityError, VERSION, type VerifyOptions, type Voice, type VoiceCloneFile, type VoiceCloneParams, type VoiceDeleteResponse, type VoiceListParams, Voices, WEBHOOK_DELIVERY_HEADER, WEBHOOK_EVENT_HEADER, WEBHOOK_SIGNATURE_HEADER, type WebhookEvent, type WebhookEventType, type WebhookPayload, WebhookVerificationError, Webhooks, webhooks };
|
|
4346
|
+
export { APIConnectionError, APIConnectionTimeoutError, APIError, APIUserAbortError, type Agent, type AgentCreateParams, type AgentDeleteResponse, type AgentFunction, AgentFunctions, AgentKnowledge, AgentMCPServers, type AgentSession, type AgentSessionList, type AgentSessionReleaseResult, type AgentSessionSayParams, type AgentSessionSayResult, type AgentSessionUpdateParams, type AgentSessionUpdateResult, type AgentType, type AgentUpdateParams, type AgentVersion, type AgentVersionConfig, type AgentVersionListParams, type AgentVersionListResponse, type AgentVersionMCPServer, type AgentVersionPublishParams, type AgentVersionRef, type AgentVersionSummary, AgentVersions, type AgentWeight, Agents, ApiKey, type ApiKeyDetails, type ApiKeyInfo, AuthenticationError, BASE_URL, BadRequestError, type Call, type CallAnalysis, type CallAnalyzedEvent, type CallCost, type CallCreatePhoneCallParams, type CallDeleteResponse, type CallEndedEvent, type CallLatency, type CallListParams, type CallRegisterParams, type CallRegisterResponse, type CallSessionStatus, type CallStartedEvent, type CallStatus, type CallStopResponse, type CallUpdateParams, Calls, type Chat, type ChatAnalyzedEvent, type ChatCreateParams, type ChatDeleteResponse, type ChatEndedEvent, type ChatListParams, type ChatMessage, type ChatReply, type ChatStartedEvent, type ChatUpdateParams, Chats, type ClientOptions, ConflictError, type Contact, type ContactCallList, type ContactCallSummary, type ContactCreateParams, type ContactCsvInspection, type ContactDeleteResponse, type ContactImport, type ContactImportCreateParams, type ContactImportErrorRow, type ContactImportErrors, type ContactImportList, type ContactImportStatus, ContactImports, type ContactListCreateParams, type ContactListDeleteResponse, type ContactListMemberRemoveResponse, type ContactListMembersAddResponse, type ContactListParams, type ContactListRecord, type ContactListUpdateParams, ContactLists, type ContactUpdateParams, Contacts, DEFAULT_SIGNATURE_TOLERANCE_MS, Dialgem, DialgemError, type DisconnectionReason, type ErrorBody, type ErrorIssue, type ExtractionModel, type ExtractionModelList, ExtractionModels, type Fetch, type FetchInit, type FetchResponse, type Flow, type FlowConfig, type FlowCreateParams, type FlowDeleteResponse, type FlowListParams, type FlowTemplate, type FlowTemplateSummary, FlowTemplates, type FlowUpdateParams, Flows, type FunctionCallContext, type FunctionCallRequest, type FunctionCreateParams, type FunctionKind, type FunctionReorderParams, type FunctionUpdateParams, type HeadersLike, type InboundWebhookTestResult, InternalServerError, type KeyValuePair, type KnowledgeDocument, type KnowledgeDocumentCreateParams, type LLM, type LLMCreateParams, type LLMDeleteResponse, type LLMListParams, type LLMUpdateParams, LLMs, type LatencyStats, type MCPServer, type MCPServerCreateParams, type MCPServerTestResult, type MCPServerUpdateParams, type MCPTool, type MCPToolList, NotFoundError, Page, type PageData, PagePromise, PermissionDeniedError, type PhoneCallCreateResponse, type PhoneNumber, type PhoneNumberAgentWeight, type PhoneNumberAssignParams, type PhoneNumberCreateParams, type PhoneNumberUpdateParams, PhoneNumbers, type PostCallAnalysisVariable, type PostCallBuiltinFields, type PromptState, type PromptTemplate, type PromptTemplateSummary, PromptTemplates, RateLimitError, type RequestBody, type RequestOptions, Sessions, type SignatureHeader, type SimulationCaller, type SimulationCase, type SimulationCaseInput, type SimulationCheck, type SimulationCheckResult, type SimulationPublishGate, type SimulationResult, type SimulationResultStatus, type SimulationRun, type SimulationRunCreateParams, type SimulationRunDetail, type SimulationRunList, type SimulationRunStatus, type SimulationSuite, type SimulationSuiteCreateParams, type SimulationSuiteDetail, type SimulationSuiteList, type SimulationSuiteUpdateParams, Simulations, type SipOutboundTrunkConfig, type TemplateListParams, type TranscriptTurn, UnprocessableEntityError, VERSION, type VerifyOptions, type Voice, type VoiceCloneFile, type VoiceCloneParams, type VoiceDeleteResponse, type VoiceListParams, Voices, WEBHOOK_DELIVERY_HEADER, WEBHOOK_EVENT_HEADER, WEBHOOK_PREVIOUS_SIGNATURE_HEADER, WEBHOOK_SIGNATURE_HEADER, type WebCall, type WebCallCreateParams, type WebCallSettings, type WebCallSettingsUpdateParams, WebCalls, type WebhookEvent, type WebhookEventType, type WebhookPayload, WebhookVerificationError, Webhooks, webhooks };
|