nixflex 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/index.cjs +83 -1
- package/dist/index.d.cts +154 -1
- package/dist/index.d.ts +154 -1
- package/dist/index.js +83 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 0.6.0
|
|
2
|
+
- New: `client.callers` - caller context on one of your numbers: `get()`, `set()` (omitted fields kept, null removes), `delete()` (erases yours and the engine's), `import()` (up to 1,000 rows, validated before any write). One record per (your number, caller number). Docs: https://docs.nixflex.com/concepts/caller-context
|
|
3
|
+
- New: `incall_sms_enabled` on agent create/update/get - texting during a call and automatic booking-confirmation texts. Default false for new agents. Docs: https://docs.nixflex.com/actions/in-call-sms
|
|
4
|
+
- Fix: User-Agent now reports the real SDK version (was stuck at 0.1.0).
|
|
5
|
+
## 0.5.0
|
|
6
|
+
|
|
7
|
+
- New: `client.llm` - bring your own OpenAI-compatible model (set() verifies with a real completion + tool-calling probe, key write-only). Calls it serves bill at -0.015/min.
|
|
8
|
+
- New: `client.tts` - bring your own voice (elevenlabs/cartesia, set() verifies with a real synthesis, key write-only). Phone calls only; -0.02/min.
|
|
9
|
+
- Docs: https://docs.nixflex.com/advanced/your-own-llm and /advanced/your-own-tts
|
|
10
|
+
|
|
1
11
|
## 0.4.0
|
|
2
12
|
|
|
3
13
|
- New: `client.storage` - connect your own S3-compatible bucket for call recordings (data residency). `storage.set()` verifies with a probe write before saving, `storage.get()` never returns the secret, `storage.delete()` disconnects. Recordings then upload to your bucket and `recording_url` becomes a `byo:` path. See https://docs.nixflex.com/advanced/your-own-storage
|
package/dist/index.cjs
CHANGED
|
@@ -117,7 +117,7 @@ function errorFromResponse(status, body, requestId, retryAfterSeconds) {
|
|
|
117
117
|
// src/client.ts
|
|
118
118
|
var DEFAULT_BASE_URL = "https://api.nixflex.com";
|
|
119
119
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
120
|
-
var SDK_VERSION = "0.
|
|
120
|
+
var SDK_VERSION = "0.6.0";
|
|
121
121
|
var HttpClient = class {
|
|
122
122
|
apiKey;
|
|
123
123
|
baseUrl;
|
|
@@ -487,6 +487,49 @@ var Storage = class {
|
|
|
487
487
|
return this.http.request("DELETE", "/account/storage", void 0, void 0, opts);
|
|
488
488
|
}
|
|
489
489
|
};
|
|
490
|
+
var Llm = class {
|
|
491
|
+
constructor(http) {
|
|
492
|
+
this.http = http;
|
|
493
|
+
}
|
|
494
|
+
http;
|
|
495
|
+
/** Connect an OpenAI-compatible model. Verified BEFORE saving with a real
|
|
496
|
+
* completion + a tool-calling round trip (models without tool calling are
|
|
497
|
+
* refused). Calls your model serves bill at a $0.015/min discount; if it
|
|
498
|
+
* fails on a call the standard stack takes over and that call bills standard. */
|
|
499
|
+
set(params, opts) {
|
|
500
|
+
return this.http.request("PUT", "/account/llm", params, void 0, opts);
|
|
501
|
+
}
|
|
502
|
+
/** Current LLM configuration. The provider key is never included. */
|
|
503
|
+
get(opts) {
|
|
504
|
+
return this.http.request("GET", "/account/llm", void 0, void 0, opts);
|
|
505
|
+
}
|
|
506
|
+
/** Disconnect. Calls return to the standard stack and rate from the next call. */
|
|
507
|
+
delete(opts) {
|
|
508
|
+
return this.http.request("DELETE", "/account/llm", void 0, void 0, opts);
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
var Tts = class {
|
|
512
|
+
constructor(http) {
|
|
513
|
+
this.http = http;
|
|
514
|
+
}
|
|
515
|
+
http;
|
|
516
|
+
/** Connect your voice provider (elevenlabs or cartesia). Verified BEFORE
|
|
517
|
+
* saving with one real synthesis using the exact voice ID. Phone calls only -
|
|
518
|
+
* web calls keep the standard voice. Calls your voice serves bill at a
|
|
519
|
+
* $0.02/min discount; on failure the standard voice takes over and that call
|
|
520
|
+
* bills the standard TTS rate. */
|
|
521
|
+
set(params, opts) {
|
|
522
|
+
return this.http.request("PUT", "/account/tts", params, void 0, opts);
|
|
523
|
+
}
|
|
524
|
+
/** Current TTS configuration. The provider key is never included. */
|
|
525
|
+
get(opts) {
|
|
526
|
+
return this.http.request("GET", "/account/tts", void 0, void 0, opts);
|
|
527
|
+
}
|
|
528
|
+
/** Disconnect. Calls return to the standard voice and rate from the next call. */
|
|
529
|
+
delete(opts) {
|
|
530
|
+
return this.http.request("DELETE", "/account/tts", void 0, void 0, opts);
|
|
531
|
+
}
|
|
532
|
+
};
|
|
490
533
|
var Webhooks = class {
|
|
491
534
|
constructor(http) {
|
|
492
535
|
this.http = http;
|
|
@@ -516,6 +559,36 @@ var Webhooks = class {
|
|
|
516
559
|
}
|
|
517
560
|
};
|
|
518
561
|
|
|
562
|
+
// src/resources/callers.ts
|
|
563
|
+
function enc2(phoneNumber) {
|
|
564
|
+
return encodeURIComponent(phoneNumber);
|
|
565
|
+
}
|
|
566
|
+
var Callers = class {
|
|
567
|
+
constructor(http) {
|
|
568
|
+
this.http = http;
|
|
569
|
+
}
|
|
570
|
+
http;
|
|
571
|
+
/** What the agent knows about this caller on this number - your fields plus
|
|
572
|
+
* what the engine learned. 404 caller_not_found when there is no record. */
|
|
573
|
+
get(phoneNumber, callerNumber, opts) {
|
|
574
|
+
return this.http.request("GET", `/phone-numbers/${enc2(phoneNumber)}/callers/${enc2(callerNumber)}`, void 0, void 0, opts);
|
|
575
|
+
}
|
|
576
|
+
/** Set the caller's details. A field left out keeps its value; null removes it.
|
|
577
|
+
* last_call / open_item are engine-only and are rejected (engine_only_field). */
|
|
578
|
+
set(phoneNumber, callerNumber, params, opts) {
|
|
579
|
+
return this.http.request("PUT", `/phone-numbers/${enc2(phoneNumber)}/callers/${enc2(callerNumber)}`, params, void 0, opts);
|
|
580
|
+
}
|
|
581
|
+
/** Erase the whole record for this caller on this number - yours and the engine's. */
|
|
582
|
+
delete(phoneNumber, callerNumber, opts) {
|
|
583
|
+
return this.http.request("DELETE", `/phone-numbers/${enc2(phoneNumber)}/callers/${enc2(callerNumber)}`, void 0, void 0, opts);
|
|
584
|
+
}
|
|
585
|
+
/** Up to 1,000 rows in one request. Every row is validated before any is
|
|
586
|
+
* written. Split larger lists into several calls. */
|
|
587
|
+
import(phoneNumber, callers, opts) {
|
|
588
|
+
return this.http.request("POST", `/phone-numbers/${enc2(phoneNumber)}/callers/import`, { callers }, void 0, opts);
|
|
589
|
+
}
|
|
590
|
+
};
|
|
591
|
+
|
|
519
592
|
// src/index.ts
|
|
520
593
|
var Nixflex = class {
|
|
521
594
|
/** AI agents - create, list, get, update, delete. */
|
|
@@ -536,6 +609,12 @@ var Nixflex = class {
|
|
|
536
609
|
webhooks;
|
|
537
610
|
/** Your own S3-compatible recording storage (data residency). */
|
|
538
611
|
storage;
|
|
612
|
+
/** Your own LLM (OpenAI-compatible endpoint, verified with tool-calling probe). */
|
|
613
|
+
llm;
|
|
614
|
+
/** Your own TTS (elevenlabs/cartesia, verified with a real synthesis). */
|
|
615
|
+
tts;
|
|
616
|
+
/** Caller context - what the agent knows about each caller on one of your numbers. */
|
|
617
|
+
callers;
|
|
539
618
|
constructor(options) {
|
|
540
619
|
const http = new HttpClient(options);
|
|
541
620
|
this.agents = new Agents(http);
|
|
@@ -547,6 +626,9 @@ var Nixflex = class {
|
|
|
547
626
|
this.usage = new UsageResource(http);
|
|
548
627
|
this.webhooks = new Webhooks(http);
|
|
549
628
|
this.storage = new Storage(http);
|
|
629
|
+
this.llm = new Llm(http);
|
|
630
|
+
this.tts = new Tts(http);
|
|
631
|
+
this.callers = new Callers(http);
|
|
550
632
|
}
|
|
551
633
|
/** Create a brand-new API key (unauthenticated signup endpoint - most
|
|
552
634
|
* developers use the dashboard instead). The key_secret is shown ONCE.
|
package/dist/index.d.cts
CHANGED
|
@@ -129,6 +129,9 @@ interface Agent {
|
|
|
129
129
|
greet_by_name?: boolean;
|
|
130
130
|
fallback_message: string;
|
|
131
131
|
post_call_sms_enabled?: boolean;
|
|
132
|
+
/** Texting during a call + automatic booking-confirmation texts. Default false for
|
|
133
|
+
* new agents; agents created before this setting existed were switched on. */
|
|
134
|
+
incall_sms_enabled?: boolean;
|
|
132
135
|
post_call_sms_template?: string | null;
|
|
133
136
|
voicemail_leave_enabled?: boolean;
|
|
134
137
|
voicemail_message?: string | null;
|
|
@@ -608,6 +611,57 @@ interface StorageDeleteResponse {
|
|
|
608
611
|
ok: boolean;
|
|
609
612
|
storage_enabled: boolean;
|
|
610
613
|
}
|
|
614
|
+
/** Your own LLM (BYO LLM) - an OpenAI-compatible endpoint answers every call. */
|
|
615
|
+
interface LlmConfig {
|
|
616
|
+
byo_llm_enabled: boolean;
|
|
617
|
+
endpoint: string | null;
|
|
618
|
+
model: string | null;
|
|
619
|
+
}
|
|
620
|
+
interface LlmSetParams {
|
|
621
|
+
/** OpenAI-compatible https:// base URL, e.g. https://api.openai.com/v1 */
|
|
622
|
+
endpoint: string;
|
|
623
|
+
/** Model name as your provider knows it. Must support OpenAI-style tool calling. */
|
|
624
|
+
model: string;
|
|
625
|
+
/** Your provider API key. Write-only - stored encrypted, never returned. */
|
|
626
|
+
api_key: string;
|
|
627
|
+
}
|
|
628
|
+
interface LlmSetResponse {
|
|
629
|
+
ok: boolean;
|
|
630
|
+
byo_llm_enabled: boolean;
|
|
631
|
+
endpoint: string;
|
|
632
|
+
model: string;
|
|
633
|
+
verified: boolean;
|
|
634
|
+
}
|
|
635
|
+
interface LlmDeleteResponse {
|
|
636
|
+
ok: boolean;
|
|
637
|
+
byo_llm_enabled: boolean;
|
|
638
|
+
}
|
|
639
|
+
/** Your own TTS (BYO TTS) - your voice provider speaks on every phone call. */
|
|
640
|
+
type TtsProvider = 'elevenlabs' | 'cartesia';
|
|
641
|
+
interface TtsConfig {
|
|
642
|
+
byo_tts_enabled: boolean;
|
|
643
|
+
provider: TtsProvider | null;
|
|
644
|
+
voice_id: string | null;
|
|
645
|
+
}
|
|
646
|
+
interface TtsSetParams {
|
|
647
|
+
/** 'elevenlabs' or 'cartesia'. */
|
|
648
|
+
provider: TtsProvider;
|
|
649
|
+
/** Voice ID exactly as shown in your provider console. */
|
|
650
|
+
voice_id: string;
|
|
651
|
+
/** Your provider API key. Write-only - stored encrypted, never returned. */
|
|
652
|
+
api_key: string;
|
|
653
|
+
}
|
|
654
|
+
interface TtsSetResponse {
|
|
655
|
+
ok: boolean;
|
|
656
|
+
byo_tts_enabled: boolean;
|
|
657
|
+
provider: TtsProvider;
|
|
658
|
+
voice_id: string;
|
|
659
|
+
verified: boolean;
|
|
660
|
+
}
|
|
661
|
+
interface TtsDeleteResponse {
|
|
662
|
+
ok: boolean;
|
|
663
|
+
byo_tts_enabled: boolean;
|
|
664
|
+
}
|
|
611
665
|
|
|
612
666
|
declare class PhoneNumbers {
|
|
613
667
|
private readonly http;
|
|
@@ -710,6 +764,34 @@ declare class Storage {
|
|
|
710
764
|
delete(opts?: RequestOptions): Promise<StorageDeleteResponse>;
|
|
711
765
|
}
|
|
712
766
|
|
|
767
|
+
declare class Llm {
|
|
768
|
+
private readonly http;
|
|
769
|
+
constructor(http: HttpClient);
|
|
770
|
+
/** Connect an OpenAI-compatible model. Verified BEFORE saving with a real
|
|
771
|
+
* completion + a tool-calling round trip (models without tool calling are
|
|
772
|
+
* refused). Calls your model serves bill at a $0.015/min discount; if it
|
|
773
|
+
* fails on a call the standard stack takes over and that call bills standard. */
|
|
774
|
+
set(params: LlmSetParams, opts?: RequestOptions): Promise<LlmSetResponse>;
|
|
775
|
+
/** Current LLM configuration. The provider key is never included. */
|
|
776
|
+
get(opts?: RequestOptions): Promise<LlmConfig>;
|
|
777
|
+
/** Disconnect. Calls return to the standard stack and rate from the next call. */
|
|
778
|
+
delete(opts?: RequestOptions): Promise<LlmDeleteResponse>;
|
|
779
|
+
}
|
|
780
|
+
declare class Tts {
|
|
781
|
+
private readonly http;
|
|
782
|
+
constructor(http: HttpClient);
|
|
783
|
+
/** Connect your voice provider (elevenlabs or cartesia). Verified BEFORE
|
|
784
|
+
* saving with one real synthesis using the exact voice ID. Phone calls only -
|
|
785
|
+
* web calls keep the standard voice. Calls your voice serves bill at a
|
|
786
|
+
* $0.02/min discount; on failure the standard voice takes over and that call
|
|
787
|
+
* bills the standard TTS rate. */
|
|
788
|
+
set(params: TtsSetParams, opts?: RequestOptions): Promise<TtsSetResponse>;
|
|
789
|
+
/** Current TTS configuration. The provider key is never included. */
|
|
790
|
+
get(opts?: RequestOptions): Promise<TtsConfig>;
|
|
791
|
+
/** Disconnect. Calls return to the standard voice and rate from the next call. */
|
|
792
|
+
delete(opts?: RequestOptions): Promise<TtsDeleteResponse>;
|
|
793
|
+
}
|
|
794
|
+
|
|
713
795
|
declare class Webhooks {
|
|
714
796
|
private readonly http;
|
|
715
797
|
constructor(http: HttpClient);
|
|
@@ -726,6 +808,71 @@ declare class Webhooks {
|
|
|
726
808
|
delete(phoneNumber: string, slot?: 1 | 2, opts?: RequestOptions): Promise<WebhookConfigResponse>;
|
|
727
809
|
}
|
|
728
810
|
|
|
811
|
+
/** The six fields a developer may set. Omitted = kept; null = removed. */
|
|
812
|
+
interface CallerContextSetParams {
|
|
813
|
+
/** Full name - first and last. */
|
|
814
|
+
name?: string | null;
|
|
815
|
+
email?: string | null;
|
|
816
|
+
/** A contact number other than the one they call from. */
|
|
817
|
+
phone?: string | null;
|
|
818
|
+
/** Free text - city, area or postal code. */
|
|
819
|
+
location?: string | null;
|
|
820
|
+
/** An account, order or booking reference the caller uses. */
|
|
821
|
+
reference_id?: string | null;
|
|
822
|
+
/** A short preference, e.g. "prefers morning appointments". */
|
|
823
|
+
preference?: string | null;
|
|
824
|
+
}
|
|
825
|
+
/** The record as returned. Only fields with a value are present. */
|
|
826
|
+
interface CallerContextFields {
|
|
827
|
+
name?: string;
|
|
828
|
+
email?: string;
|
|
829
|
+
phone?: string;
|
|
830
|
+
location?: string;
|
|
831
|
+
reference_id?: string;
|
|
832
|
+
preference?: string;
|
|
833
|
+
/** Engine-written: what the caller wanted on their last call - never what happened. */
|
|
834
|
+
last_call?: string;
|
|
835
|
+
/** Engine-written: something still pending for the caller. */
|
|
836
|
+
open_item?: string;
|
|
837
|
+
}
|
|
838
|
+
interface CallerContext {
|
|
839
|
+
phone_number: string;
|
|
840
|
+
caller_number: string;
|
|
841
|
+
context: CallerContextFields;
|
|
842
|
+
}
|
|
843
|
+
interface CallerContextResponse {
|
|
844
|
+
caller: CallerContext;
|
|
845
|
+
}
|
|
846
|
+
interface CallerContextDeleteResponse {
|
|
847
|
+
phone_number: string;
|
|
848
|
+
caller_number: string;
|
|
849
|
+
deleted: true;
|
|
850
|
+
}
|
|
851
|
+
interface CallerImportRow extends CallerContextSetParams {
|
|
852
|
+
/** The caller's number in E.164 form. */
|
|
853
|
+
caller_number: string;
|
|
854
|
+
}
|
|
855
|
+
interface CallerImportResponse {
|
|
856
|
+
phone_number: string;
|
|
857
|
+
imported: number;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
declare class Callers {
|
|
861
|
+
private readonly http;
|
|
862
|
+
constructor(http: HttpClient);
|
|
863
|
+
/** What the agent knows about this caller on this number - your fields plus
|
|
864
|
+
* what the engine learned. 404 caller_not_found when there is no record. */
|
|
865
|
+
get(phoneNumber: string, callerNumber: string, opts?: RequestOptions): Promise<CallerContextResponse>;
|
|
866
|
+
/** Set the caller's details. A field left out keeps its value; null removes it.
|
|
867
|
+
* last_call / open_item are engine-only and are rejected (engine_only_field). */
|
|
868
|
+
set(phoneNumber: string, callerNumber: string, params: CallerContextSetParams, opts?: RequestOptions): Promise<CallerContextResponse>;
|
|
869
|
+
/** Erase the whole record for this caller on this number - yours and the engine's. */
|
|
870
|
+
delete(phoneNumber: string, callerNumber: string, opts?: RequestOptions): Promise<CallerContextDeleteResponse>;
|
|
871
|
+
/** Up to 1,000 rows in one request. Every row is validated before any is
|
|
872
|
+
* written. Split larger lists into several calls. */
|
|
873
|
+
import(phoneNumber: string, callers: CallerImportRow[], opts?: RequestOptions): Promise<CallerImportResponse>;
|
|
874
|
+
}
|
|
875
|
+
|
|
729
876
|
interface NixflexAPIErrorBody {
|
|
730
877
|
error: {
|
|
731
878
|
type: string;
|
|
@@ -801,6 +948,12 @@ declare class Nixflex {
|
|
|
801
948
|
readonly webhooks: Webhooks;
|
|
802
949
|
/** Your own S3-compatible recording storage (data residency). */
|
|
803
950
|
readonly storage: Storage;
|
|
951
|
+
/** Your own LLM (OpenAI-compatible endpoint, verified with tool-calling probe). */
|
|
952
|
+
readonly llm: Llm;
|
|
953
|
+
/** Your own TTS (elevenlabs/cartesia, verified with a real synthesis). */
|
|
954
|
+
readonly tts: Tts;
|
|
955
|
+
/** Caller context - what the agent knows about each caller on one of your numbers. */
|
|
956
|
+
readonly callers: Callers;
|
|
804
957
|
constructor(options: NixflexClientOptions);
|
|
805
958
|
/** Create a brand-new API key (unauthenticated signup endpoint - most
|
|
806
959
|
* developers use the dashboard instead). The key_secret is shown ONCE.
|
|
@@ -811,4 +964,4 @@ declare class Nixflex {
|
|
|
811
964
|
}, baseUrl?: string): Promise<KeyCreateResponse>;
|
|
812
965
|
}
|
|
813
966
|
|
|
814
|
-
export { type Agent, type AgentCreateParams, type AgentDeleteResponse, type AgentUpdateParams, type BatchCampaignParams, type BatchCreateResponse, type BatchInvalidEntry, type BatchLaunchResponse, type BatchRecipient, type Call, type CallDeleteAllResponse, type CallDeleteResponse, type CallDirection, type CallerSentiment, type KeyCreateResponse, type KeyRotateResponse, type ListParams, type MonitorToggleResponse, Nixflex, type NixflexAPIErrorBody, NixflexAuthenticationError, type NixflexClientOptions, NixflexConnectionError, NixflexError, NixflexInvalidRequestError, NixflexNotFoundError, NixflexPaymentRequiredError, NixflexRateLimitError, NixflexServerError, type OutboundCallParams, type OutboundCallResponse, type PhoneNumber, type PhoneNumberDeleteResponse, type PhoneNumberImportParams, type PhoneNumberListResponse, type PhoneNumberUpdateParams, type RequestOptions, type ResponseLength, type SmsCampaign, type SmsCampaignCreateParams, type SmsCampaignDeleteResponse, type SmsCampaignLaunchResponse, type SmsCampaignListResponse, type SmsCampaignRecipient, type SmsCampaignStatus, type SmsSendParams, type SmsSendResponse, type StorageConfig, type StorageDeleteResponse, type StorageSetParams, type StorageSetResponse, type TransferType, type Usage, type VerifyOptions, type WebCallsToggleResponse, type WebhookConfigResponse, type Weekday, Nixflex as default, errorFromResponse, verifyWebhookSignature };
|
|
967
|
+
export { type Agent, type AgentCreateParams, type AgentDeleteResponse, type AgentUpdateParams, type BatchCampaignParams, type BatchCreateResponse, type BatchInvalidEntry, type BatchLaunchResponse, type BatchRecipient, type Call, type CallDeleteAllResponse, type CallDeleteResponse, type CallDirection, type CallerContext, type CallerContextDeleteResponse, type CallerContextFields, type CallerContextResponse, type CallerContextSetParams, type CallerImportResponse, type CallerImportRow, type CallerSentiment, type KeyCreateResponse, type KeyRotateResponse, type ListParams, type LlmConfig, type LlmDeleteResponse, type LlmSetParams, type LlmSetResponse, type MonitorToggleResponse, Nixflex, type NixflexAPIErrorBody, NixflexAuthenticationError, type NixflexClientOptions, NixflexConnectionError, NixflexError, NixflexInvalidRequestError, NixflexNotFoundError, NixflexPaymentRequiredError, NixflexRateLimitError, NixflexServerError, type OutboundCallParams, type OutboundCallResponse, type PhoneNumber, type PhoneNumberDeleteResponse, type PhoneNumberImportParams, type PhoneNumberListResponse, type PhoneNumberUpdateParams, type RequestOptions, type ResponseLength, type SmsCampaign, type SmsCampaignCreateParams, type SmsCampaignDeleteResponse, type SmsCampaignLaunchResponse, type SmsCampaignListResponse, type SmsCampaignRecipient, type SmsCampaignStatus, type SmsSendParams, type SmsSendResponse, type StorageConfig, type StorageDeleteResponse, type StorageSetParams, type StorageSetResponse, type TransferType, type TtsConfig, type TtsDeleteResponse, type TtsProvider, type TtsSetParams, type TtsSetResponse, type Usage, type VerifyOptions, type WebCallsToggleResponse, type WebhookConfigResponse, type Weekday, Nixflex as default, errorFromResponse, verifyWebhookSignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -129,6 +129,9 @@ interface Agent {
|
|
|
129
129
|
greet_by_name?: boolean;
|
|
130
130
|
fallback_message: string;
|
|
131
131
|
post_call_sms_enabled?: boolean;
|
|
132
|
+
/** Texting during a call + automatic booking-confirmation texts. Default false for
|
|
133
|
+
* new agents; agents created before this setting existed were switched on. */
|
|
134
|
+
incall_sms_enabled?: boolean;
|
|
132
135
|
post_call_sms_template?: string | null;
|
|
133
136
|
voicemail_leave_enabled?: boolean;
|
|
134
137
|
voicemail_message?: string | null;
|
|
@@ -608,6 +611,57 @@ interface StorageDeleteResponse {
|
|
|
608
611
|
ok: boolean;
|
|
609
612
|
storage_enabled: boolean;
|
|
610
613
|
}
|
|
614
|
+
/** Your own LLM (BYO LLM) - an OpenAI-compatible endpoint answers every call. */
|
|
615
|
+
interface LlmConfig {
|
|
616
|
+
byo_llm_enabled: boolean;
|
|
617
|
+
endpoint: string | null;
|
|
618
|
+
model: string | null;
|
|
619
|
+
}
|
|
620
|
+
interface LlmSetParams {
|
|
621
|
+
/** OpenAI-compatible https:// base URL, e.g. https://api.openai.com/v1 */
|
|
622
|
+
endpoint: string;
|
|
623
|
+
/** Model name as your provider knows it. Must support OpenAI-style tool calling. */
|
|
624
|
+
model: string;
|
|
625
|
+
/** Your provider API key. Write-only - stored encrypted, never returned. */
|
|
626
|
+
api_key: string;
|
|
627
|
+
}
|
|
628
|
+
interface LlmSetResponse {
|
|
629
|
+
ok: boolean;
|
|
630
|
+
byo_llm_enabled: boolean;
|
|
631
|
+
endpoint: string;
|
|
632
|
+
model: string;
|
|
633
|
+
verified: boolean;
|
|
634
|
+
}
|
|
635
|
+
interface LlmDeleteResponse {
|
|
636
|
+
ok: boolean;
|
|
637
|
+
byo_llm_enabled: boolean;
|
|
638
|
+
}
|
|
639
|
+
/** Your own TTS (BYO TTS) - your voice provider speaks on every phone call. */
|
|
640
|
+
type TtsProvider = 'elevenlabs' | 'cartesia';
|
|
641
|
+
interface TtsConfig {
|
|
642
|
+
byo_tts_enabled: boolean;
|
|
643
|
+
provider: TtsProvider | null;
|
|
644
|
+
voice_id: string | null;
|
|
645
|
+
}
|
|
646
|
+
interface TtsSetParams {
|
|
647
|
+
/** 'elevenlabs' or 'cartesia'. */
|
|
648
|
+
provider: TtsProvider;
|
|
649
|
+
/** Voice ID exactly as shown in your provider console. */
|
|
650
|
+
voice_id: string;
|
|
651
|
+
/** Your provider API key. Write-only - stored encrypted, never returned. */
|
|
652
|
+
api_key: string;
|
|
653
|
+
}
|
|
654
|
+
interface TtsSetResponse {
|
|
655
|
+
ok: boolean;
|
|
656
|
+
byo_tts_enabled: boolean;
|
|
657
|
+
provider: TtsProvider;
|
|
658
|
+
voice_id: string;
|
|
659
|
+
verified: boolean;
|
|
660
|
+
}
|
|
661
|
+
interface TtsDeleteResponse {
|
|
662
|
+
ok: boolean;
|
|
663
|
+
byo_tts_enabled: boolean;
|
|
664
|
+
}
|
|
611
665
|
|
|
612
666
|
declare class PhoneNumbers {
|
|
613
667
|
private readonly http;
|
|
@@ -710,6 +764,34 @@ declare class Storage {
|
|
|
710
764
|
delete(opts?: RequestOptions): Promise<StorageDeleteResponse>;
|
|
711
765
|
}
|
|
712
766
|
|
|
767
|
+
declare class Llm {
|
|
768
|
+
private readonly http;
|
|
769
|
+
constructor(http: HttpClient);
|
|
770
|
+
/** Connect an OpenAI-compatible model. Verified BEFORE saving with a real
|
|
771
|
+
* completion + a tool-calling round trip (models without tool calling are
|
|
772
|
+
* refused). Calls your model serves bill at a $0.015/min discount; if it
|
|
773
|
+
* fails on a call the standard stack takes over and that call bills standard. */
|
|
774
|
+
set(params: LlmSetParams, opts?: RequestOptions): Promise<LlmSetResponse>;
|
|
775
|
+
/** Current LLM configuration. The provider key is never included. */
|
|
776
|
+
get(opts?: RequestOptions): Promise<LlmConfig>;
|
|
777
|
+
/** Disconnect. Calls return to the standard stack and rate from the next call. */
|
|
778
|
+
delete(opts?: RequestOptions): Promise<LlmDeleteResponse>;
|
|
779
|
+
}
|
|
780
|
+
declare class Tts {
|
|
781
|
+
private readonly http;
|
|
782
|
+
constructor(http: HttpClient);
|
|
783
|
+
/** Connect your voice provider (elevenlabs or cartesia). Verified BEFORE
|
|
784
|
+
* saving with one real synthesis using the exact voice ID. Phone calls only -
|
|
785
|
+
* web calls keep the standard voice. Calls your voice serves bill at a
|
|
786
|
+
* $0.02/min discount; on failure the standard voice takes over and that call
|
|
787
|
+
* bills the standard TTS rate. */
|
|
788
|
+
set(params: TtsSetParams, opts?: RequestOptions): Promise<TtsSetResponse>;
|
|
789
|
+
/** Current TTS configuration. The provider key is never included. */
|
|
790
|
+
get(opts?: RequestOptions): Promise<TtsConfig>;
|
|
791
|
+
/** Disconnect. Calls return to the standard voice and rate from the next call. */
|
|
792
|
+
delete(opts?: RequestOptions): Promise<TtsDeleteResponse>;
|
|
793
|
+
}
|
|
794
|
+
|
|
713
795
|
declare class Webhooks {
|
|
714
796
|
private readonly http;
|
|
715
797
|
constructor(http: HttpClient);
|
|
@@ -726,6 +808,71 @@ declare class Webhooks {
|
|
|
726
808
|
delete(phoneNumber: string, slot?: 1 | 2, opts?: RequestOptions): Promise<WebhookConfigResponse>;
|
|
727
809
|
}
|
|
728
810
|
|
|
811
|
+
/** The six fields a developer may set. Omitted = kept; null = removed. */
|
|
812
|
+
interface CallerContextSetParams {
|
|
813
|
+
/** Full name - first and last. */
|
|
814
|
+
name?: string | null;
|
|
815
|
+
email?: string | null;
|
|
816
|
+
/** A contact number other than the one they call from. */
|
|
817
|
+
phone?: string | null;
|
|
818
|
+
/** Free text - city, area or postal code. */
|
|
819
|
+
location?: string | null;
|
|
820
|
+
/** An account, order or booking reference the caller uses. */
|
|
821
|
+
reference_id?: string | null;
|
|
822
|
+
/** A short preference, e.g. "prefers morning appointments". */
|
|
823
|
+
preference?: string | null;
|
|
824
|
+
}
|
|
825
|
+
/** The record as returned. Only fields with a value are present. */
|
|
826
|
+
interface CallerContextFields {
|
|
827
|
+
name?: string;
|
|
828
|
+
email?: string;
|
|
829
|
+
phone?: string;
|
|
830
|
+
location?: string;
|
|
831
|
+
reference_id?: string;
|
|
832
|
+
preference?: string;
|
|
833
|
+
/** Engine-written: what the caller wanted on their last call - never what happened. */
|
|
834
|
+
last_call?: string;
|
|
835
|
+
/** Engine-written: something still pending for the caller. */
|
|
836
|
+
open_item?: string;
|
|
837
|
+
}
|
|
838
|
+
interface CallerContext {
|
|
839
|
+
phone_number: string;
|
|
840
|
+
caller_number: string;
|
|
841
|
+
context: CallerContextFields;
|
|
842
|
+
}
|
|
843
|
+
interface CallerContextResponse {
|
|
844
|
+
caller: CallerContext;
|
|
845
|
+
}
|
|
846
|
+
interface CallerContextDeleteResponse {
|
|
847
|
+
phone_number: string;
|
|
848
|
+
caller_number: string;
|
|
849
|
+
deleted: true;
|
|
850
|
+
}
|
|
851
|
+
interface CallerImportRow extends CallerContextSetParams {
|
|
852
|
+
/** The caller's number in E.164 form. */
|
|
853
|
+
caller_number: string;
|
|
854
|
+
}
|
|
855
|
+
interface CallerImportResponse {
|
|
856
|
+
phone_number: string;
|
|
857
|
+
imported: number;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
declare class Callers {
|
|
861
|
+
private readonly http;
|
|
862
|
+
constructor(http: HttpClient);
|
|
863
|
+
/** What the agent knows about this caller on this number - your fields plus
|
|
864
|
+
* what the engine learned. 404 caller_not_found when there is no record. */
|
|
865
|
+
get(phoneNumber: string, callerNumber: string, opts?: RequestOptions): Promise<CallerContextResponse>;
|
|
866
|
+
/** Set the caller's details. A field left out keeps its value; null removes it.
|
|
867
|
+
* last_call / open_item are engine-only and are rejected (engine_only_field). */
|
|
868
|
+
set(phoneNumber: string, callerNumber: string, params: CallerContextSetParams, opts?: RequestOptions): Promise<CallerContextResponse>;
|
|
869
|
+
/** Erase the whole record for this caller on this number - yours and the engine's. */
|
|
870
|
+
delete(phoneNumber: string, callerNumber: string, opts?: RequestOptions): Promise<CallerContextDeleteResponse>;
|
|
871
|
+
/** Up to 1,000 rows in one request. Every row is validated before any is
|
|
872
|
+
* written. Split larger lists into several calls. */
|
|
873
|
+
import(phoneNumber: string, callers: CallerImportRow[], opts?: RequestOptions): Promise<CallerImportResponse>;
|
|
874
|
+
}
|
|
875
|
+
|
|
729
876
|
interface NixflexAPIErrorBody {
|
|
730
877
|
error: {
|
|
731
878
|
type: string;
|
|
@@ -801,6 +948,12 @@ declare class Nixflex {
|
|
|
801
948
|
readonly webhooks: Webhooks;
|
|
802
949
|
/** Your own S3-compatible recording storage (data residency). */
|
|
803
950
|
readonly storage: Storage;
|
|
951
|
+
/** Your own LLM (OpenAI-compatible endpoint, verified with tool-calling probe). */
|
|
952
|
+
readonly llm: Llm;
|
|
953
|
+
/** Your own TTS (elevenlabs/cartesia, verified with a real synthesis). */
|
|
954
|
+
readonly tts: Tts;
|
|
955
|
+
/** Caller context - what the agent knows about each caller on one of your numbers. */
|
|
956
|
+
readonly callers: Callers;
|
|
804
957
|
constructor(options: NixflexClientOptions);
|
|
805
958
|
/** Create a brand-new API key (unauthenticated signup endpoint - most
|
|
806
959
|
* developers use the dashboard instead). The key_secret is shown ONCE.
|
|
@@ -811,4 +964,4 @@ declare class Nixflex {
|
|
|
811
964
|
}, baseUrl?: string): Promise<KeyCreateResponse>;
|
|
812
965
|
}
|
|
813
966
|
|
|
814
|
-
export { type Agent, type AgentCreateParams, type AgentDeleteResponse, type AgentUpdateParams, type BatchCampaignParams, type BatchCreateResponse, type BatchInvalidEntry, type BatchLaunchResponse, type BatchRecipient, type Call, type CallDeleteAllResponse, type CallDeleteResponse, type CallDirection, type CallerSentiment, type KeyCreateResponse, type KeyRotateResponse, type ListParams, type MonitorToggleResponse, Nixflex, type NixflexAPIErrorBody, NixflexAuthenticationError, type NixflexClientOptions, NixflexConnectionError, NixflexError, NixflexInvalidRequestError, NixflexNotFoundError, NixflexPaymentRequiredError, NixflexRateLimitError, NixflexServerError, type OutboundCallParams, type OutboundCallResponse, type PhoneNumber, type PhoneNumberDeleteResponse, type PhoneNumberImportParams, type PhoneNumberListResponse, type PhoneNumberUpdateParams, type RequestOptions, type ResponseLength, type SmsCampaign, type SmsCampaignCreateParams, type SmsCampaignDeleteResponse, type SmsCampaignLaunchResponse, type SmsCampaignListResponse, type SmsCampaignRecipient, type SmsCampaignStatus, type SmsSendParams, type SmsSendResponse, type StorageConfig, type StorageDeleteResponse, type StorageSetParams, type StorageSetResponse, type TransferType, type Usage, type VerifyOptions, type WebCallsToggleResponse, type WebhookConfigResponse, type Weekday, Nixflex as default, errorFromResponse, verifyWebhookSignature };
|
|
967
|
+
export { type Agent, type AgentCreateParams, type AgentDeleteResponse, type AgentUpdateParams, type BatchCampaignParams, type BatchCreateResponse, type BatchInvalidEntry, type BatchLaunchResponse, type BatchRecipient, type Call, type CallDeleteAllResponse, type CallDeleteResponse, type CallDirection, type CallerContext, type CallerContextDeleteResponse, type CallerContextFields, type CallerContextResponse, type CallerContextSetParams, type CallerImportResponse, type CallerImportRow, type CallerSentiment, type KeyCreateResponse, type KeyRotateResponse, type ListParams, type LlmConfig, type LlmDeleteResponse, type LlmSetParams, type LlmSetResponse, type MonitorToggleResponse, Nixflex, type NixflexAPIErrorBody, NixflexAuthenticationError, type NixflexClientOptions, NixflexConnectionError, NixflexError, NixflexInvalidRequestError, NixflexNotFoundError, NixflexPaymentRequiredError, NixflexRateLimitError, NixflexServerError, type OutboundCallParams, type OutboundCallResponse, type PhoneNumber, type PhoneNumberDeleteResponse, type PhoneNumberImportParams, type PhoneNumberListResponse, type PhoneNumberUpdateParams, type RequestOptions, type ResponseLength, type SmsCampaign, type SmsCampaignCreateParams, type SmsCampaignDeleteResponse, type SmsCampaignLaunchResponse, type SmsCampaignListResponse, type SmsCampaignRecipient, type SmsCampaignStatus, type SmsSendParams, type SmsSendResponse, type StorageConfig, type StorageDeleteResponse, type StorageSetParams, type StorageSetResponse, type TransferType, type TtsConfig, type TtsDeleteResponse, type TtsProvider, type TtsSetParams, type TtsSetResponse, type Usage, type VerifyOptions, type WebCallsToggleResponse, type WebhookConfigResponse, type Weekday, Nixflex as default, errorFromResponse, verifyWebhookSignature };
|
package/dist/index.js
CHANGED
|
@@ -81,7 +81,7 @@ function errorFromResponse(status, body, requestId, retryAfterSeconds) {
|
|
|
81
81
|
// src/client.ts
|
|
82
82
|
var DEFAULT_BASE_URL = "https://api.nixflex.com";
|
|
83
83
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
84
|
-
var SDK_VERSION = "0.
|
|
84
|
+
var SDK_VERSION = "0.6.0";
|
|
85
85
|
var HttpClient = class {
|
|
86
86
|
apiKey;
|
|
87
87
|
baseUrl;
|
|
@@ -451,6 +451,49 @@ var Storage = class {
|
|
|
451
451
|
return this.http.request("DELETE", "/account/storage", void 0, void 0, opts);
|
|
452
452
|
}
|
|
453
453
|
};
|
|
454
|
+
var Llm = class {
|
|
455
|
+
constructor(http) {
|
|
456
|
+
this.http = http;
|
|
457
|
+
}
|
|
458
|
+
http;
|
|
459
|
+
/** Connect an OpenAI-compatible model. Verified BEFORE saving with a real
|
|
460
|
+
* completion + a tool-calling round trip (models without tool calling are
|
|
461
|
+
* refused). Calls your model serves bill at a $0.015/min discount; if it
|
|
462
|
+
* fails on a call the standard stack takes over and that call bills standard. */
|
|
463
|
+
set(params, opts) {
|
|
464
|
+
return this.http.request("PUT", "/account/llm", params, void 0, opts);
|
|
465
|
+
}
|
|
466
|
+
/** Current LLM configuration. The provider key is never included. */
|
|
467
|
+
get(opts) {
|
|
468
|
+
return this.http.request("GET", "/account/llm", void 0, void 0, opts);
|
|
469
|
+
}
|
|
470
|
+
/** Disconnect. Calls return to the standard stack and rate from the next call. */
|
|
471
|
+
delete(opts) {
|
|
472
|
+
return this.http.request("DELETE", "/account/llm", void 0, void 0, opts);
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
var Tts = class {
|
|
476
|
+
constructor(http) {
|
|
477
|
+
this.http = http;
|
|
478
|
+
}
|
|
479
|
+
http;
|
|
480
|
+
/** Connect your voice provider (elevenlabs or cartesia). Verified BEFORE
|
|
481
|
+
* saving with one real synthesis using the exact voice ID. Phone calls only -
|
|
482
|
+
* web calls keep the standard voice. Calls your voice serves bill at a
|
|
483
|
+
* $0.02/min discount; on failure the standard voice takes over and that call
|
|
484
|
+
* bills the standard TTS rate. */
|
|
485
|
+
set(params, opts) {
|
|
486
|
+
return this.http.request("PUT", "/account/tts", params, void 0, opts);
|
|
487
|
+
}
|
|
488
|
+
/** Current TTS configuration. The provider key is never included. */
|
|
489
|
+
get(opts) {
|
|
490
|
+
return this.http.request("GET", "/account/tts", void 0, void 0, opts);
|
|
491
|
+
}
|
|
492
|
+
/** Disconnect. Calls return to the standard voice and rate from the next call. */
|
|
493
|
+
delete(opts) {
|
|
494
|
+
return this.http.request("DELETE", "/account/tts", void 0, void 0, opts);
|
|
495
|
+
}
|
|
496
|
+
};
|
|
454
497
|
var Webhooks = class {
|
|
455
498
|
constructor(http) {
|
|
456
499
|
this.http = http;
|
|
@@ -480,6 +523,36 @@ var Webhooks = class {
|
|
|
480
523
|
}
|
|
481
524
|
};
|
|
482
525
|
|
|
526
|
+
// src/resources/callers.ts
|
|
527
|
+
function enc2(phoneNumber) {
|
|
528
|
+
return encodeURIComponent(phoneNumber);
|
|
529
|
+
}
|
|
530
|
+
var Callers = class {
|
|
531
|
+
constructor(http) {
|
|
532
|
+
this.http = http;
|
|
533
|
+
}
|
|
534
|
+
http;
|
|
535
|
+
/** What the agent knows about this caller on this number - your fields plus
|
|
536
|
+
* what the engine learned. 404 caller_not_found when there is no record. */
|
|
537
|
+
get(phoneNumber, callerNumber, opts) {
|
|
538
|
+
return this.http.request("GET", `/phone-numbers/${enc2(phoneNumber)}/callers/${enc2(callerNumber)}`, void 0, void 0, opts);
|
|
539
|
+
}
|
|
540
|
+
/** Set the caller's details. A field left out keeps its value; null removes it.
|
|
541
|
+
* last_call / open_item are engine-only and are rejected (engine_only_field). */
|
|
542
|
+
set(phoneNumber, callerNumber, params, opts) {
|
|
543
|
+
return this.http.request("PUT", `/phone-numbers/${enc2(phoneNumber)}/callers/${enc2(callerNumber)}`, params, void 0, opts);
|
|
544
|
+
}
|
|
545
|
+
/** Erase the whole record for this caller on this number - yours and the engine's. */
|
|
546
|
+
delete(phoneNumber, callerNumber, opts) {
|
|
547
|
+
return this.http.request("DELETE", `/phone-numbers/${enc2(phoneNumber)}/callers/${enc2(callerNumber)}`, void 0, void 0, opts);
|
|
548
|
+
}
|
|
549
|
+
/** Up to 1,000 rows in one request. Every row is validated before any is
|
|
550
|
+
* written. Split larger lists into several calls. */
|
|
551
|
+
import(phoneNumber, callers, opts) {
|
|
552
|
+
return this.http.request("POST", `/phone-numbers/${enc2(phoneNumber)}/callers/import`, { callers }, void 0, opts);
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
|
|
483
556
|
// src/index.ts
|
|
484
557
|
var Nixflex = class {
|
|
485
558
|
/** AI agents - create, list, get, update, delete. */
|
|
@@ -500,6 +573,12 @@ var Nixflex = class {
|
|
|
500
573
|
webhooks;
|
|
501
574
|
/** Your own S3-compatible recording storage (data residency). */
|
|
502
575
|
storage;
|
|
576
|
+
/** Your own LLM (OpenAI-compatible endpoint, verified with tool-calling probe). */
|
|
577
|
+
llm;
|
|
578
|
+
/** Your own TTS (elevenlabs/cartesia, verified with a real synthesis). */
|
|
579
|
+
tts;
|
|
580
|
+
/** Caller context - what the agent knows about each caller on one of your numbers. */
|
|
581
|
+
callers;
|
|
503
582
|
constructor(options) {
|
|
504
583
|
const http = new HttpClient(options);
|
|
505
584
|
this.agents = new Agents(http);
|
|
@@ -511,6 +590,9 @@ var Nixflex = class {
|
|
|
511
590
|
this.usage = new UsageResource(http);
|
|
512
591
|
this.webhooks = new Webhooks(http);
|
|
513
592
|
this.storage = new Storage(http);
|
|
593
|
+
this.llm = new Llm(http);
|
|
594
|
+
this.tts = new Tts(http);
|
|
595
|
+
this.callers = new Callers(http);
|
|
514
596
|
}
|
|
515
597
|
/** Create a brand-new API key (unauthenticated signup endpoint - most
|
|
516
598
|
* developers use the dashboard instead). The key_secret is shown ONCE.
|