@dialgem/sdk 0.1.0-beta.1 → 0.1.0-beta.3
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 +23 -1
- package/README.md +89 -10
- package/dist/index.cjs +505 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1713 -48
- package/dist/index.d.ts +1713 -48
- package/dist/index.js +505 -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,36 @@ 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
|
+
};
|
|
736
|
+
/** BuyNumberRequest */
|
|
737
|
+
BuyNumberRequest: {
|
|
738
|
+
/** Nickname */
|
|
739
|
+
nickname?: string | null;
|
|
740
|
+
/** Phone Number */
|
|
741
|
+
phone_number: string;
|
|
742
|
+
/**
|
|
743
|
+
* Type
|
|
744
|
+
* @default local
|
|
745
|
+
*/
|
|
746
|
+
type?: string;
|
|
747
|
+
};
|
|
626
748
|
/** CallPatch */
|
|
627
749
|
CallPatch: {
|
|
628
750
|
/** Amd Result */
|
|
@@ -633,6 +755,8 @@ interface components {
|
|
|
633
755
|
call_sid?: string | null;
|
|
634
756
|
/** Disconnection Reason */
|
|
635
757
|
disconnection_reason?: string | null;
|
|
758
|
+
/** Disconnection Reason Default */
|
|
759
|
+
disconnection_reason_default?: string | null;
|
|
636
760
|
/** Duration S */
|
|
637
761
|
duration_s?: number | null;
|
|
638
762
|
/** Ended At */
|
|
@@ -656,6 +780,204 @@ interface components {
|
|
|
656
780
|
/** Transcript */
|
|
657
781
|
transcript?: unknown[] | null;
|
|
658
782
|
};
|
|
783
|
+
/** CaseBody */
|
|
784
|
+
CaseBody: {
|
|
785
|
+
/** Caller */
|
|
786
|
+
caller: {
|
|
787
|
+
[key: string]: unknown;
|
|
788
|
+
};
|
|
789
|
+
/** Checks */
|
|
790
|
+
checks: {
|
|
791
|
+
[key: string]: unknown;
|
|
792
|
+
}[];
|
|
793
|
+
/** Dynamic Variables */
|
|
794
|
+
dynamic_variables?: {
|
|
795
|
+
[key: string]: unknown;
|
|
796
|
+
};
|
|
797
|
+
/** Name */
|
|
798
|
+
name: string;
|
|
799
|
+
/** Tool Mocks */
|
|
800
|
+
tool_mocks?: {
|
|
801
|
+
[key: string]: unknown;
|
|
802
|
+
};
|
|
803
|
+
};
|
|
804
|
+
/** CaseUpdate */
|
|
805
|
+
CaseUpdate: {
|
|
806
|
+
/** Caller */
|
|
807
|
+
caller?: {
|
|
808
|
+
[key: string]: unknown;
|
|
809
|
+
} | null;
|
|
810
|
+
/** Checks */
|
|
811
|
+
checks?: {
|
|
812
|
+
[key: string]: unknown;
|
|
813
|
+
}[] | null;
|
|
814
|
+
/** Dynamic Variables */
|
|
815
|
+
dynamic_variables?: {
|
|
816
|
+
[key: string]: unknown;
|
|
817
|
+
} | null;
|
|
818
|
+
/** Name */
|
|
819
|
+
name?: string | null;
|
|
820
|
+
/** Tool Mocks */
|
|
821
|
+
tool_mocks?: {
|
|
822
|
+
[key: string]: unknown;
|
|
823
|
+
} | null;
|
|
824
|
+
};
|
|
825
|
+
/** ChatCreate */
|
|
826
|
+
ChatCreate: {
|
|
827
|
+
/** Agent Id */
|
|
828
|
+
agent_id: string;
|
|
829
|
+
/** Agent Version */
|
|
830
|
+
agent_version?: number | null;
|
|
831
|
+
/** Dynamic Variables */
|
|
832
|
+
dynamic_variables?: {
|
|
833
|
+
[key: string]: unknown;
|
|
834
|
+
} | null;
|
|
835
|
+
/** Metadata */
|
|
836
|
+
metadata?: {
|
|
837
|
+
[key: string]: unknown;
|
|
838
|
+
} | null;
|
|
839
|
+
};
|
|
840
|
+
/** ChatMessageCreate */
|
|
841
|
+
ChatMessageCreate: {
|
|
842
|
+
/** Content */
|
|
843
|
+
content: string;
|
|
844
|
+
};
|
|
845
|
+
/** ChatUpdate */
|
|
846
|
+
ChatUpdate: {
|
|
847
|
+
/** Metadata */
|
|
848
|
+
metadata?: {
|
|
849
|
+
[key: string]: unknown;
|
|
850
|
+
} | null;
|
|
851
|
+
};
|
|
852
|
+
/** CodeNode */
|
|
853
|
+
CodeNode: {
|
|
854
|
+
/** Code */
|
|
855
|
+
code?: string | null;
|
|
856
|
+
display_position?: components["schemas"]["DisplayPosition"] | null;
|
|
857
|
+
/** Edges */
|
|
858
|
+
edges?: components["schemas"]["Edge"][];
|
|
859
|
+
else_edge?: components["schemas"]["Edge"] | null;
|
|
860
|
+
/** Enable Typing Sound */
|
|
861
|
+
enable_typing_sound?: boolean | null;
|
|
862
|
+
/** Execution Status Variable */
|
|
863
|
+
execution_status_variable?: string | null;
|
|
864
|
+
/** Finetune Transition Examples */
|
|
865
|
+
finetune_transition_examples?: unknown[] | null;
|
|
866
|
+
global_node_setting?: components["schemas"]["GlobalNodeSetting"] | null;
|
|
867
|
+
/** Id */
|
|
868
|
+
id: string;
|
|
869
|
+
instruction?: components["schemas"]["Instruction"] | null;
|
|
870
|
+
/** Name */
|
|
871
|
+
name?: string | null;
|
|
872
|
+
/** Response Variables */
|
|
873
|
+
response_variables?: {
|
|
874
|
+
[key: string]: string;
|
|
875
|
+
} | null;
|
|
876
|
+
/** Speak During Execution */
|
|
877
|
+
speak_during_execution?: boolean | null;
|
|
878
|
+
/** Timeout Ms */
|
|
879
|
+
timeout_ms?: number | null;
|
|
880
|
+
/**
|
|
881
|
+
* Type
|
|
882
|
+
* @constant
|
|
883
|
+
*/
|
|
884
|
+
type: "code";
|
|
885
|
+
/** Wait For Result */
|
|
886
|
+
wait_for_result?: boolean | null;
|
|
887
|
+
} & {
|
|
888
|
+
[key: string]: unknown;
|
|
889
|
+
};
|
|
890
|
+
/** ContactCreate */
|
|
891
|
+
ContactCreate: {
|
|
892
|
+
/** Attributes */
|
|
893
|
+
attributes?: {
|
|
894
|
+
[key: string]: unknown;
|
|
895
|
+
};
|
|
896
|
+
/** Default Country */
|
|
897
|
+
default_country?: string | null;
|
|
898
|
+
/** Email */
|
|
899
|
+
email?: string | null;
|
|
900
|
+
/** First Name */
|
|
901
|
+
first_name?: string | null;
|
|
902
|
+
/** Last Name */
|
|
903
|
+
last_name?: string | null;
|
|
904
|
+
/** List Ids */
|
|
905
|
+
list_ids?: string[];
|
|
906
|
+
/** Phone */
|
|
907
|
+
phone: string;
|
|
908
|
+
/** Timezone */
|
|
909
|
+
timezone?: string | null;
|
|
910
|
+
};
|
|
911
|
+
/** ContactCsvInspectRequest */
|
|
912
|
+
ContactCsvInspectRequest: {
|
|
913
|
+
/** Csv */
|
|
914
|
+
csv: string;
|
|
915
|
+
};
|
|
916
|
+
/** ContactImportCreate */
|
|
917
|
+
ContactImportCreate: {
|
|
918
|
+
/** Attribute Columns */
|
|
919
|
+
attribute_columns?: string[] | null;
|
|
920
|
+
/** Csv */
|
|
921
|
+
csv: string;
|
|
922
|
+
/** Default Country */
|
|
923
|
+
default_country?: string | null;
|
|
924
|
+
/**
|
|
925
|
+
* Dry Run
|
|
926
|
+
* @default false
|
|
927
|
+
*/
|
|
928
|
+
dry_run?: boolean;
|
|
929
|
+
/** Filename */
|
|
930
|
+
filename?: string | null;
|
|
931
|
+
/** List Id */
|
|
932
|
+
list_id?: string | null;
|
|
933
|
+
/** Mapping */
|
|
934
|
+
mapping?: {
|
|
935
|
+
[key: string]: string;
|
|
936
|
+
} | null;
|
|
937
|
+
/**
|
|
938
|
+
* On Duplicate
|
|
939
|
+
* @default update
|
|
940
|
+
*/
|
|
941
|
+
on_duplicate?: string;
|
|
942
|
+
};
|
|
943
|
+
/** ContactListCreate */
|
|
944
|
+
ContactListCreate: {
|
|
945
|
+
/** Description */
|
|
946
|
+
description?: string | null;
|
|
947
|
+
/** Name */
|
|
948
|
+
name: string;
|
|
949
|
+
};
|
|
950
|
+
/** ContactListMembersAdd */
|
|
951
|
+
ContactListMembersAdd: {
|
|
952
|
+
/** Contact Ids */
|
|
953
|
+
contact_ids: string[];
|
|
954
|
+
};
|
|
955
|
+
/** ContactListUpdate */
|
|
956
|
+
ContactListUpdate: {
|
|
957
|
+
/** Description */
|
|
958
|
+
description?: string | null;
|
|
959
|
+
/** Name */
|
|
960
|
+
name?: string | null;
|
|
961
|
+
};
|
|
962
|
+
/** ContactUpdate */
|
|
963
|
+
ContactUpdate: {
|
|
964
|
+
/** Attributes */
|
|
965
|
+
attributes?: {
|
|
966
|
+
[key: string]: unknown;
|
|
967
|
+
} | null;
|
|
968
|
+
/** Default Country */
|
|
969
|
+
default_country?: string | null;
|
|
970
|
+
/** Email */
|
|
971
|
+
email?: string | null;
|
|
972
|
+
/** First Name */
|
|
973
|
+
first_name?: string | null;
|
|
974
|
+
/** Last Name */
|
|
975
|
+
last_name?: string | null;
|
|
976
|
+
/** Phone */
|
|
977
|
+
phone?: string | null;
|
|
978
|
+
/** Timezone */
|
|
979
|
+
timezone?: string | null;
|
|
980
|
+
};
|
|
659
981
|
/** ConversationNode */
|
|
660
982
|
ConversationNode: {
|
|
661
983
|
/** Allow Dtmf Interruption */
|
|
@@ -850,7 +1172,7 @@ interface components {
|
|
|
850
1172
|
/** Model Temperature */
|
|
851
1173
|
model_temperature?: number | null;
|
|
852
1174
|
/** 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"])[];
|
|
1175
|
+
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
1176
|
/** Notes */
|
|
855
1177
|
notes?: unknown[] | null;
|
|
856
1178
|
/** Start Node Id */
|
|
@@ -866,6 +1188,17 @@ interface components {
|
|
|
866
1188
|
} & {
|
|
867
1189
|
[key: string]: unknown;
|
|
868
1190
|
};
|
|
1191
|
+
/** FlowCreate */
|
|
1192
|
+
FlowCreate: {
|
|
1193
|
+
flow_config: components["schemas"]["FlowConfig"];
|
|
1194
|
+
/**
|
|
1195
|
+
* Language
|
|
1196
|
+
* @default en
|
|
1197
|
+
*/
|
|
1198
|
+
language?: string;
|
|
1199
|
+
/** Name */
|
|
1200
|
+
name: string;
|
|
1201
|
+
};
|
|
869
1202
|
/** FlowTool */
|
|
870
1203
|
FlowTool: {
|
|
871
1204
|
/** Description */
|
|
@@ -897,6 +1230,14 @@ interface components {
|
|
|
897
1230
|
} & {
|
|
898
1231
|
[key: string]: unknown;
|
|
899
1232
|
};
|
|
1233
|
+
/** FlowUpdate */
|
|
1234
|
+
FlowUpdate: {
|
|
1235
|
+
flow_config?: components["schemas"]["FlowConfig"] | null;
|
|
1236
|
+
/** Language */
|
|
1237
|
+
language?: string | null;
|
|
1238
|
+
/** Name */
|
|
1239
|
+
name?: string | null;
|
|
1240
|
+
};
|
|
900
1241
|
/** FunctionCreate */
|
|
901
1242
|
FunctionCreate: {
|
|
902
1243
|
/**
|
|
@@ -920,7 +1261,7 @@ interface components {
|
|
|
920
1261
|
* @default custom
|
|
921
1262
|
* @enum {string}
|
|
922
1263
|
*/
|
|
923
|
-
kind?: "custom" | "end_call" | "transfer_call" | "press_digit" | "agent_swap" | "check_availability_cal" | "book_appointment_cal";
|
|
1264
|
+
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
1265
|
/**
|
|
925
1266
|
* Method
|
|
926
1267
|
* @default POST
|
|
@@ -981,7 +1322,7 @@ interface components {
|
|
|
981
1322
|
* @default custom
|
|
982
1323
|
* @enum {string}
|
|
983
1324
|
*/
|
|
984
|
-
kind?: "custom" | "check_availability_cal" | "book_appointment_cal" | "end_call" | "transfer_call" | "press_digit" | "agent_swap";
|
|
1325
|
+
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
1326
|
/**
|
|
986
1327
|
* Method
|
|
987
1328
|
* @default POST
|
|
@@ -1158,6 +1499,56 @@ interface components {
|
|
|
1158
1499
|
/** Value */
|
|
1159
1500
|
value: string;
|
|
1160
1501
|
};
|
|
1502
|
+
/** LLMCreate */
|
|
1503
|
+
LLMCreate: {
|
|
1504
|
+
/** Default Dynamic Variables */
|
|
1505
|
+
default_dynamic_variables?: {
|
|
1506
|
+
[key: string]: string;
|
|
1507
|
+
} | null;
|
|
1508
|
+
/** Fallback Llm Model */
|
|
1509
|
+
fallback_llm_model?: string | null;
|
|
1510
|
+
/** Fallback Llm Provider */
|
|
1511
|
+
fallback_llm_provider?: ("anthropic" | "openai") | null;
|
|
1512
|
+
/** First Message */
|
|
1513
|
+
first_message?: string | null;
|
|
1514
|
+
/** Llm Model */
|
|
1515
|
+
llm_model?: string | null;
|
|
1516
|
+
/** Llm Provider */
|
|
1517
|
+
llm_provider?: ("anthropic" | "openai") | null;
|
|
1518
|
+
/** Max Tokens */
|
|
1519
|
+
max_tokens?: number | null;
|
|
1520
|
+
/** Name */
|
|
1521
|
+
name: string;
|
|
1522
|
+
/** System Prompt */
|
|
1523
|
+
system_prompt?: string | null;
|
|
1524
|
+
/** Temperature */
|
|
1525
|
+
temperature?: number | null;
|
|
1526
|
+
};
|
|
1527
|
+
/** LLMUpdate */
|
|
1528
|
+
LLMUpdate: {
|
|
1529
|
+
/** Default Dynamic Variables */
|
|
1530
|
+
default_dynamic_variables?: {
|
|
1531
|
+
[key: string]: string;
|
|
1532
|
+
} | null;
|
|
1533
|
+
/** Fallback Llm Model */
|
|
1534
|
+
fallback_llm_model?: string | null;
|
|
1535
|
+
/** Fallback Llm Provider */
|
|
1536
|
+
fallback_llm_provider?: ("anthropic" | "openai") | null;
|
|
1537
|
+
/** First Message */
|
|
1538
|
+
first_message?: string | null;
|
|
1539
|
+
/** Llm Model */
|
|
1540
|
+
llm_model?: string | null;
|
|
1541
|
+
/** Llm Provider */
|
|
1542
|
+
llm_provider?: ("anthropic" | "openai") | null;
|
|
1543
|
+
/** Max Tokens */
|
|
1544
|
+
max_tokens?: number | null;
|
|
1545
|
+
/** Name */
|
|
1546
|
+
name?: string | null;
|
|
1547
|
+
/** System Prompt */
|
|
1548
|
+
system_prompt?: string | null;
|
|
1549
|
+
/** Temperature */
|
|
1550
|
+
temperature?: number | null;
|
|
1551
|
+
};
|
|
1161
1552
|
/** McpNode */
|
|
1162
1553
|
McpNode: {
|
|
1163
1554
|
display_position?: components["schemas"]["DisplayPosition"] | null;
|
|
@@ -1318,6 +1709,8 @@ interface components {
|
|
|
1318
1709
|
inbound_agent_version?: number | "latest_published";
|
|
1319
1710
|
/** Inbound Agents */
|
|
1320
1711
|
inbound_agents?: components["schemas"]["AgentWeightIn"][] | null;
|
|
1712
|
+
/** Inbound Webhook Url */
|
|
1713
|
+
inbound_webhook_url?: string | null;
|
|
1321
1714
|
/** Nickname */
|
|
1322
1715
|
nickname?: string | null;
|
|
1323
1716
|
/** Number */
|
|
@@ -1359,6 +1752,8 @@ interface components {
|
|
|
1359
1752
|
inbound_agent_version?: number | "latest_published" | null;
|
|
1360
1753
|
/** Inbound Agents */
|
|
1361
1754
|
inbound_agents?: components["schemas"]["AgentWeightIn"][] | null;
|
|
1755
|
+
/** Inbound Webhook Url */
|
|
1756
|
+
inbound_webhook_url?: string | null;
|
|
1362
1757
|
/** Nickname */
|
|
1363
1758
|
nickname?: string | null;
|
|
1364
1759
|
/** Outbound Agent Id */
|
|
@@ -1529,13 +1924,20 @@ interface components {
|
|
|
1529
1924
|
};
|
|
1530
1925
|
/** PronunciationEntry */
|
|
1531
1926
|
PronunciationEntry: {
|
|
1532
|
-
/**
|
|
1533
|
-
|
|
1927
|
+
/**
|
|
1928
|
+
* Alias
|
|
1929
|
+
* @default
|
|
1930
|
+
*/
|
|
1931
|
+
alias?: string;
|
|
1932
|
+
/** Alphabet */
|
|
1933
|
+
alphabet?: ("ipa" | "cmu") | null;
|
|
1534
1934
|
/**
|
|
1535
1935
|
* Case Sensitive
|
|
1536
1936
|
* @default false
|
|
1537
1937
|
*/
|
|
1538
1938
|
case_sensitive?: boolean;
|
|
1939
|
+
/** Phoneme */
|
|
1940
|
+
phoneme?: string | null;
|
|
1539
1941
|
/** Word */
|
|
1540
1942
|
word: string;
|
|
1541
1943
|
};
|
|
@@ -1577,6 +1979,40 @@ interface components {
|
|
|
1577
1979
|
/** Stream Url */
|
|
1578
1980
|
stream_url: string;
|
|
1579
1981
|
};
|
|
1982
|
+
/** RunCreate */
|
|
1983
|
+
RunCreate: {
|
|
1984
|
+
/**
|
|
1985
|
+
* Agent Version
|
|
1986
|
+
* @default 0
|
|
1987
|
+
*/
|
|
1988
|
+
agent_version?: unknown;
|
|
1989
|
+
/**
|
|
1990
|
+
* Fresh
|
|
1991
|
+
* @default false
|
|
1992
|
+
*/
|
|
1993
|
+
fresh?: boolean;
|
|
1994
|
+
/** Max Model Turns */
|
|
1995
|
+
max_model_turns?: number | null;
|
|
1996
|
+
};
|
|
1997
|
+
/** SessionSay */
|
|
1998
|
+
SessionSay: {
|
|
1999
|
+
/**
|
|
2000
|
+
* Interrupt
|
|
2001
|
+
* @default false
|
|
2002
|
+
*/
|
|
2003
|
+
interrupt?: boolean;
|
|
2004
|
+
/** Text */
|
|
2005
|
+
text: string;
|
|
2006
|
+
};
|
|
2007
|
+
/** SessionUpdate */
|
|
2008
|
+
SessionUpdate: {
|
|
2009
|
+
/** Dynamic Variables */
|
|
2010
|
+
dynamic_variables?: {
|
|
2011
|
+
[key: string]: unknown;
|
|
2012
|
+
} | null;
|
|
2013
|
+
/** System Prompt */
|
|
2014
|
+
system_prompt?: string | null;
|
|
2015
|
+
};
|
|
1580
2016
|
/** SipOutboundTrunkConfigIn */
|
|
1581
2017
|
SipOutboundTrunkConfigIn: {
|
|
1582
2018
|
/** Auth Password */
|
|
@@ -1676,6 +2112,29 @@ interface components {
|
|
|
1676
2112
|
} & {
|
|
1677
2113
|
[key: string]: unknown;
|
|
1678
2114
|
};
|
|
2115
|
+
/** SuiteCreate */
|
|
2116
|
+
SuiteCreate: {
|
|
2117
|
+
/** Agent Id */
|
|
2118
|
+
agent_id: string;
|
|
2119
|
+
/** Description */
|
|
2120
|
+
description?: string | null;
|
|
2121
|
+
/** Name */
|
|
2122
|
+
name: string;
|
|
2123
|
+
/**
|
|
2124
|
+
* Publish Gate
|
|
2125
|
+
* @default off
|
|
2126
|
+
*/
|
|
2127
|
+
publish_gate?: string;
|
|
2128
|
+
};
|
|
2129
|
+
/** SuiteUpdate */
|
|
2130
|
+
SuiteUpdate: {
|
|
2131
|
+
/** Description */
|
|
2132
|
+
description?: string | null;
|
|
2133
|
+
/** Name */
|
|
2134
|
+
name?: string | null;
|
|
2135
|
+
/** Publish Gate */
|
|
2136
|
+
publish_gate?: string | null;
|
|
2137
|
+
};
|
|
1679
2138
|
/** TransferAgent */
|
|
1680
2139
|
TransferAgent: {
|
|
1681
2140
|
/** Agent Id */
|
|
@@ -1758,7 +2217,7 @@ interface components {
|
|
|
1758
2217
|
/** Digit Limit */
|
|
1759
2218
|
digit_limit?: number | null;
|
|
1760
2219
|
/** Termination Key */
|
|
1761
|
-
termination_key?: ("#" | "*") | null;
|
|
2220
|
+
termination_key?: ("0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "#" | "*") | null;
|
|
1762
2221
|
/**
|
|
1763
2222
|
* Timeout Ms
|
|
1764
2223
|
* @default 2500
|
|
@@ -1778,21 +2237,44 @@ interface components {
|
|
|
1778
2237
|
/** Error Type */
|
|
1779
2238
|
type: string;
|
|
1780
2239
|
};
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
2240
|
+
/** WebCallRequest */
|
|
2241
|
+
WebCallRequest: {
|
|
2242
|
+
/** Agent Id */
|
|
2243
|
+
agent_id: string;
|
|
2244
|
+
/**
|
|
2245
|
+
* Agent Version
|
|
2246
|
+
* @default 0
|
|
2247
|
+
*/
|
|
2248
|
+
agent_version?: number | "latest_published";
|
|
2249
|
+
/** Dialgem Llm Dynamic Variables */
|
|
2250
|
+
dialgem_llm_dynamic_variables?: {
|
|
2251
|
+
[key: string]: unknown;
|
|
2252
|
+
} | null;
|
|
2253
|
+
/** Metadata */
|
|
2254
|
+
metadata?: {
|
|
2255
|
+
[key: string]: unknown;
|
|
2256
|
+
} | null;
|
|
2257
|
+
};
|
|
2258
|
+
/** WebCallSettings */
|
|
2259
|
+
WebCallSettings: {
|
|
2260
|
+
/** Allowed Origins */
|
|
2261
|
+
allowed_origins: string[];
|
|
2262
|
+
};
|
|
2263
|
+
};
|
|
2264
|
+
responses: never;
|
|
2265
|
+
parameters: never;
|
|
2266
|
+
requestBodies: never;
|
|
2267
|
+
headers: never;
|
|
2268
|
+
pathItems: never;
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2271
|
+
/**
|
|
2272
|
+
* Request-body types, aliased from the generated OpenAPI types so they track the
|
|
2273
|
+
* API's own schema exactly. Field names are the API's own
|
|
1792
2274
|
* (snake_case); the SDK sends bodies as-is.
|
|
1793
2275
|
*/
|
|
1794
2276
|
|
|
1795
|
-
type Schemas = components["schemas"];
|
|
2277
|
+
type Schemas$5 = components["schemas"];
|
|
1796
2278
|
/**
|
|
1797
2279
|
* Adds `| undefined` to the optional top-level fields of a request body, so
|
|
1798
2280
|
* callers compiling with `exactOptionalPropertyTypes` can write
|
|
@@ -1802,34 +2284,50 @@ type Schemas = components["schemas"];
|
|
|
1802
2284
|
type RequestBody<T> = {
|
|
1803
2285
|
[K in keyof T]: {} extends Pick<T, K> ? T[K] | undefined : T[K];
|
|
1804
2286
|
};
|
|
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"]>;
|
|
2287
|
+
type AgentCreateParams = RequestBody<Schemas$5["AgentCreate"]>;
|
|
2288
|
+
type AgentUpdateParams = RequestBody<Schemas$5["AgentUpdate"]>;
|
|
2289
|
+
type FunctionCreateParams = RequestBody<Schemas$5["FunctionCreate"]>;
|
|
2290
|
+
type FunctionUpdateParams = RequestBody<Schemas$5["FunctionUpdate"]>;
|
|
2291
|
+
type FunctionReorderParams = RequestBody<Schemas$5["FunctionReorder"]>;
|
|
2292
|
+
type KnowledgeDocumentCreateParams = RequestBody<Schemas$5["DocumentCreate"]>;
|
|
2293
|
+
type MCPServerCreateParams = RequestBody<Schemas$5["MCPServerCreate"]>;
|
|
2294
|
+
type MCPServerUpdateParams = RequestBody<Schemas$5["MCPServerUpdate"]>;
|
|
2295
|
+
type PhoneNumberCreateParams = RequestBody<Schemas$5["PhoneNumberCreate"]>;
|
|
2296
|
+
type PhoneNumberUpdateParams = RequestBody<Schemas$5["PhoneNumberUpdate"]>;
|
|
2297
|
+
type PhoneNumberAssignParams = RequestBody<Schemas$5["PhoneNumberAssign"]>;
|
|
2298
|
+
type PhoneNumberBuyParams = RequestBody<Schemas$5["BuyNumberRequest"]>;
|
|
2299
|
+
/** Filters for `phoneNumbers.search`. */
|
|
2300
|
+
interface PhoneNumberSearchParams {
|
|
2301
|
+
/** Two-letter country code. Default `"US"`. */
|
|
2302
|
+
country?: string;
|
|
2303
|
+
/** `"local"` (default) or `"toll_free"`. */
|
|
2304
|
+
type?: string;
|
|
2305
|
+
/** Three digits. Local numbers only. */
|
|
2306
|
+
area_code?: string;
|
|
2307
|
+
/** Digits (and `*`) the number must contain. */
|
|
2308
|
+
contains?: string;
|
|
2309
|
+
/** 1 to 50. Default 20. */
|
|
2310
|
+
limit?: number;
|
|
2311
|
+
}
|
|
1816
2312
|
/**
|
|
1817
2313
|
* `from_`, with the trailing underscore, is the wire name (`from` is a Python
|
|
1818
2314
|
* keyword on the server). It must be a number registered on your organization.
|
|
1819
2315
|
*/
|
|
1820
|
-
type CallCreatePhoneCallParams = RequestBody<Schemas["OutboundCallRequest"]>;
|
|
1821
|
-
type CallRegisterParams = RequestBody<Schemas["RegisterCallRequest"]>;
|
|
2316
|
+
type CallCreatePhoneCallParams = RequestBody<Schemas$5["OutboundCallRequest"]>;
|
|
2317
|
+
type CallRegisterParams = RequestBody<Schemas$5["RegisterCallRequest"]>;
|
|
1822
2318
|
/** A conversation-flow definition (`agent_type: "flow"`). */
|
|
1823
|
-
type FlowConfig = Schemas["FlowConfig"];
|
|
2319
|
+
type FlowConfig = Schemas$5["FlowConfig"];
|
|
1824
2320
|
/** One state of a `multi_prompt` agent. */
|
|
1825
|
-
type PromptState = Schemas["PromptState"];
|
|
2321
|
+
type PromptState = Schemas$5["PromptState"];
|
|
1826
2322
|
/** A field extracted from the transcript after the call ends. */
|
|
1827
|
-
type PostCallAnalysisVariable = Schemas["PostCallAnalysisVariable"];
|
|
1828
|
-
|
|
1829
|
-
type
|
|
1830
|
-
type
|
|
1831
|
-
type
|
|
1832
|
-
type
|
|
2323
|
+
type PostCallAnalysisVariable = Schemas$5["PostCallAnalysisVariable"];
|
|
2324
|
+
/** Settings for `call_summary`, `call_successful` and `user_sentiment`. */
|
|
2325
|
+
type PostCallBuiltinFields = Schemas$5["BuiltinAnalysisFields"];
|
|
2326
|
+
type KeyValuePair = Schemas$5["KVPair"];
|
|
2327
|
+
type AgentWeight = Schemas$5["AgentWeightIn"];
|
|
2328
|
+
type AgentType = NonNullable<Schemas$5["AgentCreate"]["agent_type"]>;
|
|
2329
|
+
type WebhookEventType = NonNullable<Schemas$5["AgentCreate"]["webhook_events"]>[number];
|
|
2330
|
+
type FunctionKind = NonNullable<Schemas$5["FunctionCreate"]["kind"]>;
|
|
1833
2331
|
|
|
1834
2332
|
/**
|
|
1835
2333
|
* An agent, as returned by `GET /v1/agents/{id}` and the create/update calls.
|
|
@@ -1857,6 +2355,11 @@ interface Agent {
|
|
|
1857
2355
|
/** Fallback values for `{{variables}}` not supplied by the call. */
|
|
1858
2356
|
default_dynamic_variables: Record<string, string>;
|
|
1859
2357
|
responsiveness: number;
|
|
2358
|
+
/**
|
|
2359
|
+
* Wait a little longer (up to 1.5 s) when the caller sounds unfinished: a
|
|
2360
|
+
* trailing "and", a comma, a half-read number. Off by default.
|
|
2361
|
+
*/
|
|
2362
|
+
adaptive_response_wait: boolean;
|
|
1860
2363
|
interruption_sensitivity: number;
|
|
1861
2364
|
enable_backchannel: boolean;
|
|
1862
2365
|
backchannel_frequency: number;
|
|
@@ -1870,7 +2373,22 @@ interface Agent {
|
|
|
1870
2373
|
language: string;
|
|
1871
2374
|
enable_transcription_formatting: boolean;
|
|
1872
2375
|
boosted_keywords: string[];
|
|
2376
|
+
/**
|
|
2377
|
+
* `noise-and-background-speech-cancellation` is a stronger setting of the same
|
|
2378
|
+
* stationary-noise filter, scaled by `denoising_strength`; it does not isolate
|
|
2379
|
+
* the caller from other voices.
|
|
2380
|
+
*/
|
|
1873
2381
|
denoising_mode: NonNullable<AgentCreateParams["denoising_mode"]>;
|
|
2382
|
+
/** 0-1. Only read by `noise-and-background-speech-cancellation`. */
|
|
2383
|
+
denoising_strength: number;
|
|
2384
|
+
/**
|
|
2385
|
+
* `fast` uses Deepgram; `accurate` uses AssemblyAI when the server has it
|
|
2386
|
+
* configured (English only) and falls back to Deepgram otherwise. Only
|
|
2387
|
+
* applies when `stt_model` is `deepgram`.
|
|
2388
|
+
*/
|
|
2389
|
+
stt_mode: NonNullable<AgentCreateParams["stt_mode"]>;
|
|
2390
|
+
/** `medical` uses Deepgram's medical model (English only), in either `stt_mode`. */
|
|
2391
|
+
vocab_specialization: NonNullable<AgentCreateParams["vocab_specialization"]>;
|
|
1874
2392
|
begin_message_delay_ms: number;
|
|
1875
2393
|
end_call_after_silence_ms: number;
|
|
1876
2394
|
max_call_duration_ms: number;
|
|
@@ -1878,8 +2396,27 @@ interface Agent {
|
|
|
1878
2396
|
voicemail_detection_enabled: boolean;
|
|
1879
2397
|
voicemail_action: NonNullable<AgentCreateParams["voicemail_action"]>;
|
|
1880
2398
|
voicemail_message: string;
|
|
2399
|
+
/** When set, the voicemail is written by the LLM from this instruction (outbound calls). */
|
|
2400
|
+
voicemail_prompt: string;
|
|
2401
|
+
/** Hang up when an automated phone menu is detected (outbound calls). */
|
|
2402
|
+
ivr_hangup_enabled: boolean;
|
|
2403
|
+
/** How the agent should handle a menu when `ivr_hangup_enabled` is off. */
|
|
2404
|
+
ivr_prompt: string;
|
|
2405
|
+
/** Say `call_screen_message` once to a phone's call-screening assistant (outbound calls). */
|
|
2406
|
+
call_screen_handling_enabled: boolean;
|
|
2407
|
+
call_screen_message: string;
|
|
2408
|
+
/**
|
|
2409
|
+
* Offer the agent a do-not-call tool: a contact who asks to stop being called is
|
|
2410
|
+
* added to the organization's do-not-call list and the call ends.
|
|
2411
|
+
*/
|
|
2412
|
+
dnc_detection_enabled: boolean;
|
|
1881
2413
|
post_call_analysis_data: PostCallAnalysisVariable[];
|
|
1882
2414
|
post_call_analysis_model: string;
|
|
2415
|
+
/**
|
|
2416
|
+
* Settings for the always-on analysis fields. A missing key means defaults;
|
|
2417
|
+
* `{ enabled: false }` stops that field being extracted (it is stored null).
|
|
2418
|
+
*/
|
|
2419
|
+
post_call_builtin_fields: PostCallBuiltinFields;
|
|
1883
2420
|
fallback_llm_provider: string | null;
|
|
1884
2421
|
fallback_llm_model: string | null;
|
|
1885
2422
|
fallback_voice_id: string | null;
|
|
@@ -1895,6 +2432,8 @@ interface Agent {
|
|
|
1895
2432
|
*/
|
|
1896
2433
|
webhook_signing_secret: string | null;
|
|
1897
2434
|
has_webhook_signing_secret: boolean;
|
|
2435
|
+
/** How long, in ms, a receiver gets to answer one delivery attempt. 1000–30000, default 10000. */
|
|
2436
|
+
webhook_timeout_ms: number;
|
|
1898
2437
|
/** ISO 8601, no timezone suffix (UTC). */
|
|
1899
2438
|
created_at: string | null;
|
|
1900
2439
|
call_count: number;
|
|
@@ -1969,6 +2508,18 @@ interface MCPServer {
|
|
|
1969
2508
|
last_status: MCPServerTestResult | null;
|
|
1970
2509
|
created_at: string | null;
|
|
1971
2510
|
}
|
|
2511
|
+
/** One tool an MCP server offers. */
|
|
2512
|
+
interface MCPTool {
|
|
2513
|
+
name: string;
|
|
2514
|
+
description: string;
|
|
2515
|
+
/** JSON Schema for the tool's arguments. */
|
|
2516
|
+
input_schema: Record<string, unknown>;
|
|
2517
|
+
}
|
|
2518
|
+
/** What `mcpServers.listTools` returns. When the server is unreachable `tools` is empty and `error` says why. */
|
|
2519
|
+
interface MCPToolList {
|
|
2520
|
+
tools: MCPTool[];
|
|
2521
|
+
error: string | null;
|
|
2522
|
+
}
|
|
1972
2523
|
interface MCPServerTestResult {
|
|
1973
2524
|
ok: boolean;
|
|
1974
2525
|
/** Tool names the server advertised. */
|
|
@@ -2116,6 +2667,11 @@ declare class AgentMCPServers extends APIResource {
|
|
|
2116
2667
|
update(agentId: string, serverId: string, body: MCPServerUpdateParams, options?: RequestOptions): Promise<MCPServer>;
|
|
2117
2668
|
delete(agentId: string, serverId: string, options?: RequestOptions): Promise<void>;
|
|
2118
2669
|
/** Connect to the server now, list its tools, and store the result as `last_status`. */
|
|
2670
|
+
/**
|
|
2671
|
+
* What the server offers right now, with each tool's description and argument schema. Connects live like
|
|
2672
|
+
* `test`, but stores nothing. An unreachable server is not an error: `tools` is empty and `error` says why.
|
|
2673
|
+
*/
|
|
2674
|
+
listTools(agentId: string, serverId: string, options?: RequestOptions): Promise<MCPToolList>;
|
|
2119
2675
|
test(agentId: string, serverId: string, options?: RequestOptions): Promise<MCPServerTestResult>;
|
|
2120
2676
|
}
|
|
2121
2677
|
|
|
@@ -2333,6 +2889,18 @@ declare class Calls extends APIResource {
|
|
|
2333
2889
|
* recording. A call still in progress is refused with `ConflictError`; stop it first.
|
|
2334
2890
|
*/
|
|
2335
2891
|
delete(callId: string, options?: RequestOptions): Promise<CallDeleteResponse>;
|
|
2892
|
+
/**
|
|
2893
|
+
* Run a finished call's post-call analysis again, with the agent's *current* analysis
|
|
2894
|
+
* settings, and return the updated call. Use it after changing the fields or the model
|
|
2895
|
+
* and wanting an older call read the new way.
|
|
2896
|
+
*
|
|
2897
|
+
* It replaces `analysis`; it does not bill the call again and does not send `call_analyzed`
|
|
2898
|
+
* again, so read the result from this response or from `retrieve`. The model call can take
|
|
2899
|
+
* a while. `ConflictError` with `errCode` `call_in_progress` until the call has ended,
|
|
2900
|
+
* `no_transcript` when there is nothing to analyze, `agent_deleted` if the agent is gone.
|
|
2901
|
+
* Not retried by default.
|
|
2902
|
+
*/
|
|
2903
|
+
rerunAnalysis(callId: string, options?: RequestOptions): Promise<Call>;
|
|
2336
2904
|
/**
|
|
2337
2905
|
* End an ongoing call now, as if the agent had hung up. The call becomes
|
|
2338
2906
|
* `completed` with `disconnection_reason: "manual_stopped"` a moment later, and
|
|
@@ -2381,6 +2949,23 @@ interface Voice {
|
|
|
2381
2949
|
created_at: string | null;
|
|
2382
2950
|
updated_at: string | null;
|
|
2383
2951
|
}
|
|
2952
|
+
/** A model usable for an agent's post-call analysis (`post_call_analysis_model`). */
|
|
2953
|
+
interface ExtractionModel {
|
|
2954
|
+
/** Put this in `post_call_analysis_model`. */
|
|
2955
|
+
id: string;
|
|
2956
|
+
provider: "anthropic" | "openai";
|
|
2957
|
+
label: string;
|
|
2958
|
+
/**
|
|
2959
|
+
* Estimated USD for one typical extraction, derived from list prices. For
|
|
2960
|
+
* comparing models; not a metered charge.
|
|
2961
|
+
*/
|
|
2962
|
+
est_cost_per_session: number;
|
|
2963
|
+
}
|
|
2964
|
+
interface ExtractionModelList {
|
|
2965
|
+
/** The model an agent gets when none is set. */
|
|
2966
|
+
default: string;
|
|
2967
|
+
models: ExtractionModel[];
|
|
2968
|
+
}
|
|
2384
2969
|
/** One audio sample for cloning. `Blob` and `File` both satisfy this. */
|
|
2385
2970
|
type VoiceCloneFile = Blob | {
|
|
2386
2971
|
name?: string;
|
|
@@ -2496,6 +3081,10 @@ declare class Voices extends APIResource {
|
|
|
2496
3081
|
*/
|
|
2497
3082
|
delete(voiceId: string, options?: RequestOptions): Promise<VoiceDeleteResponse>;
|
|
2498
3083
|
}
|
|
3084
|
+
declare class ExtractionModels extends APIResource {
|
|
3085
|
+
/** Models an agent may use for post-call analysis, with an estimated cost per session. */
|
|
3086
|
+
list(options?: RequestOptions): Promise<ExtractionModelList>;
|
|
3087
|
+
}
|
|
2499
3088
|
declare class FlowTemplates extends APIResource {
|
|
2500
3089
|
/** Built-in conversation-flow templates (summaries, without `flow_config`). */
|
|
2501
3090
|
list(params?: TemplateListParams, options?: RequestOptions): Promise<FlowTemplateSummary[]>;
|
|
@@ -2507,6 +3096,667 @@ declare class PromptTemplates extends APIResource {
|
|
|
2507
3096
|
retrieve(templateId: string, options?: RequestOptions): Promise<PromptTemplate>;
|
|
2508
3097
|
}
|
|
2509
3098
|
|
|
3099
|
+
/** What an API key was granted. The secret is never returned. */
|
|
3100
|
+
interface ApiKeyDetails {
|
|
3101
|
+
id: string;
|
|
3102
|
+
name: string;
|
|
3103
|
+
/** The start of the key, to recognise it by. */
|
|
3104
|
+
prefix: string;
|
|
3105
|
+
/** True when the key has no scopes and can do everything. */
|
|
3106
|
+
full_access: boolean;
|
|
3107
|
+
/** For example `["calls:write", "agents:read"]`; `null` for a full-access key. */
|
|
3108
|
+
scopes: string[] | null;
|
|
3109
|
+
/** IP addresses or CIDR ranges the key may be used from; `null` for anywhere. */
|
|
3110
|
+
allowed_ips: string[] | null;
|
|
3111
|
+
expires_at: string | null;
|
|
3112
|
+
expired: boolean;
|
|
3113
|
+
last_used_at: string | null;
|
|
3114
|
+
created_at: string | null;
|
|
3115
|
+
revoked_at: string | null;
|
|
3116
|
+
}
|
|
3117
|
+
interface ApiKeyInfo {
|
|
3118
|
+
auth: "api_key" | "session" | "service" | (string & {});
|
|
3119
|
+
/** Your organization's slug. */
|
|
3120
|
+
organization: string;
|
|
3121
|
+
role: string;
|
|
3122
|
+
/** The key being used; `null` when the request was not made with an organization API key. */
|
|
3123
|
+
key: ApiKeyDetails | null;
|
|
3124
|
+
}
|
|
3125
|
+
|
|
3126
|
+
/**
|
|
3127
|
+
* A call in progress right now, as the service holds it in memory.
|
|
3128
|
+
*
|
|
3129
|
+
* This is live state, not a record: a finished call is a `Call`, reachable
|
|
3130
|
+
* through `calls.retrieve`. The shape of a session is not a stable contract
|
|
3131
|
+
* beyond the fields below, so it is deliberately open.
|
|
3132
|
+
*/
|
|
3133
|
+
interface AgentSession {
|
|
3134
|
+
session_id: string;
|
|
3135
|
+
agent_id: string;
|
|
3136
|
+
status: "active" | "ended" | (string & {});
|
|
3137
|
+
/** ISO 8601. */
|
|
3138
|
+
started_at?: string;
|
|
3139
|
+
[key: string]: unknown;
|
|
3140
|
+
}
|
|
3141
|
+
|
|
3142
|
+
type AgentSessionUpdateParams = RequestBody<components["schemas"]["SessionUpdate"]>;
|
|
3143
|
+
type AgentSessionSayParams = RequestBody<components["schemas"]["SessionSay"]>;
|
|
3144
|
+
/** What `sessions.say` returns: the line plays behind the call's audio, so this answers at once. */
|
|
3145
|
+
interface AgentSessionSayResult {
|
|
3146
|
+
status: "speaking";
|
|
3147
|
+
}
|
|
3148
|
+
/** What `sessions.release` returns. */
|
|
3149
|
+
interface AgentSessionReleaseResult {
|
|
3150
|
+
/** `not_taken_over` when nobody had the call. */
|
|
3151
|
+
status: "handed_back" | "not_taken_over";
|
|
3152
|
+
reason?: string;
|
|
3153
|
+
}
|
|
3154
|
+
/** What `sessions.update` returns. */
|
|
3155
|
+
interface AgentSessionUpdateResult {
|
|
3156
|
+
session_id: string;
|
|
3157
|
+
status: "active" | (string & {});
|
|
3158
|
+
/** Which of `system_prompt` and `dynamic_variables` were changed. */
|
|
3159
|
+
updated: Array<"system_prompt" | "dynamic_variables">;
|
|
3160
|
+
applies_from: "next_turn";
|
|
3161
|
+
}
|
|
3162
|
+
interface AgentSessionList {
|
|
3163
|
+
sessions: AgentSession[];
|
|
3164
|
+
/** How many are live. This is what "how busy am I right now?" asks for. */
|
|
3165
|
+
count: number;
|
|
3166
|
+
}
|
|
3167
|
+
|
|
3168
|
+
declare class ApiKey extends APIResource {
|
|
3169
|
+
/**
|
|
3170
|
+
* Who this key is: your organization and the key's name, prefix, scopes, allowed addresses
|
|
3171
|
+
* and expiry. It answers for any valid key whatever its scopes, so an integration can check
|
|
3172
|
+
* what it was given. Never returns the secret.
|
|
3173
|
+
*
|
|
3174
|
+
* ```ts
|
|
3175
|
+
* const { key } = await dialgem.apiKey.retrieve()
|
|
3176
|
+
* if (key && !key.full_access) console.log("scoped to", key.scopes)
|
|
3177
|
+
* ```
|
|
3178
|
+
*/
|
|
3179
|
+
retrieve(options?: RequestOptions): Promise<ApiKeyInfo>;
|
|
3180
|
+
}
|
|
3181
|
+
declare class Sessions extends APIResource {
|
|
3182
|
+
/**
|
|
3183
|
+
* The calls your organization has in progress right now, with a `count`.
|
|
3184
|
+
*
|
|
3185
|
+
* Live state read from the service's own registry — use it for a
|
|
3186
|
+
* concurrency check before placing a call. For finished calls use
|
|
3187
|
+
* `calls.list`; a call whose teardown never arrived is not counted here.
|
|
3188
|
+
*/
|
|
3189
|
+
list(options?: RequestOptions): Promise<AgentSessionList>;
|
|
3190
|
+
/**
|
|
3191
|
+
* Change a live call's prompt and/or variables. It applies from the agent's **next turn**.
|
|
3192
|
+
*
|
|
3193
|
+
* `sessionId` is a session's `session_id` from `list`, or the call's own `call_id`. Only this call changes:
|
|
3194
|
+
* the agent, its published versions and other calls are untouched, and the change is gone when the call ends.
|
|
3195
|
+
* A turn already being spoken finishes as it was. `dynamic_variables` are merged over the call's variables;
|
|
3196
|
+
* `system_prompt` replaces the prompt for the rest of the call.
|
|
3197
|
+
*
|
|
3198
|
+
* The call may be on any service instance. `NotFoundError` if it is not live (or is another organization's),
|
|
3199
|
+
* `ConflictError` with `errCode` `session_ended` once it is over, `UnprocessableEntityError` with `errCode`
|
|
3200
|
+
* `flow_agent_prompt` for a flow agent's prompt (its variables can still change). Not retried by default.
|
|
3201
|
+
*
|
|
3202
|
+
* ```ts
|
|
3203
|
+
* await dialgem.sessions.update(callId, { dynamic_variables: { plan: "pro" } })
|
|
3204
|
+
* ```
|
|
3205
|
+
*/
|
|
3206
|
+
update(sessionId: string, body: AgentSessionUpdateParams, options?: RequestOptions): Promise<AgentSessionUpdateResult>;
|
|
3207
|
+
/**
|
|
3208
|
+
* Make the agent say `text` on a live call, in its own voice. Answers at once; the line plays behind what the
|
|
3209
|
+
* agent is saying, or now with `interrupt: true`. The agent's conversation records it as something it said.
|
|
3210
|
+
*
|
|
3211
|
+
* Off unless the deployment enables live control: `ForbiddenError` with `errCode` `live_control_disabled`.
|
|
3212
|
+
* `ConflictError` `human_has_call` while a human has taken the call. Owners, admins and API keys only.
|
|
3213
|
+
* Not retried by default.
|
|
3214
|
+
*
|
|
3215
|
+
* ```ts
|
|
3216
|
+
* await dialgem.sessions.say(callId, { text: "One moment while I check that." })
|
|
3217
|
+
* ```
|
|
3218
|
+
*/
|
|
3219
|
+
say(sessionId: string, body: AgentSessionSayParams, options?: RequestOptions): Promise<AgentSessionSayResult>;
|
|
3220
|
+
/**
|
|
3221
|
+
* Hand a taken-over call back to the agent, for when the socket that took it is gone. The agent is told a
|
|
3222
|
+
* human had the call and that it did not hear what was said. Same availability and limits as `say`.
|
|
3223
|
+
* Listening in and taking over run over a WebSocket (`/v1/agent/sessions/{id}/live`), which this SDK does not wrap.
|
|
3224
|
+
*/
|
|
3225
|
+
release(sessionId: string, options?: RequestOptions): Promise<AgentSessionReleaseResult>;
|
|
3226
|
+
}
|
|
3227
|
+
|
|
3228
|
+
/**
|
|
3229
|
+
* Agent simulations: saved conversations that a simulated caller has with your agent, in text,
|
|
3230
|
+
* checked afterwards. Nothing is dialled, recorded or billed, and the agent's tools are never really called.
|
|
3231
|
+
*
|
|
3232
|
+
* The API accepts free-form objects for the caller, tool answers and checks, so they are typed here.
|
|
3233
|
+
*/
|
|
3234
|
+
/** What publishing a version of the agent does when the draft has not passed the suite. */
|
|
3235
|
+
type SimulationPublishGate = "off" | "warn" | "block";
|
|
3236
|
+
type SimulationCaller = {
|
|
3237
|
+
mode: "script";
|
|
3238
|
+
/** What the caller says, one line per turn (up to 20). */
|
|
3239
|
+
turns: string[];
|
|
3240
|
+
} | {
|
|
3241
|
+
mode: "persona";
|
|
3242
|
+
/** Who the caller is. A model plays them. */
|
|
3243
|
+
persona: string;
|
|
3244
|
+
/** What they want from the call. */
|
|
3245
|
+
goal?: string | undefined;
|
|
3246
|
+
/** Longest the conversation runs, in exchanges (1 to 12, default 6). */
|
|
3247
|
+
max_turns?: number | undefined;
|
|
3248
|
+
};
|
|
3249
|
+
interface CheckBase {
|
|
3250
|
+
/** Names the check in the results. */
|
|
3251
|
+
label?: string | undefined;
|
|
3252
|
+
}
|
|
3253
|
+
type SimulationCheck = (CheckBase & {
|
|
3254
|
+
type: "contains" | "not_contains";
|
|
3255
|
+
text: string;
|
|
3256
|
+
who?: "agent" | "caller" | "any" | undefined;
|
|
3257
|
+
}) | (CheckBase & {
|
|
3258
|
+
type: "tool_called";
|
|
3259
|
+
name: string;
|
|
3260
|
+
args?: Record<string, unknown> | undefined;
|
|
3261
|
+
}) | (CheckBase & {
|
|
3262
|
+
type: "tool_not_called";
|
|
3263
|
+
name: string;
|
|
3264
|
+
}) | (CheckBase & {
|
|
3265
|
+
type: "variable_equals";
|
|
3266
|
+
name: string;
|
|
3267
|
+
value: string;
|
|
3268
|
+
}) | (CheckBase & {
|
|
3269
|
+
type: "node_reached";
|
|
3270
|
+
node_id: string;
|
|
3271
|
+
}) | (CheckBase & {
|
|
3272
|
+
type: "ended";
|
|
3273
|
+
value?: boolean | undefined;
|
|
3274
|
+
}) | (CheckBase & {
|
|
3275
|
+
type: "rubric";
|
|
3276
|
+
criteria: string;
|
|
3277
|
+
});
|
|
3278
|
+
interface SimulationCaseInput {
|
|
3279
|
+
name: string;
|
|
3280
|
+
caller: SimulationCaller;
|
|
3281
|
+
/** Fills `{{placeholders}}` in the agent's prompt and first message. */
|
|
3282
|
+
dynamic_variables?: Record<string, string | number> | undefined;
|
|
3283
|
+
/** What each tool answers. A tool without an entry answers `{"status": "ok"}`. */
|
|
3284
|
+
tool_mocks?: Record<string, unknown> | undefined;
|
|
3285
|
+
/** At least one. The case passes when all of them hold. */
|
|
3286
|
+
checks: SimulationCheck[];
|
|
3287
|
+
}
|
|
3288
|
+
interface SimulationSuiteCreateParams {
|
|
3289
|
+
agent_id: string;
|
|
3290
|
+
name: string;
|
|
3291
|
+
description?: string | null | undefined;
|
|
3292
|
+
publish_gate?: SimulationPublishGate | undefined;
|
|
3293
|
+
}
|
|
3294
|
+
interface SimulationSuiteUpdateParams {
|
|
3295
|
+
name?: string | undefined;
|
|
3296
|
+
description?: string | null | undefined;
|
|
3297
|
+
publish_gate?: SimulationPublishGate | undefined;
|
|
3298
|
+
}
|
|
3299
|
+
interface SimulationRunCreateParams {
|
|
3300
|
+
/** `0` is the draft you are editing (the default), or a published version, or `"latest_published"`. */
|
|
3301
|
+
agent_version?: number | "latest_published" | undefined;
|
|
3302
|
+
/** Run every case again even if an identical one already ran against this exact agent. */
|
|
3303
|
+
fresh?: boolean | undefined;
|
|
3304
|
+
/** Spend at most this many model turns. When used up the remaining cases are skipped. */
|
|
3305
|
+
max_model_turns?: number | undefined;
|
|
3306
|
+
}
|
|
3307
|
+
interface SimulationCase extends Required<Pick<SimulationCaseInput, "name" | "caller" | "checks">> {
|
|
3308
|
+
id: string;
|
|
3309
|
+
suite_id: string;
|
|
3310
|
+
position: number;
|
|
3311
|
+
dynamic_variables: Record<string, string>;
|
|
3312
|
+
tool_mocks: Record<string, unknown>;
|
|
3313
|
+
created_at: string | null;
|
|
3314
|
+
updated_at: string | null;
|
|
3315
|
+
}
|
|
3316
|
+
type SimulationRunStatus = "queued" | "running" | "completed" | "cancelled" | "failed";
|
|
3317
|
+
interface SimulationRun {
|
|
3318
|
+
id: string;
|
|
3319
|
+
suite_id: string;
|
|
3320
|
+
agent_id: string;
|
|
3321
|
+
/** The version that was tested; `0` is the draft. */
|
|
3322
|
+
agent_version: number;
|
|
3323
|
+
status: SimulationRunStatus;
|
|
3324
|
+
trigger: string;
|
|
3325
|
+
fresh: boolean;
|
|
3326
|
+
total: number;
|
|
3327
|
+
passed: number;
|
|
3328
|
+
failed: number;
|
|
3329
|
+
/** The model or the case broke; this says nothing about your agent. */
|
|
3330
|
+
errored: number;
|
|
3331
|
+
/** Cancelled, or the run ran out of model turns. */
|
|
3332
|
+
skipped: number;
|
|
3333
|
+
model_turn_budget: number;
|
|
3334
|
+
model_turns_used: number;
|
|
3335
|
+
budget_exhausted: boolean;
|
|
3336
|
+
created_at: string | null;
|
|
3337
|
+
started_at: string | null;
|
|
3338
|
+
finished_at: string | null;
|
|
3339
|
+
}
|
|
3340
|
+
type SimulationResultStatus = "pending" | "passed" | "failed" | "errored" | "skipped";
|
|
3341
|
+
interface SimulationCheckResult {
|
|
3342
|
+
/** Position in the case's `checks`. */
|
|
3343
|
+
index: number;
|
|
3344
|
+
type: SimulationCheck["type"];
|
|
3345
|
+
label?: string | undefined;
|
|
3346
|
+
passed: boolean;
|
|
3347
|
+
detail: string;
|
|
3348
|
+
}
|
|
3349
|
+
interface SimulationResult {
|
|
3350
|
+
id: string;
|
|
3351
|
+
case_id: string | null;
|
|
3352
|
+
case_name: string;
|
|
3353
|
+
position: number;
|
|
3354
|
+
status: SimulationResultStatus;
|
|
3355
|
+
/** Why it failed, errored or was skipped. */
|
|
3356
|
+
reason: string | null;
|
|
3357
|
+
/** Taken from an earlier identical run rather than run again. */
|
|
3358
|
+
cached: boolean;
|
|
3359
|
+
transcript: {
|
|
3360
|
+
role: "caller" | "agent";
|
|
3361
|
+
text: string;
|
|
3362
|
+
node_id?: string | undefined;
|
|
3363
|
+
}[];
|
|
3364
|
+
tool_calls: {
|
|
3365
|
+
name: string;
|
|
3366
|
+
input: Record<string, unknown>;
|
|
3367
|
+
result: string;
|
|
3368
|
+
}[];
|
|
3369
|
+
/** A flow agent's variables at the end. */
|
|
3370
|
+
variables: Record<string, unknown>;
|
|
3371
|
+
checks: SimulationCheckResult[];
|
|
3372
|
+
model_turns: number;
|
|
3373
|
+
duration_ms: number;
|
|
3374
|
+
finished_at: string | null;
|
|
3375
|
+
}
|
|
3376
|
+
interface SimulationRunDetail extends SimulationRun {
|
|
3377
|
+
results: SimulationResult[];
|
|
3378
|
+
}
|
|
3379
|
+
interface SimulationSuite {
|
|
3380
|
+
id: string;
|
|
3381
|
+
agent_id: string;
|
|
3382
|
+
name: string;
|
|
3383
|
+
description: string | null;
|
|
3384
|
+
publish_gate: SimulationPublishGate;
|
|
3385
|
+
case_count: number;
|
|
3386
|
+
latest_run: SimulationRun | null;
|
|
3387
|
+
created_at: string | null;
|
|
3388
|
+
updated_at: string | null;
|
|
3389
|
+
}
|
|
3390
|
+
interface SimulationSuiteDetail extends SimulationSuite {
|
|
3391
|
+
cases: SimulationCase[];
|
|
3392
|
+
}
|
|
3393
|
+
interface SimulationSuiteList {
|
|
3394
|
+
/** Whether simulations are switched on for the platform. */
|
|
3395
|
+
enabled: boolean;
|
|
3396
|
+
suites: SimulationSuite[];
|
|
3397
|
+
}
|
|
3398
|
+
interface SimulationRunList {
|
|
3399
|
+
runs: SimulationRun[];
|
|
3400
|
+
}
|
|
3401
|
+
|
|
3402
|
+
/**
|
|
3403
|
+
* Test your agent before a change reaches a caller. A **suite** holds **cases**; in each, a simulated caller
|
|
3404
|
+
* talks to the agent in text and your **checks** decide whether it passed.
|
|
3405
|
+
*
|
|
3406
|
+
* A simulation is not a call: nothing is dialled, recorded or billed, and the agent's tools are never really
|
|
3407
|
+
* called. Simulations spend model usage, so they are switched on per platform; until then every method answers
|
|
3408
|
+
* 403 `simulations_disabled`.
|
|
3409
|
+
*
|
|
3410
|
+
* const suite = await dialgem.simulations.createSuite({ agent_id, name: "Refunds" })
|
|
3411
|
+
* await dialgem.simulations.createCase(suite.id, {
|
|
3412
|
+
* name: "Asks for a refund",
|
|
3413
|
+
* caller: { mode: "script", turns: ["I want my money back."] },
|
|
3414
|
+
* checks: [{ type: "not_contains", text: "full refund" }],
|
|
3415
|
+
* })
|
|
3416
|
+
* const run = await dialgem.simulations.run(suite.id)
|
|
3417
|
+
* // poll retrieveRun(run.id) until status is "completed"
|
|
3418
|
+
*/
|
|
3419
|
+
declare class Simulations extends APIResource {
|
|
3420
|
+
/** Make a suite for one of your agents. */
|
|
3421
|
+
createSuite(body: SimulationSuiteCreateParams, options?: RequestOptions): Promise<SimulationSuite>;
|
|
3422
|
+
/** Your suites, newest first, each with its latest run. Pass `agent_id` for one agent's. */
|
|
3423
|
+
listSuites(params?: {
|
|
3424
|
+
agent_id?: string;
|
|
3425
|
+
}, options?: RequestOptions): Promise<SimulationSuiteList>;
|
|
3426
|
+
/** One suite with its cases. */
|
|
3427
|
+
retrieveSuite(suiteId: string, options?: RequestOptions): Promise<SimulationSuiteDetail>;
|
|
3428
|
+
/**
|
|
3429
|
+
* Rename a suite or set its publish gate: `off`, `warn` (publishing a version succeeds and lists the suites the draft
|
|
3430
|
+
* has not passed) or `block` (publishing is refused with 409 `simulation_required` until it has).
|
|
3431
|
+
*/
|
|
3432
|
+
updateSuite(suiteId: string, body: SimulationSuiteUpdateParams, options?: RequestOptions): Promise<SimulationSuite>;
|
|
3433
|
+
/** Delete a suite and its cases. Past runs are deleted with it. */
|
|
3434
|
+
deleteSuite(suiteId: string, options?: RequestOptions): Promise<void>;
|
|
3435
|
+
/** Add a case (up to 50 per suite). 422 `invalid_case` says what to fix. */
|
|
3436
|
+
createCase(suiteId: string, body: SimulationCaseInput, options?: RequestOptions): Promise<SimulationCase>;
|
|
3437
|
+
/** Change a case. Fields you leave out keep their value. */
|
|
3438
|
+
updateCase(caseId: string, body: Partial<SimulationCaseInput>, options?: RequestOptions): Promise<SimulationCase>;
|
|
3439
|
+
deleteCase(caseId: string, options?: RequestOptions): Promise<void>;
|
|
3440
|
+
/**
|
|
3441
|
+
* Run every case of a suite against the draft, a published version or `"latest_published"`. Answers at once
|
|
3442
|
+
* (`202`); the run happens in the background, so poll `retrieveRun` until `status` is `completed`.
|
|
3443
|
+
*
|
|
3444
|
+
* 409 `suite_empty`, 422 `agent_type_not_supported` (multi-prompt agents), 429 `too_many_runs` or
|
|
3445
|
+
* `daily_run_limit`.
|
|
3446
|
+
*/
|
|
3447
|
+
run(suiteId: string, body?: SimulationRunCreateParams, options?: RequestOptions): Promise<SimulationRun>;
|
|
3448
|
+
/** Runs, newest first. Pass `suite_id` for one suite's. */
|
|
3449
|
+
listRuns(params?: {
|
|
3450
|
+
suite_id?: string;
|
|
3451
|
+
limit?: number;
|
|
3452
|
+
}, options?: RequestOptions): Promise<SimulationRunList>;
|
|
3453
|
+
/** A run with every case's transcript, tool calls and check results. */
|
|
3454
|
+
retrieveRun(runId: string, options?: RequestOptions): Promise<SimulationRunDetail>;
|
|
3455
|
+
/** Stop a run that has not finished. Cases already under way finish; the rest are skipped. */
|
|
3456
|
+
cancelRun(runId: string, options?: RequestOptions): Promise<SimulationRun>;
|
|
3457
|
+
}
|
|
3458
|
+
|
|
3459
|
+
/**
|
|
3460
|
+
* Browser calls. Request bodies come from the generated OpenAPI types (see `params.ts`); the response
|
|
3461
|
+
* shapes are written from the API's own serializers.
|
|
3462
|
+
*/
|
|
3463
|
+
|
|
3464
|
+
type Schemas$4 = components["schemas"];
|
|
3465
|
+
type WebCallCreateParams = RequestBody<Schemas$4["WebCallRequest"]>;
|
|
3466
|
+
type WebCallSettingsUpdateParams = RequestBody<Schemas$4["WebCallSettings"]>;
|
|
3467
|
+
/** What `webCalls.create` returns. Hand `access_token` to the page; keep your API key on the server. */
|
|
3468
|
+
interface WebCall {
|
|
3469
|
+
/** The call's id. The call record exists from now, with status `queued` until the browser connects. */
|
|
3470
|
+
call_id: string;
|
|
3471
|
+
agent_id: string;
|
|
3472
|
+
/** The published version this call will run (0 is the live draft). */
|
|
3473
|
+
agent_version: number;
|
|
3474
|
+
/**
|
|
3475
|
+
* A one-use credential for exactly this call and agent. It cannot be used for anything else, and it works
|
|
3476
|
+
* from the origins you have allowed, once.
|
|
3477
|
+
*/
|
|
3478
|
+
access_token: string;
|
|
3479
|
+
/** ISO 8601, UTC. 60 seconds after creation: long enough to reach the page, not to be stockpiled. */
|
|
3480
|
+
expires_at: string;
|
|
3481
|
+
expires_in: number;
|
|
3482
|
+
}
|
|
3483
|
+
interface WebCallSettings {
|
|
3484
|
+
/** The websites (origins, like `https://app.example.com`) browser calls may start from. Empty means none. */
|
|
3485
|
+
allowed_origins: string[];
|
|
3486
|
+
/** True when the list contains `*`: any website may start a call with a token it was given. */
|
|
3487
|
+
any_origin: boolean;
|
|
3488
|
+
limits: {
|
|
3489
|
+
/** Browser calls that can be live at once, per organization. */
|
|
3490
|
+
max_concurrent_calls: number;
|
|
3491
|
+
/** Calls that can be created per minute, per organization. */
|
|
3492
|
+
tokens_per_minute: number;
|
|
3493
|
+
token_ttl_s: number;
|
|
3494
|
+
};
|
|
3495
|
+
}
|
|
3496
|
+
|
|
3497
|
+
/**
|
|
3498
|
+
* Let a visitor talk to one of your agents from a web page, with `@dialgem/client`.
|
|
3499
|
+
*
|
|
3500
|
+
* Your **backend** calls `create` with your API key and gives the returned `access_token` to the page; the
|
|
3501
|
+
* page connects with that token alone. The key never reaches the browser. Before the first call, allow the
|
|
3502
|
+
* page's origin with `updateSettings`.
|
|
3503
|
+
*/
|
|
3504
|
+
declare class WebCalls extends APIResource {
|
|
3505
|
+
/**
|
|
3506
|
+
* Create a call for one visitor and get its access token.
|
|
3507
|
+
*
|
|
3508
|
+
* const { access_token } = await dialgem.webCalls.create({ agent_id, metadata: { visitor: "v_123" } })
|
|
3509
|
+
*
|
|
3510
|
+
* `metadata` and `dialgem_llm_dynamic_variables` are fixed here, by you, and cannot be changed by the page.
|
|
3511
|
+
* 409 `web_origins_not_configured` until an origin is allowed; 402 if the organization cannot pay for calls;
|
|
3512
|
+
* 429 when more than `limits.tokens_per_minute` calls are created in a minute.
|
|
3513
|
+
*/
|
|
3514
|
+
create(body: WebCallCreateParams, options?: RequestOptions): Promise<WebCall>;
|
|
3515
|
+
/** The origins browser calls may start from, and the limits that apply. */
|
|
3516
|
+
retrieveSettings(options?: RequestOptions): Promise<WebCallSettings>;
|
|
3517
|
+
/**
|
|
3518
|
+
* Replace the allowed origins. Each is `scheme://host[:port]`; `https://*.example.com` allows any subdomain
|
|
3519
|
+
* (not the bare domain) and `*` allows any website. Tokens already issued keep the list they were issued with.
|
|
3520
|
+
*/
|
|
3521
|
+
updateSettings(body: WebCallSettingsUpdateParams, options?: RequestOptions): Promise<WebCallSettings>;
|
|
3522
|
+
}
|
|
3523
|
+
|
|
3524
|
+
/**
|
|
3525
|
+
* Contacts, lists and CSV imports.
|
|
3526
|
+
*
|
|
3527
|
+
* Request bodies come from the generated OpenAPI types (see `params.ts`); the
|
|
3528
|
+
* response shapes are written here, from the API's own serializers.
|
|
3529
|
+
*/
|
|
3530
|
+
|
|
3531
|
+
type Schemas$3 = components["schemas"];
|
|
3532
|
+
type ContactCreateParams = RequestBody<Schemas$3["ContactCreate"]>;
|
|
3533
|
+
type ContactUpdateParams = RequestBody<Schemas$3["ContactUpdate"]>;
|
|
3534
|
+
type ContactListCreateParams = RequestBody<Schemas$3["ContactListCreate"]>;
|
|
3535
|
+
type ContactListUpdateParams = RequestBody<Schemas$3["ContactListUpdate"]>;
|
|
3536
|
+
type ContactImportCreateParams = RequestBody<Schemas$3["ContactImportCreate"]>;
|
|
3537
|
+
interface Contact {
|
|
3538
|
+
id: string;
|
|
3539
|
+
/** E.164, for example `+14155552671`. The number is the contact's identity: one contact per number. */
|
|
3540
|
+
phone: string;
|
|
3541
|
+
first_name: string | null;
|
|
3542
|
+
last_name: string | null;
|
|
3543
|
+
email: string | null;
|
|
3544
|
+
/** IANA zone name, for example `America/Chicago`. */
|
|
3545
|
+
timezone: string | null;
|
|
3546
|
+
/** Your own fields, as text. */
|
|
3547
|
+
attributes: Record<string, string>;
|
|
3548
|
+
source: "api" | "dashboard" | "import" | (string & {});
|
|
3549
|
+
/**
|
|
3550
|
+
* Whether the number is on your organization's do-not-call list. Read from that list
|
|
3551
|
+
* each time, never stored on the contact.
|
|
3552
|
+
*/
|
|
3553
|
+
do_not_call: boolean;
|
|
3554
|
+
/** ISO 8601, no timezone suffix (UTC). */
|
|
3555
|
+
created_at: string | null;
|
|
3556
|
+
updated_at: string | null;
|
|
3557
|
+
/** Present on `create`, `retrieve` and `update`. */
|
|
3558
|
+
lists?: {
|
|
3559
|
+
id: string;
|
|
3560
|
+
name: string;
|
|
3561
|
+
}[];
|
|
3562
|
+
/** Present on `retrieve`: calls to or from the number. */
|
|
3563
|
+
call_count?: number;
|
|
3564
|
+
last_call_at?: string | null;
|
|
3565
|
+
}
|
|
3566
|
+
interface ContactListParams {
|
|
3567
|
+
/** Matches name, email and phone digits. */
|
|
3568
|
+
q?: string | undefined;
|
|
3569
|
+
list_id?: string | undefined;
|
|
3570
|
+
/** 1 to 200. Default 50. */
|
|
3571
|
+
limit?: number | undefined;
|
|
3572
|
+
}
|
|
3573
|
+
interface ContactDeleteResponse {
|
|
3574
|
+
id: string;
|
|
3575
|
+
deleted: true;
|
|
3576
|
+
}
|
|
3577
|
+
interface ContactCallSummary {
|
|
3578
|
+
id: string;
|
|
3579
|
+
agent_id: string | null;
|
|
3580
|
+
direction: "inbound" | "outbound" | (string & {});
|
|
3581
|
+
status: string;
|
|
3582
|
+
started_at: string | null;
|
|
3583
|
+
ended_at: string | null;
|
|
3584
|
+
duration_s: number | null;
|
|
3585
|
+
disconnection_reason: string | null;
|
|
3586
|
+
/** The call's analysis summary, when it has one. No transcript. */
|
|
3587
|
+
summary: string | null;
|
|
3588
|
+
}
|
|
3589
|
+
interface ContactCallList {
|
|
3590
|
+
total: number;
|
|
3591
|
+
calls: ContactCallSummary[];
|
|
3592
|
+
}
|
|
3593
|
+
interface ContactListRecord {
|
|
3594
|
+
id: string;
|
|
3595
|
+
name: string;
|
|
3596
|
+
description: string | null;
|
|
3597
|
+
member_count: number;
|
|
3598
|
+
created_at: string | null;
|
|
3599
|
+
updated_at: string | null;
|
|
3600
|
+
}
|
|
3601
|
+
interface ContactListDeleteResponse {
|
|
3602
|
+
id: string;
|
|
3603
|
+
deleted: true;
|
|
3604
|
+
}
|
|
3605
|
+
interface ContactListMembersAddResponse {
|
|
3606
|
+
id: string;
|
|
3607
|
+
/** How many were not already in the list. */
|
|
3608
|
+
added: number;
|
|
3609
|
+
member_count: number;
|
|
3610
|
+
}
|
|
3611
|
+
interface ContactListMemberRemoveResponse {
|
|
3612
|
+
id: string;
|
|
3613
|
+
member_count: number;
|
|
3614
|
+
}
|
|
3615
|
+
type ContactImportStatus = "queued" | "running"
|
|
3616
|
+
/** A dry run finished; apply it with `commit`. */
|
|
3617
|
+
| "previewed" | "completed" | "failed" | "cancelled"
|
|
3618
|
+
/** A preview nobody confirmed within a day. */
|
|
3619
|
+
| "expired";
|
|
3620
|
+
interface ContactImport {
|
|
3621
|
+
id: string;
|
|
3622
|
+
status: ContactImportStatus;
|
|
3623
|
+
dry_run: boolean;
|
|
3624
|
+
filename: string | null;
|
|
3625
|
+
total_rows: number;
|
|
3626
|
+
/** For a preview, what would be created. */
|
|
3627
|
+
created: number;
|
|
3628
|
+
updated: number;
|
|
3629
|
+
/** Rows repeating an earlier number in the file, or existing contacts when `on_duplicate` is `skip`. */
|
|
3630
|
+
skipped: number;
|
|
3631
|
+
/** Rows that could not be used. See `imports.errors`. */
|
|
3632
|
+
errors: number;
|
|
3633
|
+
/** More rows were rejected than the report keeps (5,000). */
|
|
3634
|
+
errors_truncated: boolean;
|
|
3635
|
+
failure: string | null;
|
|
3636
|
+
mapping: Record<string, string> | null;
|
|
3637
|
+
attribute_columns: string[] | null;
|
|
3638
|
+
default_country: string | null;
|
|
3639
|
+
on_duplicate: "update" | "skip" | null;
|
|
3640
|
+
list_id: string | null;
|
|
3641
|
+
created_at: string | null;
|
|
3642
|
+
started_at: string | null;
|
|
3643
|
+
finished_at: string | null;
|
|
3644
|
+
}
|
|
3645
|
+
interface ContactImportList {
|
|
3646
|
+
imports: ContactImport[];
|
|
3647
|
+
}
|
|
3648
|
+
interface ContactCsvInspection {
|
|
3649
|
+
headers: string[];
|
|
3650
|
+
row_count: number;
|
|
3651
|
+
/** The guessed field-to-column mapping: `phone`, `first_name`, `last_name`, `full_name`, `email`, `timezone`. */
|
|
3652
|
+
mapping: Record<string, string>;
|
|
3653
|
+
/** Columns left over, offered as your own fields. */
|
|
3654
|
+
attribute_columns: string[];
|
|
3655
|
+
sample: Record<string, string | null>[];
|
|
3656
|
+
}
|
|
3657
|
+
interface ContactImportErrorRow {
|
|
3658
|
+
/** The line of the file, counting the header as line 1. */
|
|
3659
|
+
row: number;
|
|
3660
|
+
error: string;
|
|
3661
|
+
values: Record<string, string>;
|
|
3662
|
+
}
|
|
3663
|
+
interface ContactImportErrors {
|
|
3664
|
+
errors: ContactImportErrorRow[];
|
|
3665
|
+
total: number;
|
|
3666
|
+
truncated: boolean;
|
|
3667
|
+
}
|
|
3668
|
+
|
|
3669
|
+
/**
|
|
3670
|
+
* The people your organization calls. A phone number identifies each one: it is stored
|
|
3671
|
+
* in international form however you write it, and each number can be a contact once.
|
|
3672
|
+
*/
|
|
3673
|
+
declare class Contacts extends APIResource {
|
|
3674
|
+
/** Bulk import from CSV, with a dry-run preview. */
|
|
3675
|
+
readonly imports: ContactImports;
|
|
3676
|
+
constructor(client: HttpClient);
|
|
3677
|
+
/**
|
|
3678
|
+
* Add a contact. `phone` is any way of writing a valid number; without a leading `+`
|
|
3679
|
+
* also pass `default_country` (`"US"`). A number that is already a contact answers 409
|
|
3680
|
+
* with its `contact_id`.
|
|
3681
|
+
*/
|
|
3682
|
+
create(body: ContactCreateParams, options?: RequestOptions): Promise<Contact>;
|
|
3683
|
+
/**
|
|
3684
|
+
* Contacts, newest first. Await for one page, or iterate for every contact:
|
|
3685
|
+
*
|
|
3686
|
+
*/
|
|
3687
|
+
list(params?: ContactListParams, options?: RequestOptions): PagePromise<Contact>;
|
|
3688
|
+
/**
|
|
3689
|
+
* The contact with this phone number. The number is matched as E.164, so
|
|
3690
|
+
* `("(212) 220-0001", { default_country: "US" })` finds `+12122200001`. Throws
|
|
3691
|
+
* `NotFoundError` if you have no such contact, and `UnprocessableEntityError` if the text is
|
|
3692
|
+
* not a phone number.
|
|
3693
|
+
*/
|
|
3694
|
+
retrieveByPhone(phone: string, params?: {
|
|
3695
|
+
default_country?: string | undefined;
|
|
3696
|
+
}, options?: RequestOptions): Promise<Contact>;
|
|
3697
|
+
/** One contact, with its lists and how many calls it has had. */
|
|
3698
|
+
retrieve(contactId: string, options?: RequestOptions): Promise<Contact>;
|
|
3699
|
+
/**
|
|
3700
|
+
* Partial update: only the fields you send change, and `null` clears a field.
|
|
3701
|
+
* `attributes` replaces the whole set, so send every field you want kept.
|
|
3702
|
+
*/
|
|
3703
|
+
update(contactId: string, body: ContactUpdateParams, options?: RequestOptions): Promise<Contact>;
|
|
3704
|
+
/**
|
|
3705
|
+
* Erase a contact and its list memberships. Calls already made stay in the call log, and
|
|
3706
|
+
* a do-not-call entry for the number stays too, so forgetting a person never makes a number
|
|
3707
|
+
* that asked not to be called dialable again.
|
|
3708
|
+
*/
|
|
3709
|
+
delete(contactId: string, options?: RequestOptions): Promise<ContactDeleteResponse>;
|
|
3710
|
+
/** Calls to or from the contact's number, newest first. Summaries, not transcripts. */
|
|
3711
|
+
calls(contactId: string, params?: {
|
|
3712
|
+
limit?: number | undefined;
|
|
3713
|
+
}, options?: RequestOptions): Promise<ContactCallList>;
|
|
3714
|
+
}
|
|
3715
|
+
/**
|
|
3716
|
+
* CSV import runs in the background. Typical flow: `inspect` to see the columns, `create`
|
|
3717
|
+
* with `dry_run: true`, poll `retrieve` until `previewed`, look at the counts (and `errors`),
|
|
3718
|
+
* then `commit` and poll until `completed`.
|
|
3719
|
+
*
|
|
3720
|
+
* The CSV text is sent in the request. Downloading the rejected rows as a CSV, and exporting
|
|
3721
|
+
* contacts, are available over the REST API (`GET /v1/contacts/imports/{id}/errors?format=csv`,
|
|
3722
|
+
* `GET /v1/contacts/export`).
|
|
3723
|
+
*/
|
|
3724
|
+
declare class ContactImports extends APIResource {
|
|
3725
|
+
/** The file's headers, a guessed column mapping and a few rows. Imports nothing. */
|
|
3726
|
+
inspect(csv: string, options?: RequestOptions): Promise<ContactCsvInspection>;
|
|
3727
|
+
/**
|
|
3728
|
+
* Start an import. Without `mapping` the columns are guessed from the headers. With
|
|
3729
|
+
* `dry_run: true` nothing is written: the import only validates and reports.
|
|
3730
|
+
*/
|
|
3731
|
+
create(body: ContactImportCreateParams, options?: RequestOptions): Promise<ContactImport>;
|
|
3732
|
+
/** Recent imports, newest first. */
|
|
3733
|
+
list(options?: RequestOptions): Promise<ContactImportList>;
|
|
3734
|
+
/** Progress and counts. */
|
|
3735
|
+
retrieve(importId: string, options?: RequestOptions): Promise<ContactImport>;
|
|
3736
|
+
/** The rows that were rejected, with the line, the reason and what each held. */
|
|
3737
|
+
errors(importId: string, params?: {
|
|
3738
|
+
limit?: number | undefined;
|
|
3739
|
+
}, options?: RequestOptions): Promise<ContactImportErrors>;
|
|
3740
|
+
/** Apply a previewed import: the file is read again, so what is applied is what was previewed. */
|
|
3741
|
+
commit(importId: string, options?: RequestOptions): Promise<ContactImport>;
|
|
3742
|
+
/** Stop an import that has not finished. Contacts a running import already wrote stay. */
|
|
3743
|
+
cancel(importId: string, options?: RequestOptions): Promise<ContactImport>;
|
|
3744
|
+
}
|
|
3745
|
+
/** Named groups of contacts. Deleting a list never deletes its contacts. */
|
|
3746
|
+
declare class ContactLists extends APIResource {
|
|
3747
|
+
list(options?: RequestOptions): Promise<{
|
|
3748
|
+
lists: ContactListRecord[];
|
|
3749
|
+
}>;
|
|
3750
|
+
/** Names are unique within your organization, ignoring case. */
|
|
3751
|
+
create(body: ContactListCreateParams, options?: RequestOptions): Promise<ContactListRecord>;
|
|
3752
|
+
retrieve(listId: string, options?: RequestOptions): Promise<ContactListRecord>;
|
|
3753
|
+
update(listId: string, body: ContactListUpdateParams, options?: RequestOptions): Promise<ContactListRecord>;
|
|
3754
|
+
delete(listId: string, options?: RequestOptions): Promise<ContactListDeleteResponse>;
|
|
3755
|
+
/** Add up to 1000 of your contacts. Already-members are ignored; `added` says how many were new. */
|
|
3756
|
+
addContacts(listId: string, contactIds: string[], options?: RequestOptions): Promise<ContactListMembersAddResponse>;
|
|
3757
|
+
removeContact(listId: string, contactId: string, options?: RequestOptions): Promise<ContactListMemberRemoveResponse>;
|
|
3758
|
+
}
|
|
3759
|
+
|
|
2510
3760
|
/**
|
|
2511
3761
|
* Which published agent version a number answers on.
|
|
2512
3762
|
*
|
|
@@ -2547,6 +3797,59 @@ interface PhoneNumber {
|
|
|
2547
3797
|
/** Epoch milliseconds (0 if unknown). */
|
|
2548
3798
|
last_modification_timestamp: number;
|
|
2549
3799
|
sip_outbound_trunk_config: SipOutboundTrunkConfig | null;
|
|
3800
|
+
/** The inbound routing webhook, asked before an inbound call is answered. `null` when none is set. */
|
|
3801
|
+
inbound_webhook_url: string | null;
|
|
3802
|
+
/** The last four characters of the signing secret; `null` with no webhook. */
|
|
3803
|
+
inbound_webhook_secret_hint: string | null;
|
|
3804
|
+
/** The full signing secret. Present **only** in the response that created or rotated it, never again. */
|
|
3805
|
+
inbound_webhook_secret?: string;
|
|
3806
|
+
}
|
|
3807
|
+
/** A number that can be bought, from `phoneNumbers.search`. */
|
|
3808
|
+
interface AvailablePhoneNumber {
|
|
3809
|
+
/** E.164. Pass it to `phoneNumbers.buy`. */
|
|
3810
|
+
phone_number: string;
|
|
3811
|
+
friendly_name: string;
|
|
3812
|
+
type: string;
|
|
3813
|
+
locality: string | null;
|
|
3814
|
+
region: string | null;
|
|
3815
|
+
country: string;
|
|
3816
|
+
voice: boolean;
|
|
3817
|
+
sms: boolean;
|
|
3818
|
+
mms: boolean;
|
|
3819
|
+
}
|
|
3820
|
+
interface AvailablePhoneNumbers {
|
|
3821
|
+
numbers: AvailablePhoneNumber[];
|
|
3822
|
+
/** The monthly rental, in 0.0001-dollar units (`monthly_price_usd * 10000`). */
|
|
3823
|
+
monthly_price_units: number;
|
|
3824
|
+
monthly_price_usd: number;
|
|
3825
|
+
}
|
|
3826
|
+
/** What `phoneNumbers.buy` returns: the new number, plus its monthly price. */
|
|
3827
|
+
type PurchasedPhoneNumber = PhoneNumber & {
|
|
3828
|
+
monthly_price_units: number;
|
|
3829
|
+
monthly_price_usd: number;
|
|
3830
|
+
};
|
|
3831
|
+
/** What `phoneNumbers.testInboundWebhook` reports. */
|
|
3832
|
+
interface InboundWebhookTestResult {
|
|
3833
|
+
/** Your endpoint answered with a 2xx. */
|
|
3834
|
+
ok: boolean;
|
|
3835
|
+
status_code: number | null;
|
|
3836
|
+
latency_ms: number;
|
|
3837
|
+
/** The time your endpoint has for a real call (`INBOUND_ROUTING_TIMEOUT_S`). */
|
|
3838
|
+
budget_ms: number;
|
|
3839
|
+
error: string | null;
|
|
3840
|
+
/** What a real call would have done with the answer. */
|
|
3841
|
+
decision: {
|
|
3842
|
+
outcome: "unchanged" | "applied" | "rejected" | "fallback";
|
|
3843
|
+
note?: string;
|
|
3844
|
+
reject_reason?: string;
|
|
3845
|
+
agent_id?: string;
|
|
3846
|
+
agent_version?: number | null;
|
|
3847
|
+
/** Names of the dynamic variables that would be applied. */
|
|
3848
|
+
variables?: string[];
|
|
3849
|
+
metadata_keys?: string[];
|
|
3850
|
+
/** Fields that would be ignored, as `field: reason`. */
|
|
3851
|
+
ignored?: Record<string, string>;
|
|
3852
|
+
};
|
|
2550
3853
|
}
|
|
2551
3854
|
interface PhoneNumberAgentWeight {
|
|
2552
3855
|
agent_id: string;
|
|
@@ -2563,6 +3866,17 @@ interface SipOutboundTrunkConfig {
|
|
|
2563
3866
|
declare class PhoneNumbers extends APIResource {
|
|
2564
3867
|
/** Register a number you own (`phone_number` in E.164) with Dialgem. */
|
|
2565
3868
|
create(body: PhoneNumberCreateParams, options?: RequestOptions): Promise<PhoneNumber>;
|
|
3869
|
+
/**
|
|
3870
|
+
* Numbers that can be bought, with the monthly price. Throws `NotFoundError` (`number_purchase_disabled`) when the
|
|
3871
|
+
* deployment has not switched buying on.
|
|
3872
|
+
*/
|
|
3873
|
+
search(params?: PhoneNumberSearchParams, options?: RequestOptions): Promise<AvailablePhoneNumbers>;
|
|
3874
|
+
/**
|
|
3875
|
+
* Buy one of the numbers `search` returned. **Spends the organization's credit**: the first month is debited now and
|
|
3876
|
+
* the rental renews monthly until the number is released. Throws on insufficient credit, or if the carrier no longer
|
|
3877
|
+
* has the number; nothing is charged in either case.
|
|
3878
|
+
*/
|
|
3879
|
+
buy(body: PhoneNumberBuyParams, options?: RequestOptions): Promise<PurchasedPhoneNumber>;
|
|
2566
3880
|
/** Every active (not released) number in the organization, newest first. */
|
|
2567
3881
|
list(options?: RequestOptions): Promise<PhoneNumber[]>;
|
|
2568
3882
|
/**
|
|
@@ -2584,10 +3898,262 @@ declare class PhoneNumbers extends APIResource {
|
|
|
2584
3898
|
update(phoneNumberId: string, body: PhoneNumberUpdateParams, options?: RequestOptions): Promise<PhoneNumber>;
|
|
2585
3899
|
/** Set the number's **inbound** agent, or pass `agent_id: null` to clear it. For outbound, use `update`. */
|
|
2586
3900
|
assign(phoneNumberId: string, body: PhoneNumberAssignParams, options?: RequestOptions): Promise<PhoneNumber>;
|
|
3901
|
+
/**
|
|
3902
|
+
* Send one signed test request to the number's inbound routing webhook and report what a real call would have done
|
|
3903
|
+
* with your answer: the status, how long you took against the time budget, and any field that would be ignored.
|
|
3904
|
+
* Throws a `ConflictError` (`inbound_webhook_not_set`) when the number has no `inbound_webhook_url`.
|
|
3905
|
+
*/
|
|
3906
|
+
testInboundWebhook(phoneNumberId: string, options?: RequestOptions): Promise<InboundWebhookTestResult>;
|
|
3907
|
+
/**
|
|
3908
|
+
* Replace the inbound webhook's signing secret. The new secret is returned **once**, as `inbound_webhook_secret`
|
|
3909
|
+
* on the number; the old one stops working at once.
|
|
3910
|
+
*/
|
|
3911
|
+
rotateInboundWebhookSecret(phoneNumberId: string, options?: RequestOptions): Promise<PhoneNumber>;
|
|
2587
3912
|
/** Release the number from Dialgem. It stops routing calls and disappears from `list()`; your carrier account is untouched. */
|
|
2588
3913
|
delete(phoneNumberId: string, options?: RequestOptions): Promise<void>;
|
|
2589
3914
|
}
|
|
2590
3915
|
|
|
3916
|
+
/**
|
|
3917
|
+
* Chats. Request bodies come from the generated OpenAPI types; the response shapes are written from the
|
|
3918
|
+
* API's own serializer (`chat_to_dict`).
|
|
3919
|
+
*/
|
|
3920
|
+
|
|
3921
|
+
type Schemas$2 = components["schemas"];
|
|
3922
|
+
type ChatCreateParams = RequestBody<Schemas$2["ChatCreate"]>;
|
|
3923
|
+
type ChatUpdateParams = RequestBody<Schemas$2["ChatUpdate"]>;
|
|
3924
|
+
interface ChatListParams {
|
|
3925
|
+
agent_id?: string | undefined;
|
|
3926
|
+
status?: "ongoing" | "ended" | undefined;
|
|
3927
|
+
/** 1 to 100. Default 50. */
|
|
3928
|
+
limit?: number | undefined;
|
|
3929
|
+
}
|
|
3930
|
+
/** One entry in a chat. Tool use is shown between the user's message and the agent's reply. */
|
|
3931
|
+
interface ChatMessage {
|
|
3932
|
+
message_id: string;
|
|
3933
|
+
role: "user" | "agent" | "tool_call_invocation" | "tool_call_result" | (string & {});
|
|
3934
|
+
/** The text. Empty on a `tool_call_invocation`; the tool's answer on a `tool_call_result`. */
|
|
3935
|
+
content: string;
|
|
3936
|
+
/** Epoch milliseconds. */
|
|
3937
|
+
created_timestamp: number;
|
|
3938
|
+
/** On the two tool roles: ties an invocation to its result. */
|
|
3939
|
+
tool_call_id?: string;
|
|
3940
|
+
/** On `tool_call_invocation`. */
|
|
3941
|
+
name?: string;
|
|
3942
|
+
arguments?: Record<string, unknown>;
|
|
3943
|
+
}
|
|
3944
|
+
interface Chat {
|
|
3945
|
+
id: string;
|
|
3946
|
+
/** Same as `id`. */
|
|
3947
|
+
chat_id: string;
|
|
3948
|
+
chat_type: "api_chat" | (string & {});
|
|
3949
|
+
chat_status: "ongoing" | "ended" | (string & {});
|
|
3950
|
+
agent_id: string;
|
|
3951
|
+
/** The version the chat answers with; 0 is the live draft. */
|
|
3952
|
+
agent_version: number;
|
|
3953
|
+
metadata: Record<string, unknown>;
|
|
3954
|
+
dynamic_variables: Record<string, string>;
|
|
3955
|
+
/** Epoch milliseconds. */
|
|
3956
|
+
start_timestamp: number | null;
|
|
3957
|
+
end_timestamp: number | null;
|
|
3958
|
+
/** `user_ended`, `agent_ended`, ... `null` while ongoing. */
|
|
3959
|
+
end_reason: string | null;
|
|
3960
|
+
/** User and agent messages, not counting tool entries. */
|
|
3961
|
+
message_count: number;
|
|
3962
|
+
/** `User: ...` / `Agent: ...` lines. */
|
|
3963
|
+
transcript: string;
|
|
3964
|
+
/** Same shape as a call's `analysis`; `null` until it has run (a moment after the chat ends). */
|
|
3965
|
+
analysis: Record<string, unknown> | null;
|
|
3966
|
+
/**
|
|
3967
|
+
* What the chat has cost so far, in $0.0001 units (50 = $0.005), and how many agent messages it holds
|
|
3968
|
+
* (the greeting is one, and is not billed). `null` for a team-member session, as for a call's cost.
|
|
3969
|
+
* Estimates until the price list is published.
|
|
3970
|
+
*/
|
|
3971
|
+
chat_cost: {
|
|
3972
|
+
combined_cost: number;
|
|
3973
|
+
reply_count: number;
|
|
3974
|
+
} | null;
|
|
3975
|
+
/** Left out of `list` entries; fetch one chat for them. */
|
|
3976
|
+
messages?: ChatMessage[];
|
|
3977
|
+
}
|
|
3978
|
+
/** What `chats.sendMessage` returns: only the new entries, in order. */
|
|
3979
|
+
interface ChatReply {
|
|
3980
|
+
chat_id: string;
|
|
3981
|
+
chat_status: "ongoing" | "ended" | (string & {});
|
|
3982
|
+
messages: ChatMessage[];
|
|
3983
|
+
}
|
|
3984
|
+
interface ChatDeleteResponse {
|
|
3985
|
+
deleted: true;
|
|
3986
|
+
id: string;
|
|
3987
|
+
}
|
|
3988
|
+
|
|
3989
|
+
/**
|
|
3990
|
+
* Text conversations with one of your agents, from your backend.
|
|
3991
|
+
*
|
|
3992
|
+
* const chat = await dialgem.chats.create({ agent_id, dynamic_variables: { customer: "Ada" } })
|
|
3993
|
+
* const { messages } = await dialgem.chats.sendMessage(chat.id, "Can I come in on Tuesday?")
|
|
3994
|
+
* await dialgem.chats.end(chat.id)
|
|
3995
|
+
*
|
|
3996
|
+
* The agent is the one that answers your phone: same prompt, model and functions. Prompt agents only; an agent
|
|
3997
|
+
* that keeps no transcript cannot chat. Your API key stays on your server; to put a chat box on a web page,
|
|
3998
|
+
* have your backend call `sendMessage` for the visitor.
|
|
3999
|
+
*/
|
|
4000
|
+
declare class Chats extends APIResource {
|
|
4001
|
+
/**
|
|
4002
|
+
* Start a chat. If the agent has a first message it is already in `messages`.
|
|
4003
|
+
*
|
|
4004
|
+
* `UnprocessableEntityError` with `errCode` `agent_type_not_supported` (flow agents) or `chat_requires_storage`.
|
|
4005
|
+
* Not retried by default.
|
|
4006
|
+
*/
|
|
4007
|
+
create(body: ChatCreateParams, options?: RequestOptions): Promise<Chat>;
|
|
4008
|
+
/**
|
|
4009
|
+
* Chats, newest first. Await for one page, or iterate for every chat. Entries leave out `messages`;
|
|
4010
|
+
* `retrieve` a chat for them.
|
|
4011
|
+
*/
|
|
4012
|
+
list(params?: ChatListParams, options?: RequestOptions): PagePromise<Chat>;
|
|
4013
|
+
/** One chat with all its messages. */
|
|
4014
|
+
retrieve(chatId: string, options?: RequestOptions): Promise<Chat>;
|
|
4015
|
+
/** Replace the chat's `metadata` (the whole object). */
|
|
4016
|
+
update(chatId: string, body: ChatUpdateParams, options?: RequestOptions): Promise<Chat>;
|
|
4017
|
+
/** Delete a chat and its messages. */
|
|
4018
|
+
delete(chatId: string, options?: RequestOptions): Promise<ChatDeleteResponse>;
|
|
4019
|
+
/**
|
|
4020
|
+
* Send the user's message and wait for the agent's reply. Returns only the new entries, in order: the user's
|
|
4021
|
+
* message, any tool use, the agent's reply.
|
|
4022
|
+
*
|
|
4023
|
+
* If the agent's model fails (`ServerError`, `errCode` `model_error`) nothing is stored and the same message
|
|
4024
|
+
* can be sent again. `ConflictError` with `errCode` `chat_busy` while another reply is in progress,
|
|
4025
|
+
* `chat_ended` after the end, `message_limit` at the cap. If the agent calls its end-call tool, the reply's
|
|
4026
|
+
* `chat_status` is `ended`.
|
|
4027
|
+
*
|
|
4028
|
+
* Not retried by default: a retry after an ambiguous failure could send the message twice.
|
|
4029
|
+
*/
|
|
4030
|
+
sendMessage(chatId: string, content: string, options?: RequestOptions): Promise<ChatReply>;
|
|
4031
|
+
/** End the chat. Ending twice is fine. The analysis arrives a moment later; read it with `retrieve`. */
|
|
4032
|
+
end(chatId: string, options?: RequestOptions): Promise<Chat>;
|
|
4033
|
+
/**
|
|
4034
|
+
* Analyse an ended chat again with the agent's current analysis settings and return it. `ConflictError` with
|
|
4035
|
+
* `errCode` `chat_in_progress` until it has ended, `no_transcript` when it has no messages.
|
|
4036
|
+
*/
|
|
4037
|
+
rerunAnalysis(chatId: string, options?: RequestOptions): Promise<Chat>;
|
|
4038
|
+
}
|
|
4039
|
+
|
|
4040
|
+
/**
|
|
4041
|
+
* Saved flows. Request bodies come from the generated OpenAPI types; the response shape is written from the
|
|
4042
|
+
* API's own serializer (`flow_to_dict`).
|
|
4043
|
+
*/
|
|
4044
|
+
|
|
4045
|
+
type Schemas$1 = components["schemas"];
|
|
4046
|
+
type FlowCreateParams = RequestBody<Schemas$1["FlowCreate"]>;
|
|
4047
|
+
type FlowUpdateParams = RequestBody<Schemas$1["FlowUpdate"]>;
|
|
4048
|
+
interface FlowListParams {
|
|
4049
|
+
/** 1 to 100. Default 50. */
|
|
4050
|
+
limit?: number | undefined;
|
|
4051
|
+
}
|
|
4052
|
+
interface Flow {
|
|
4053
|
+
id: string;
|
|
4054
|
+
/** Same as `id`. */
|
|
4055
|
+
flow_id: string;
|
|
4056
|
+
name: string;
|
|
4057
|
+
language: string;
|
|
4058
|
+
/** Bumped by the server when the flow's content changes. */
|
|
4059
|
+
version: number | null;
|
|
4060
|
+
node_count: number;
|
|
4061
|
+
/** Epoch milliseconds. */
|
|
4062
|
+
created_timestamp: number | null;
|
|
4063
|
+
last_modification_timestamp: number | null;
|
|
4064
|
+
/** Left out of `list` entries; `retrieve` a flow for it. */
|
|
4065
|
+
flow_config?: FlowConfig;
|
|
4066
|
+
/** Present on `create` / `update` when the flow saved with warnings. */
|
|
4067
|
+
flow_validation?: {
|
|
4068
|
+
issues: ErrorIssue[];
|
|
4069
|
+
};
|
|
4070
|
+
}
|
|
4071
|
+
interface FlowDeleteResponse {
|
|
4072
|
+
deleted: true;
|
|
4073
|
+
id: string;
|
|
4074
|
+
}
|
|
4075
|
+
|
|
4076
|
+
/**
|
|
4077
|
+
* Conversation flows you save once and attach to agents.
|
|
4078
|
+
*
|
|
4079
|
+
* const flow = await dialgem.flows.create({ name: "Intake", flow_config })
|
|
4080
|
+
* await dialgem.agents.create({ name: "Front desk", agent_type: "flow", flow_id: flow.id })
|
|
4081
|
+
*
|
|
4082
|
+
* A flow is checked the way an agent's `flow_config` is, so a saved flow is one that would have saved on an
|
|
4083
|
+
* agent. **Attaching copies it**: `agents.create` / `agents.update` with `flow_id` takes a snapshot, and editing
|
|
4084
|
+
* or deleting the flow afterwards changes no agent, no published version and no call.
|
|
4085
|
+
*/
|
|
4086
|
+
declare class Flows extends APIResource {
|
|
4087
|
+
/** Validate and save a flow. `UnprocessableEntityError` (`errCode` `flow_invalid`) lists every problem. Not retried by default. */
|
|
4088
|
+
create(body: FlowCreateParams, options?: RequestOptions): Promise<Flow>;
|
|
4089
|
+
/** Flows, newest first. Await for one page, or iterate for every flow. Entries leave out `flow_config`. */
|
|
4090
|
+
list(params?: FlowListParams, options?: RequestOptions): PagePromise<Flow>;
|
|
4091
|
+
/** One flow with its `flow_config`. */
|
|
4092
|
+
retrieve(flowId: string, options?: RequestOptions): Promise<Flow>;
|
|
4093
|
+
/** Rename a flow and/or replace its `flow_config` (checked again). Agents it was attached to are not changed. */
|
|
4094
|
+
update(flowId: string, body: FlowUpdateParams, options?: RequestOptions): Promise<Flow>;
|
|
4095
|
+
/** Delete a saved flow. Agents it was attached to keep their copy. */
|
|
4096
|
+
delete(flowId: string, options?: RequestOptions): Promise<FlowDeleteResponse>;
|
|
4097
|
+
}
|
|
4098
|
+
|
|
4099
|
+
/**
|
|
4100
|
+
* Saved LLM settings. Request bodies come from the generated OpenAPI types; the response shape is written from
|
|
4101
|
+
* the API's own serializer (`llm_to_dict`).
|
|
4102
|
+
*/
|
|
4103
|
+
|
|
4104
|
+
type Schemas = components["schemas"];
|
|
4105
|
+
type LLMCreateParams = RequestBody<Schemas["LLMCreate"]>;
|
|
4106
|
+
type LLMUpdateParams = RequestBody<Schemas["LLMUpdate"]>;
|
|
4107
|
+
interface LLMListParams {
|
|
4108
|
+
/** 1 to 100. Default 50. */
|
|
4109
|
+
limit?: number | undefined;
|
|
4110
|
+
}
|
|
4111
|
+
interface LLM {
|
|
4112
|
+
id: string;
|
|
4113
|
+
/** Same as `id`. */
|
|
4114
|
+
llm_id: string;
|
|
4115
|
+
name: string;
|
|
4116
|
+
/** Epoch milliseconds. */
|
|
4117
|
+
created_timestamp: number | null;
|
|
4118
|
+
last_modification_timestamp: number | null;
|
|
4119
|
+
system_prompt: string;
|
|
4120
|
+
first_message: string | null;
|
|
4121
|
+
llm_provider: "anthropic" | "openai" | (string & {});
|
|
4122
|
+
llm_model: string;
|
|
4123
|
+
temperature: number;
|
|
4124
|
+
max_tokens: number;
|
|
4125
|
+
fallback_llm_provider: "anthropic" | "openai" | (string & {}) | null;
|
|
4126
|
+
fallback_llm_model: string | null;
|
|
4127
|
+
default_dynamic_variables: Record<string, string>;
|
|
4128
|
+
}
|
|
4129
|
+
interface LLMDeleteResponse {
|
|
4130
|
+
deleted: true;
|
|
4131
|
+
id: string;
|
|
4132
|
+
}
|
|
4133
|
+
|
|
4134
|
+
/**
|
|
4135
|
+
* A prompt and model you set up once and attach to agents.
|
|
4136
|
+
*
|
|
4137
|
+
* const llm = await dialgem.llms.create({ name: "Booking", system_prompt, llm_model: "gpt-4o-mini" })
|
|
4138
|
+
* await dialgem.agents.create({ name: "Front desk", llm_id: llm.id })
|
|
4139
|
+
*
|
|
4140
|
+
* It holds `system_prompt`, `first_message`, `llm_provider`, `llm_model`, `temperature`, `max_tokens`, the
|
|
4141
|
+
* fallback pair and `default_dynamic_variables`. **Attaching copies it**: `agents.create` / `agents.update` with
|
|
4142
|
+
* `llm_id` writes those values into the agent, and editing or deleting the saved LLM afterwards changes no
|
|
4143
|
+
* agent, no published version and no call. Sending `llm_id` together with any of those fields is refused.
|
|
4144
|
+
*/
|
|
4145
|
+
declare class LLMs extends APIResource {
|
|
4146
|
+
/** Save LLM settings. Anything left out takes the default a new agent gets. Not retried by default. */
|
|
4147
|
+
create(body: LLMCreateParams, options?: RequestOptions): Promise<LLM>;
|
|
4148
|
+
/** Saved LLMs, newest first. Await for one page, or iterate for every one. */
|
|
4149
|
+
list(params?: LLMListParams, options?: RequestOptions): PagePromise<LLM>;
|
|
4150
|
+
retrieve(llmId: string, options?: RequestOptions): Promise<LLM>;
|
|
4151
|
+
/** Change the fields you send. Agents it was attached to are not changed. */
|
|
4152
|
+
update(llmId: string, body: LLMUpdateParams, options?: RequestOptions): Promise<LLM>;
|
|
4153
|
+
/** Delete saved LLM settings. Agents they were attached to keep their copy. */
|
|
4154
|
+
delete(llmId: string, options?: RequestOptions): Promise<LLMDeleteResponse>;
|
|
4155
|
+
}
|
|
4156
|
+
|
|
2591
4157
|
/**
|
|
2592
4158
|
* Payloads Dialgem POSTs to an agent's `webhook_url`, for the events subscribed in
|
|
2593
4159
|
* `webhook_events`. Each carries the full call record; see the "Verify webhooks"
|
|
@@ -2596,7 +4162,7 @@ declare class PhoneNumbers extends APIResource {
|
|
|
2596
4162
|
* A failed delivery is retried up to three times, and every attempt carries the
|
|
2597
4163
|
* same `x-dialgem-delivery` id. Use it (or `event` + `call_id`) to drop duplicates.
|
|
2598
4164
|
*/
|
|
2599
|
-
type WebhookEvent = CallStartedEvent | CallEndedEvent | CallAnalyzedEvent;
|
|
4165
|
+
type WebhookEvent = CallStartedEvent | CallEndedEvent | CallAnalyzedEvent | TranscriptUpdatedEvent | TransferStartedEvent | TransferBridgedEvent | TransferCancelledEvent | TransferEndedEvent | ChatStartedEvent | ChatEndedEvent | ChatAnalyzedEvent;
|
|
2600
4166
|
interface CallEventBase {
|
|
2601
4167
|
call_id: string;
|
|
2602
4168
|
agent_id: string;
|
|
@@ -2614,6 +4180,77 @@ interface CallEndedEvent extends CallEventBase {
|
|
|
2614
4180
|
interface CallAnalyzedEvent extends CallEventBase {
|
|
2615
4181
|
event: "call_analyzed";
|
|
2616
4182
|
}
|
|
4183
|
+
interface ChatEventBase {
|
|
4184
|
+
chat_id: string;
|
|
4185
|
+
agent_id: string;
|
|
4186
|
+
/** The full chat record, with its messages, at the moment the event was sent. */
|
|
4187
|
+
chat: Chat;
|
|
4188
|
+
}
|
|
4189
|
+
/** A chat was started. Chat events carry `chat_id`, not `call_id`. */
|
|
4190
|
+
interface ChatStartedEvent extends ChatEventBase {
|
|
4191
|
+
event: "chat_started";
|
|
4192
|
+
}
|
|
4193
|
+
/** The chat ended (by `chats.end` or by the agent). Analysis follows in `chat_analyzed`. */
|
|
4194
|
+
interface ChatEndedEvent extends ChatEventBase {
|
|
4195
|
+
event: "chat_ended";
|
|
4196
|
+
}
|
|
4197
|
+
/** Sent once a chat's analysis has run. */
|
|
4198
|
+
interface ChatAnalyzedEvent extends ChatEventBase {
|
|
4199
|
+
event: "chat_analyzed";
|
|
4200
|
+
}
|
|
4201
|
+
/** A transcript turn as carried by `transcript_updated`. */
|
|
4202
|
+
interface WebhookTranscriptTurn {
|
|
4203
|
+
role: "user" | "agent";
|
|
4204
|
+
text: string;
|
|
4205
|
+
timestamp: string;
|
|
4206
|
+
start_ms?: number;
|
|
4207
|
+
}
|
|
4208
|
+
/**
|
|
4209
|
+
* Sent each time a caller or agent turn is added to the live transcript.
|
|
4210
|
+
*
|
|
4211
|
+
* `transcript` is the whole transcript so far, so a receiver that misses or
|
|
4212
|
+
* reorders a delivery still ends up correct. `turn_index` increases by one per
|
|
4213
|
+
* event within a call; keep the highest.
|
|
4214
|
+
*/
|
|
4215
|
+
interface TranscriptUpdatedEvent extends CallEventBase {
|
|
4216
|
+
event: "transcript_updated";
|
|
4217
|
+
/** Who spoke the turn that triggered this event. */
|
|
4218
|
+
role: "user" | "agent";
|
|
4219
|
+
turn_index: number;
|
|
4220
|
+
transcript: WebhookTranscriptTurn[];
|
|
4221
|
+
}
|
|
4222
|
+
/** What a transfer event says about the transfer. Fields are present only when known. */
|
|
4223
|
+
interface WebhookTransferInfo {
|
|
4224
|
+
/** The number the call is being transferred to. */
|
|
4225
|
+
target?: string;
|
|
4226
|
+
mode?: "cold" | "warm" | string;
|
|
4227
|
+
/** Why a transfer was cancelled: a carrier dial status (`busy`, `no-answer`, ...) or a failure reason. */
|
|
4228
|
+
reason?: string;
|
|
4229
|
+
}
|
|
4230
|
+
/** The agent asked for the call to be transferred. */
|
|
4231
|
+
interface TransferStartedEvent extends CallEventBase {
|
|
4232
|
+
event: "transfer_started";
|
|
4233
|
+
transfer: WebhookTransferInfo;
|
|
4234
|
+
}
|
|
4235
|
+
/**
|
|
4236
|
+
* The transferee answered and was connected to the caller. For a cold transfer
|
|
4237
|
+
* this is delivered when the transferred leg finishes, immediately followed by
|
|
4238
|
+
* `transfer_ended`.
|
|
4239
|
+
*/
|
|
4240
|
+
interface TransferBridgedEvent extends CallEventBase {
|
|
4241
|
+
event: "transfer_bridged";
|
|
4242
|
+
transfer: WebhookTransferInfo;
|
|
4243
|
+
}
|
|
4244
|
+
/** The transfer did not connect: busy, no answer, failed, or could not be placed. */
|
|
4245
|
+
interface TransferCancelledEvent extends CallEventBase {
|
|
4246
|
+
event: "transfer_cancelled";
|
|
4247
|
+
transfer: WebhookTransferInfo;
|
|
4248
|
+
}
|
|
4249
|
+
/** A connected transfer finished. */
|
|
4250
|
+
interface TransferEndedEvent extends CallEventBase {
|
|
4251
|
+
event: "transfer_ended";
|
|
4252
|
+
transfer: WebhookTransferInfo;
|
|
4253
|
+
}
|
|
2617
4254
|
/**
|
|
2618
4255
|
* The body Dialgem POSTs to a custom function's URL when the agent calls it,
|
|
2619
4256
|
* unless the function has `args_at_root`, in which case the body is `args` alone.
|
|
@@ -2640,6 +4277,12 @@ interface FunctionCallContext {
|
|
|
2640
4277
|
declare const WEBHOOK_SIGNATURE_HEADER = "x-dialgem-signature";
|
|
2641
4278
|
/** Header naming the event; the same value as the body's `event`. */
|
|
2642
4279
|
declare const WEBHOOK_EVENT_HEADER = "x-dialgem-event";
|
|
4280
|
+
/**
|
|
4281
|
+
* During a signing-secret rotation overlap, the same body signed with the PREVIOUS
|
|
4282
|
+
* secret. Verify `x-dialgem-signature` with the new secret; a receiver that has not
|
|
4283
|
+
* switched yet can verify this one with the old secret instead.
|
|
4284
|
+
*/
|
|
4285
|
+
declare const WEBHOOK_PREVIOUS_SIGNATURE_HEADER = "x-dialgem-signature-previous";
|
|
2643
4286
|
/** Header with an id that stays the same across retries of one delivery. */
|
|
2644
4287
|
declare const WEBHOOK_DELIVERY_HEADER = "x-dialgem-delivery";
|
|
2645
4288
|
/** Signatures older or newer than this are rejected, so a captured request cannot be replayed. */
|
|
@@ -2731,14 +4374,36 @@ declare class Dialgem {
|
|
|
2731
4374
|
readonly calls: Calls;
|
|
2732
4375
|
readonly phoneNumbers: PhoneNumbers;
|
|
2733
4376
|
readonly voices: Voices;
|
|
4377
|
+
/** Models available for post-call analysis. */
|
|
4378
|
+
readonly extractionModels: ExtractionModels;
|
|
2734
4379
|
readonly flowTemplates: FlowTemplates;
|
|
2735
4380
|
readonly promptTemplates: PromptTemplates;
|
|
4381
|
+
/** Calls in progress right now. */
|
|
4382
|
+
readonly sessions: Sessions;
|
|
4383
|
+
/** Text conversations with an agent. */
|
|
4384
|
+
readonly chats: Chats;
|
|
4385
|
+
readonly flows: Flows;
|
|
4386
|
+
readonly llms: LLMs;
|
|
4387
|
+
/** What this API key is and may do. */
|
|
4388
|
+
readonly apiKey: ApiKey;
|
|
4389
|
+
/**
|
|
4390
|
+
* Verify what Dialgem sends you: `dialgem.webhooks.constructEvent(rawBody, signatureHeader, secret)`.
|
|
4391
|
+
*/
|
|
2736
4392
|
readonly webhooks: Webhooks;
|
|
4393
|
+
/** The organization's webhook destinations: create, update, rotate the signing secret, test. */
|
|
4394
|
+
/** The people you call, with CSV import under `contacts.imports`. */
|
|
4395
|
+
readonly contacts: Contacts;
|
|
4396
|
+
/** Named groups of contacts. */
|
|
4397
|
+
readonly contactLists: ContactLists;
|
|
4398
|
+
/** Browser calls: tokens for `@dialgem/client`, and the origins allowed to start them. */
|
|
4399
|
+
readonly webCalls: WebCalls;
|
|
4400
|
+
/** Saved test conversations for an agent, run in text, with an optional publish gate. */
|
|
4401
|
+
readonly simulations: Simulations;
|
|
2737
4402
|
/** Always `https://api.dialgem.com`. */
|
|
2738
4403
|
readonly baseURL: string;
|
|
2739
4404
|
constructor(options?: ClientOptions);
|
|
2740
4405
|
}
|
|
2741
4406
|
|
|
2742
|
-
declare const VERSION = "0.1.0-beta.
|
|
4407
|
+
declare const VERSION = "0.1.0-beta.3";
|
|
2743
4408
|
|
|
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 };
|
|
4409
|
+
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, type AvailablePhoneNumber, type AvailablePhoneNumbers, 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 PhoneNumberBuyParams, type PhoneNumberCreateParams, type PhoneNumberSearchParams, type PhoneNumberUpdateParams, PhoneNumbers, type PostCallAnalysisVariable, type PostCallBuiltinFields, type PromptState, type PromptTemplate, type PromptTemplateSummary, PromptTemplates, type PurchasedPhoneNumber, 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 };
|