phonic 0.30.32 → 0.30.34
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/README.md +2 -2
- package/dist/cjs/Client.js +2 -2
- package/dist/cjs/api/resources/agents/client/Client.d.ts +47 -12
- package/dist/cjs/api/resources/agents/client/Client.js +119 -18
- package/dist/cjs/api/resources/agents/client/requests/AgentsAddCustomPhoneNumberRequest.d.ts +23 -1
- package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +12 -4
- package/dist/cjs/api/resources/agents/client/requests/AgentsDeleteCustomPhoneNumberRequest.d.ts +16 -0
- package/dist/cjs/api/resources/agents/client/requests/AgentsDeleteCustomPhoneNumberRequest.js +5 -0
- package/dist/cjs/api/resources/agents/client/requests/AgentsUpdatePhoneNumberRequest.d.ts +38 -0
- package/dist/cjs/api/resources/agents/client/requests/AgentsUpdatePhoneNumberRequest.js +5 -0
- package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +14 -6
- package/dist/cjs/api/resources/agents/client/requests/UpsertAgentRequest.d.ts +2 -2
- package/dist/cjs/api/resources/agents/client/requests/index.d.ts +2 -1
- package/dist/cjs/api/resources/agents/types/AgentsDeleteCustomPhoneNumberResponse.d.ts +6 -0
- package/dist/cjs/api/resources/agents/types/AgentsDeleteCustomPhoneNumberResponse.js +5 -0
- package/dist/cjs/api/resources/agents/types/AgentsUpdatePhoneNumberResponse.d.ts +6 -0
- package/dist/cjs/api/resources/agents/types/AgentsUpdatePhoneNumberResponse.js +5 -0
- package/dist/cjs/api/resources/agents/types/index.d.ts +2 -1
- package/dist/cjs/api/resources/agents/types/index.js +2 -1
- package/dist/cjs/api/resources/conversations/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/conversations/client/Client.js +1 -1
- package/dist/cjs/api/resources/conversations/client/requests/OutboundCallRequest.d.ts +1 -1
- package/dist/cjs/api/types/Agent.d.ts +8 -0
- package/dist/cjs/api/types/CreateAgentRequest.d.ts +11 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/resources/agents/client/Client.d.mts +47 -12
- package/dist/esm/api/resources/agents/client/Client.mjs +119 -18
- package/dist/esm/api/resources/agents/client/requests/AgentsAddCustomPhoneNumberRequest.d.mts +23 -1
- package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +12 -4
- package/dist/esm/api/resources/agents/client/requests/AgentsDeleteCustomPhoneNumberRequest.d.mts +16 -0
- package/dist/esm/api/resources/agents/client/requests/AgentsDeleteCustomPhoneNumberRequest.mjs +4 -0
- package/dist/esm/api/resources/agents/client/requests/AgentsUpdatePhoneNumberRequest.d.mts +38 -0
- package/dist/esm/api/resources/agents/client/requests/AgentsUpdatePhoneNumberRequest.mjs +4 -0
- package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +14 -6
- package/dist/esm/api/resources/agents/client/requests/UpsertAgentRequest.d.mts +2 -2
- package/dist/esm/api/resources/agents/client/requests/index.d.mts +2 -1
- package/dist/esm/api/resources/agents/types/AgentsDeleteCustomPhoneNumberResponse.d.mts +6 -0
- package/dist/esm/api/resources/agents/types/AgentsDeleteCustomPhoneNumberResponse.mjs +4 -0
- package/dist/esm/api/resources/agents/types/AgentsUpdatePhoneNumberResponse.d.mts +6 -0
- package/dist/esm/api/resources/agents/types/AgentsUpdatePhoneNumberResponse.mjs +4 -0
- package/dist/esm/api/resources/agents/types/index.d.mts +2 -1
- package/dist/esm/api/resources/agents/types/index.mjs +2 -1
- package/dist/esm/api/resources/conversations/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/conversations/client/Client.mjs +1 -1
- package/dist/esm/api/resources/conversations/client/requests/OutboundCallRequest.d.mts +1 -1
- package/dist/esm/api/types/Agent.d.mts +8 -0
- package/dist/esm/api/types/CreateAgentRequest.d.mts +11 -3
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +99 -11
|
@@ -5,4 +5,5 @@ export * from "./AgentsGetResponse.js";
|
|
|
5
5
|
export * from "./AgentsDeleteResponse.js";
|
|
6
6
|
export * from "./AgentsUpdateResponse.js";
|
|
7
7
|
export * from "./AgentsAddCustomPhoneNumberResponse.js";
|
|
8
|
-
export * from "./
|
|
8
|
+
export * from "./AgentsDeleteCustomPhoneNumberResponse.js";
|
|
9
|
+
export * from "./AgentsUpdatePhoneNumberResponse.js";
|
|
@@ -21,4 +21,5 @@ __exportStar(require("./AgentsGetResponse.js"), exports);
|
|
|
21
21
|
__exportStar(require("./AgentsDeleteResponse.js"), exports);
|
|
22
22
|
__exportStar(require("./AgentsUpdateResponse.js"), exports);
|
|
23
23
|
__exportStar(require("./AgentsAddCustomPhoneNumberResponse.js"), exports);
|
|
24
|
-
__exportStar(require("./
|
|
24
|
+
__exportStar(require("./AgentsDeleteCustomPhoneNumberResponse.js"), exports);
|
|
25
|
+
__exportStar(require("./AgentsUpdatePhoneNumberResponse.js"), exports);
|
|
@@ -201,7 +201,7 @@ export declare class Conversations {
|
|
|
201
201
|
* "customer_name": "David",
|
|
202
202
|
* "subject": "Chess"
|
|
203
203
|
* },
|
|
204
|
-
* voice_id: "
|
|
204
|
+
* voice_id: "sabrina",
|
|
205
205
|
* no_input_poke_sec: 30,
|
|
206
206
|
* no_input_poke_text: "Are you still there?",
|
|
207
207
|
* no_input_end_conversation_sec: 180,
|
|
@@ -709,7 +709,7 @@ class Conversations {
|
|
|
709
709
|
* "customer_name": "David",
|
|
710
710
|
* "subject": "Chess"
|
|
711
711
|
* },
|
|
712
|
-
* voice_id: "
|
|
712
|
+
* voice_id: "sabrina",
|
|
713
713
|
* no_input_poke_sec: 30,
|
|
714
714
|
* no_input_poke_text: "Are you still there?",
|
|
715
715
|
* no_input_end_conversation_sec: 180,
|
|
@@ -14,7 +14,7 @@ import * as Phonic from "../../../../index.js";
|
|
|
14
14
|
* "customer_name": "David",
|
|
15
15
|
* "subject": "Chess"
|
|
16
16
|
* },
|
|
17
|
-
* voice_id: "
|
|
17
|
+
* voice_id: "sabrina",
|
|
18
18
|
* no_input_poke_sec: 30,
|
|
19
19
|
* no_input_poke_text: "Are you still there?",
|
|
20
20
|
* no_input_end_conversation_sec: 180,
|
|
@@ -53,6 +53,14 @@ export interface Agent {
|
|
|
53
53
|
inbound_rollout?: number;
|
|
54
54
|
/** E.164 formatted phone number where non-agent calls will be forwarded. Required when `inbound_rollout < 1.0`, must be `null` when `inbound_rollout = 1.0`. */
|
|
55
55
|
inbound_rollout_forward_phone_number?: string | null;
|
|
56
|
+
/** Voice activity detection prebuffer duration in milliseconds. */
|
|
57
|
+
vad_prebuffer_duration_ms?: number;
|
|
58
|
+
/** Minimum speech duration for voice activity detection in milliseconds. */
|
|
59
|
+
vad_min_speech_duration_ms?: number;
|
|
60
|
+
/** Minimum silence duration for voice activity detection in milliseconds. */
|
|
61
|
+
vad_min_silence_duration_ms?: number;
|
|
62
|
+
/** Voice activity detection threshold. */
|
|
63
|
+
vad_threshold?: number;
|
|
56
64
|
}
|
|
57
65
|
export declare namespace Agent {
|
|
58
66
|
/**
|
|
@@ -44,12 +44,20 @@ export interface CreateAgentRequest {
|
|
|
44
44
|
languages?: Phonic.LanguageCode[];
|
|
45
45
|
/** These words, or short phrases, will be more accurately recognized by the agent. */
|
|
46
46
|
boosted_keywords?: string[];
|
|
47
|
-
/** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint
|
|
47
|
+
/** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
|
|
48
48
|
configuration_endpoint?: CreateAgentRequest.ConfigurationEndpoint | null;
|
|
49
49
|
/** Float between 0.0 and 1.0 representing the percentage of inbound calls handled by Agent. Defaults to `1.0`. Requires `phone_number` to be set when less than 1.0. */
|
|
50
50
|
inbound_rollout?: number;
|
|
51
51
|
/** E.164 formatted phone number where non-agent calls will be forwarded. Required when `inbound_rollout < 1.0`, must be `null` when `inbound_rollout = 1.0`. Defaults to `null`. */
|
|
52
52
|
inbound_rollout_forward_phone_number?: string | null;
|
|
53
|
+
/** Voice activity detection prebuffer duration in milliseconds. */
|
|
54
|
+
vad_prebuffer_duration_ms?: number;
|
|
55
|
+
/** Minimum speech duration for voice activity detection in milliseconds. */
|
|
56
|
+
vad_min_speech_duration_ms?: number;
|
|
57
|
+
/** Minimum silence duration for voice activity detection in milliseconds. */
|
|
58
|
+
vad_min_silence_duration_ms?: number;
|
|
59
|
+
/** Voice activity detection threshold. */
|
|
60
|
+
vad_threshold?: number;
|
|
53
61
|
}
|
|
54
62
|
export declare namespace CreateAgentRequest {
|
|
55
63
|
type PhoneNumber = "assign-automatically" | "custom";
|
|
@@ -78,7 +86,7 @@ export declare namespace CreateAgentRequest {
|
|
|
78
86
|
};
|
|
79
87
|
namespace TemplateVariables {
|
|
80
88
|
interface Value {
|
|
81
|
-
default_value: string
|
|
89
|
+
default_value: string;
|
|
82
90
|
is_boosted_keyword?: boolean;
|
|
83
91
|
}
|
|
84
92
|
}
|
|
@@ -90,7 +98,7 @@ export declare namespace CreateAgentRequest {
|
|
|
90
98
|
| string;
|
|
91
99
|
}
|
|
92
100
|
/**
|
|
93
|
-
* When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint
|
|
101
|
+
* When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options.
|
|
94
102
|
*/
|
|
95
103
|
interface ConfigurationEndpoint {
|
|
96
104
|
/** URL to call */
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.30.
|
|
1
|
+
export declare const SDK_VERSION = "0.30.34";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.mjs
CHANGED
|
@@ -15,8 +15,8 @@ export class PhonicClient {
|
|
|
15
15
|
this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
|
|
16
16
|
"X-Fern-Language": "JavaScript",
|
|
17
17
|
"X-Fern-SDK-Name": "phonic",
|
|
18
|
-
"X-Fern-SDK-Version": "0.30.
|
|
19
|
-
"User-Agent": "phonic/0.30.
|
|
18
|
+
"X-Fern-SDK-Version": "0.30.34",
|
|
19
|
+
"User-Agent": "phonic/0.30.34",
|
|
20
20
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
21
21
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
22
22
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -61,7 +61,7 @@ export declare class Agents {
|
|
|
61
61
|
* name: "support-agent",
|
|
62
62
|
* phone_number: "assign-automatically",
|
|
63
63
|
* timezone: "America/Los_Angeles",
|
|
64
|
-
* voice_id: "
|
|
64
|
+
* voice_id: "sabrina",
|
|
65
65
|
* audio_speed: 1,
|
|
66
66
|
* background_noise_level: 0,
|
|
67
67
|
* generate_welcome_message: false,
|
|
@@ -69,7 +69,7 @@ export declare class Agents {
|
|
|
69
69
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
70
70
|
* template_variables: {
|
|
71
71
|
* "customer_name": {
|
|
72
|
-
* default_value:
|
|
72
|
+
* default_value: "David"
|
|
73
73
|
* },
|
|
74
74
|
* "subject": {
|
|
75
75
|
* default_value: "Chess"
|
|
@@ -106,7 +106,7 @@ export declare class Agents {
|
|
|
106
106
|
* name: "support-agent",
|
|
107
107
|
* phone_number: "assign-automatically",
|
|
108
108
|
* timezone: "America/Los_Angeles",
|
|
109
|
-
* voice_id: "
|
|
109
|
+
* voice_id: "sabrina",
|
|
110
110
|
* audio_speed: 1,
|
|
111
111
|
* background_noise_level: 0,
|
|
112
112
|
* generate_welcome_message: false,
|
|
@@ -114,7 +114,7 @@ export declare class Agents {
|
|
|
114
114
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
115
115
|
* template_variables: {
|
|
116
116
|
* "customer_name": {
|
|
117
|
-
* default_value:
|
|
117
|
+
* default_value: "David"
|
|
118
118
|
* },
|
|
119
119
|
* "subject": {
|
|
120
120
|
* default_value: "Chess"
|
|
@@ -187,7 +187,7 @@ export declare class Agents {
|
|
|
187
187
|
* name: "updated-support-agent",
|
|
188
188
|
* phone_number: "assign-automatically",
|
|
189
189
|
* timezone: "America/Los_Angeles",
|
|
190
|
-
* voice_id: "
|
|
190
|
+
* voice_id: "sabrina",
|
|
191
191
|
* audio_speed: 1,
|
|
192
192
|
* background_noise_level: 0,
|
|
193
193
|
* generate_welcome_message: false,
|
|
@@ -195,7 +195,7 @@ export declare class Agents {
|
|
|
195
195
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
196
196
|
* template_variables: {
|
|
197
197
|
* "customer_name": {
|
|
198
|
-
* default_value:
|
|
198
|
+
* default_value: "David"
|
|
199
199
|
* },
|
|
200
200
|
* "subject": {
|
|
201
201
|
* default_value: "Chess"
|
|
@@ -233,16 +233,23 @@ export declare class Agents {
|
|
|
233
233
|
* @example
|
|
234
234
|
* await client.agents.addCustomPhoneNumber("nameOrId", {
|
|
235
235
|
* project: "main",
|
|
236
|
-
* phone_number: "+15551234567"
|
|
236
|
+
* phone_number: "+15551234567",
|
|
237
|
+
* configuration_endpoint: {
|
|
238
|
+
* url: "https://api.example.com/config",
|
|
239
|
+
* headers: {
|
|
240
|
+
* "Authorization": "Bearer token123"
|
|
241
|
+
* },
|
|
242
|
+
* timeout_ms: 7000
|
|
243
|
+
* }
|
|
237
244
|
* })
|
|
238
245
|
*/
|
|
239
246
|
addCustomPhoneNumber(nameOrId: string, request: Phonic.AgentsAddCustomPhoneNumberRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsAddCustomPhoneNumberResponse>;
|
|
240
247
|
private __addCustomPhoneNumber;
|
|
241
248
|
/**
|
|
242
|
-
*
|
|
249
|
+
* Deletes a custom phone number from an agent.
|
|
243
250
|
*
|
|
244
251
|
* @param {string} nameOrId - The name or the ID of the agent.
|
|
245
|
-
* @param {Phonic.
|
|
252
|
+
* @param {Phonic.AgentsDeleteCustomPhoneNumberRequest} request
|
|
246
253
|
* @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
|
|
247
254
|
*
|
|
248
255
|
* @throws {@link Phonic.BadRequestError}
|
|
@@ -252,12 +259,40 @@ export declare class Agents {
|
|
|
252
259
|
* @throws {@link Phonic.ConflictError}
|
|
253
260
|
*
|
|
254
261
|
* @example
|
|
255
|
-
* await client.agents.
|
|
262
|
+
* await client.agents.deleteCustomPhoneNumber("nameOrId", {
|
|
256
263
|
* project: "main",
|
|
257
264
|
* phone_number: "+15551234567"
|
|
258
265
|
* })
|
|
259
266
|
*/
|
|
260
|
-
|
|
261
|
-
private
|
|
267
|
+
deleteCustomPhoneNumber(nameOrId: string, request: Phonic.AgentsDeleteCustomPhoneNumberRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsDeleteCustomPhoneNumberResponse>;
|
|
268
|
+
private __deleteCustomPhoneNumber;
|
|
269
|
+
/**
|
|
270
|
+
* Updates a phone number on an agent.
|
|
271
|
+
*
|
|
272
|
+
* @param {string} nameOrId - The name or the ID of the agent.
|
|
273
|
+
* @param {Phonic.AgentsUpdatePhoneNumberRequest} request
|
|
274
|
+
* @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
|
|
275
|
+
*
|
|
276
|
+
* @throws {@link Phonic.BadRequestError}
|
|
277
|
+
* @throws {@link Phonic.UnauthorizedError}
|
|
278
|
+
* @throws {@link Phonic.ForbiddenError}
|
|
279
|
+
* @throws {@link Phonic.NotFoundError}
|
|
280
|
+
* @throws {@link Phonic.ConflictError}
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* await client.agents.updatePhoneNumber("nameOrId", {
|
|
284
|
+
* project: "main",
|
|
285
|
+
* phone_number: "+15551234567",
|
|
286
|
+
* configuration_endpoint: {
|
|
287
|
+
* url: "https://api.example.com/config",
|
|
288
|
+
* headers: {
|
|
289
|
+
* "Authorization": "Bearer token123"
|
|
290
|
+
* },
|
|
291
|
+
* timeout_ms: 7000
|
|
292
|
+
* }
|
|
293
|
+
* })
|
|
294
|
+
*/
|
|
295
|
+
updatePhoneNumber(nameOrId: string, request: Phonic.AgentsUpdatePhoneNumberRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdatePhoneNumberResponse>;
|
|
296
|
+
private __updatePhoneNumber;
|
|
262
297
|
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
263
298
|
}
|
|
@@ -115,7 +115,7 @@ export class Agents {
|
|
|
115
115
|
* name: "support-agent",
|
|
116
116
|
* phone_number: "assign-automatically",
|
|
117
117
|
* timezone: "America/Los_Angeles",
|
|
118
|
-
* voice_id: "
|
|
118
|
+
* voice_id: "sabrina",
|
|
119
119
|
* audio_speed: 1,
|
|
120
120
|
* background_noise_level: 0,
|
|
121
121
|
* generate_welcome_message: false,
|
|
@@ -123,7 +123,7 @@ export class Agents {
|
|
|
123
123
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
124
124
|
* template_variables: {
|
|
125
125
|
* "customer_name": {
|
|
126
|
-
* default_value:
|
|
126
|
+
* default_value: "David"
|
|
127
127
|
* },
|
|
128
128
|
* "subject": {
|
|
129
129
|
* default_value: "Chess"
|
|
@@ -221,7 +221,7 @@ export class Agents {
|
|
|
221
221
|
* name: "support-agent",
|
|
222
222
|
* phone_number: "assign-automatically",
|
|
223
223
|
* timezone: "America/Los_Angeles",
|
|
224
|
-
* voice_id: "
|
|
224
|
+
* voice_id: "sabrina",
|
|
225
225
|
* audio_speed: 1,
|
|
226
226
|
* background_noise_level: 0,
|
|
227
227
|
* generate_welcome_message: false,
|
|
@@ -229,7 +229,7 @@ export class Agents {
|
|
|
229
229
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
230
230
|
* template_variables: {
|
|
231
231
|
* "customer_name": {
|
|
232
|
-
* default_value:
|
|
232
|
+
* default_value: "David"
|
|
233
233
|
* },
|
|
234
234
|
* "subject": {
|
|
235
235
|
* default_value: "Chess"
|
|
@@ -467,7 +467,7 @@ export class Agents {
|
|
|
467
467
|
* name: "updated-support-agent",
|
|
468
468
|
* phone_number: "assign-automatically",
|
|
469
469
|
* timezone: "America/Los_Angeles",
|
|
470
|
-
* voice_id: "
|
|
470
|
+
* voice_id: "sabrina",
|
|
471
471
|
* audio_speed: 1,
|
|
472
472
|
* background_noise_level: 0,
|
|
473
473
|
* generate_welcome_message: false,
|
|
@@ -475,7 +475,7 @@ export class Agents {
|
|
|
475
475
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
476
476
|
* template_variables: {
|
|
477
477
|
* "customer_name": {
|
|
478
|
-
* default_value:
|
|
478
|
+
* default_value: "David"
|
|
479
479
|
* },
|
|
480
480
|
* "subject": {
|
|
481
481
|
* default_value: "Chess"
|
|
@@ -572,7 +572,14 @@ export class Agents {
|
|
|
572
572
|
* @example
|
|
573
573
|
* await client.agents.addCustomPhoneNumber("nameOrId", {
|
|
574
574
|
* project: "main",
|
|
575
|
-
* phone_number: "+15551234567"
|
|
575
|
+
* phone_number: "+15551234567",
|
|
576
|
+
* configuration_endpoint: {
|
|
577
|
+
* url: "https://api.example.com/config",
|
|
578
|
+
* headers: {
|
|
579
|
+
* "Authorization": "Bearer token123"
|
|
580
|
+
* },
|
|
581
|
+
* timeout_ms: 7000
|
|
582
|
+
* }
|
|
576
583
|
* })
|
|
577
584
|
*/
|
|
578
585
|
addCustomPhoneNumber(nameOrId, request, requestOptions) {
|
|
@@ -594,7 +601,7 @@ export class Agents {
|
|
|
594
601
|
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
595
602
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
596
603
|
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
|
|
597
|
-
.base, `agents/${encodeURIComponent(nameOrId)}/
|
|
604
|
+
.base, `agents/${encodeURIComponent(nameOrId)}/custom-phone-numbers`),
|
|
598
605
|
method: "POST",
|
|
599
606
|
headers: _headers,
|
|
600
607
|
contentType: "application/json",
|
|
@@ -639,7 +646,7 @@ export class Agents {
|
|
|
639
646
|
rawResponse: _response.rawResponse,
|
|
640
647
|
});
|
|
641
648
|
case "timeout":
|
|
642
|
-
throw new errors.PhonicTimeoutError("Timeout exceeded when calling POST /agents/{nameOrId}/
|
|
649
|
+
throw new errors.PhonicTimeoutError("Timeout exceeded when calling POST /agents/{nameOrId}/custom-phone-numbers.");
|
|
643
650
|
case "unknown":
|
|
644
651
|
throw new errors.PhonicError({
|
|
645
652
|
message: _response.error.errorMessage,
|
|
@@ -649,10 +656,10 @@ export class Agents {
|
|
|
649
656
|
});
|
|
650
657
|
}
|
|
651
658
|
/**
|
|
652
|
-
*
|
|
659
|
+
* Deletes a custom phone number from an agent.
|
|
653
660
|
*
|
|
654
661
|
* @param {string} nameOrId - The name or the ID of the agent.
|
|
655
|
-
* @param {Phonic.
|
|
662
|
+
* @param {Phonic.AgentsDeleteCustomPhoneNumberRequest} request
|
|
656
663
|
* @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
|
|
657
664
|
*
|
|
658
665
|
* @throws {@link Phonic.BadRequestError}
|
|
@@ -662,15 +669,15 @@ export class Agents {
|
|
|
662
669
|
* @throws {@link Phonic.ConflictError}
|
|
663
670
|
*
|
|
664
671
|
* @example
|
|
665
|
-
* await client.agents.
|
|
672
|
+
* await client.agents.deleteCustomPhoneNumber("nameOrId", {
|
|
666
673
|
* project: "main",
|
|
667
674
|
* phone_number: "+15551234567"
|
|
668
675
|
* })
|
|
669
676
|
*/
|
|
670
|
-
|
|
671
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
677
|
+
deleteCustomPhoneNumber(nameOrId, request, requestOptions) {
|
|
678
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteCustomPhoneNumber(nameOrId, request, requestOptions));
|
|
672
679
|
}
|
|
673
|
-
|
|
680
|
+
__deleteCustomPhoneNumber(nameOrId, request, requestOptions) {
|
|
674
681
|
return __awaiter(this, void 0, void 0, function* () {
|
|
675
682
|
var _a, _b, _c, _d;
|
|
676
683
|
const { project } = request, _body = __rest(request, ["project"]);
|
|
@@ -681,8 +688,102 @@ export class Agents {
|
|
|
681
688
|
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
682
689
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
683
690
|
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
|
|
684
|
-
.base, `agents/${encodeURIComponent(nameOrId)}/
|
|
685
|
-
method: "
|
|
691
|
+
.base, `agents/${encodeURIComponent(nameOrId)}/custom-phone-numbers`),
|
|
692
|
+
method: "DELETE",
|
|
693
|
+
headers: _headers,
|
|
694
|
+
contentType: "application/json",
|
|
695
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
696
|
+
requestType: "json",
|
|
697
|
+
body: _body,
|
|
698
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
699
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
700
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
701
|
+
});
|
|
702
|
+
if (_response.ok) {
|
|
703
|
+
return {
|
|
704
|
+
data: _response.body,
|
|
705
|
+
rawResponse: _response.rawResponse,
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
if (_response.error.reason === "status-code") {
|
|
709
|
+
switch (_response.error.statusCode) {
|
|
710
|
+
case 400:
|
|
711
|
+
throw new Phonic.BadRequestError(_response.error.body, _response.rawResponse);
|
|
712
|
+
case 401:
|
|
713
|
+
throw new Phonic.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
714
|
+
case 403:
|
|
715
|
+
throw new Phonic.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
716
|
+
case 404:
|
|
717
|
+
throw new Phonic.NotFoundError(_response.error.body, _response.rawResponse);
|
|
718
|
+
case 409:
|
|
719
|
+
throw new Phonic.ConflictError(_response.error.body, _response.rawResponse);
|
|
720
|
+
default:
|
|
721
|
+
throw new errors.PhonicError({
|
|
722
|
+
statusCode: _response.error.statusCode,
|
|
723
|
+
body: _response.error.body,
|
|
724
|
+
rawResponse: _response.rawResponse,
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
switch (_response.error.reason) {
|
|
729
|
+
case "non-json":
|
|
730
|
+
throw new errors.PhonicError({
|
|
731
|
+
statusCode: _response.error.statusCode,
|
|
732
|
+
body: _response.error.rawBody,
|
|
733
|
+
rawResponse: _response.rawResponse,
|
|
734
|
+
});
|
|
735
|
+
case "timeout":
|
|
736
|
+
throw new errors.PhonicTimeoutError("Timeout exceeded when calling DELETE /agents/{nameOrId}/custom-phone-numbers.");
|
|
737
|
+
case "unknown":
|
|
738
|
+
throw new errors.PhonicError({
|
|
739
|
+
message: _response.error.errorMessage,
|
|
740
|
+
rawResponse: _response.rawResponse,
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Updates a phone number on an agent.
|
|
747
|
+
*
|
|
748
|
+
* @param {string} nameOrId - The name or the ID of the agent.
|
|
749
|
+
* @param {Phonic.AgentsUpdatePhoneNumberRequest} request
|
|
750
|
+
* @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
|
|
751
|
+
*
|
|
752
|
+
* @throws {@link Phonic.BadRequestError}
|
|
753
|
+
* @throws {@link Phonic.UnauthorizedError}
|
|
754
|
+
* @throws {@link Phonic.ForbiddenError}
|
|
755
|
+
* @throws {@link Phonic.NotFoundError}
|
|
756
|
+
* @throws {@link Phonic.ConflictError}
|
|
757
|
+
*
|
|
758
|
+
* @example
|
|
759
|
+
* await client.agents.updatePhoneNumber("nameOrId", {
|
|
760
|
+
* project: "main",
|
|
761
|
+
* phone_number: "+15551234567",
|
|
762
|
+
* configuration_endpoint: {
|
|
763
|
+
* url: "https://api.example.com/config",
|
|
764
|
+
* headers: {
|
|
765
|
+
* "Authorization": "Bearer token123"
|
|
766
|
+
* },
|
|
767
|
+
* timeout_ms: 7000
|
|
768
|
+
* }
|
|
769
|
+
* })
|
|
770
|
+
*/
|
|
771
|
+
updatePhoneNumber(nameOrId, request, requestOptions) {
|
|
772
|
+
return core.HttpResponsePromise.fromPromise(this.__updatePhoneNumber(nameOrId, request, requestOptions));
|
|
773
|
+
}
|
|
774
|
+
__updatePhoneNumber(nameOrId, request, requestOptions) {
|
|
775
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
776
|
+
var _a, _b, _c, _d;
|
|
777
|
+
const { project } = request, _body = __rest(request, ["project"]);
|
|
778
|
+
const _queryParams = {};
|
|
779
|
+
if (project != null) {
|
|
780
|
+
_queryParams["project"] = project;
|
|
781
|
+
}
|
|
782
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
783
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
784
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
|
|
785
|
+
.base, `agents/${encodeURIComponent(nameOrId)}/phone-numbers`),
|
|
786
|
+
method: "PATCH",
|
|
686
787
|
headers: _headers,
|
|
687
788
|
contentType: "application/json",
|
|
688
789
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
@@ -726,7 +827,7 @@ export class Agents {
|
|
|
726
827
|
rawResponse: _response.rawResponse,
|
|
727
828
|
});
|
|
728
829
|
case "timeout":
|
|
729
|
-
throw new errors.PhonicTimeoutError("Timeout exceeded when calling
|
|
830
|
+
throw new errors.PhonicTimeoutError("Timeout exceeded when calling PATCH /agents/{nameOrId}/phone-numbers.");
|
|
730
831
|
case "unknown":
|
|
731
832
|
throw new errors.PhonicError({
|
|
732
833
|
message: _response.error.errorMessage,
|
package/dist/esm/api/resources/agents/client/requests/AgentsAddCustomPhoneNumberRequest.d.mts
CHANGED
|
@@ -5,7 +5,14 @@
|
|
|
5
5
|
* @example
|
|
6
6
|
* {
|
|
7
7
|
* project: "main",
|
|
8
|
-
* phone_number: "+15551234567"
|
|
8
|
+
* phone_number: "+15551234567",
|
|
9
|
+
* configuration_endpoint: {
|
|
10
|
+
* url: "https://api.example.com/config",
|
|
11
|
+
* headers: {
|
|
12
|
+
* "Authorization": "Bearer token123"
|
|
13
|
+
* },
|
|
14
|
+
* timeout_ms: 7000
|
|
15
|
+
* }
|
|
9
16
|
* }
|
|
10
17
|
*/
|
|
11
18
|
export interface AgentsAddCustomPhoneNumberRequest {
|
|
@@ -19,4 +26,19 @@ export interface AgentsAddCustomPhoneNumberRequest {
|
|
|
19
26
|
"X-Sip-Auth-Password"?: string;
|
|
20
27
|
/** The E.164 formatted phone number to add (e.g., "+15551234567"). */
|
|
21
28
|
phone_number: string;
|
|
29
|
+
/** When not `null`, the agent will call this endpoint to get configuration options for calls on this phone number. */
|
|
30
|
+
configuration_endpoint?: AgentsAddCustomPhoneNumberRequest.ConfigurationEndpoint | null;
|
|
31
|
+
}
|
|
32
|
+
export declare namespace AgentsAddCustomPhoneNumberRequest {
|
|
33
|
+
/**
|
|
34
|
+
* When not `null`, the agent will call this endpoint to get configuration options for calls on this phone number.
|
|
35
|
+
*/
|
|
36
|
+
interface ConfigurationEndpoint {
|
|
37
|
+
/** URL to call */
|
|
38
|
+
url: string;
|
|
39
|
+
/** Object of key-value pairs. */
|
|
40
|
+
headers?: Record<string, string>;
|
|
41
|
+
/** Timeout in milliseconds for the endpoint call. */
|
|
42
|
+
timeout_ms?: number;
|
|
43
|
+
}
|
|
22
44
|
}
|
|
@@ -9,7 +9,7 @@ import * as Phonic from "../../../../index.mjs";
|
|
|
9
9
|
* name: "support-agent",
|
|
10
10
|
* phone_number: "assign-automatically",
|
|
11
11
|
* timezone: "America/Los_Angeles",
|
|
12
|
-
* voice_id: "
|
|
12
|
+
* voice_id: "sabrina",
|
|
13
13
|
* audio_speed: 1,
|
|
14
14
|
* background_noise_level: 0,
|
|
15
15
|
* generate_welcome_message: false,
|
|
@@ -17,7 +17,7 @@ import * as Phonic from "../../../../index.mjs";
|
|
|
17
17
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
18
18
|
* template_variables: {
|
|
19
19
|
* "customer_name": {
|
|
20
|
-
* default_value:
|
|
20
|
+
* default_value: "David"
|
|
21
21
|
* },
|
|
22
22
|
* "subject": {
|
|
23
23
|
* default_value: "Chess"
|
|
@@ -42,7 +42,7 @@ export interface AgentsCreateRequest {
|
|
|
42
42
|
project?: string;
|
|
43
43
|
/** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
|
|
44
44
|
name: string;
|
|
45
|
-
phone_number
|
|
45
|
+
phone_number: Phonic.CreateAgentRequest.PhoneNumber | null;
|
|
46
46
|
/** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
|
|
47
47
|
custom_phone_number?: string | null;
|
|
48
48
|
/** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
|
|
@@ -81,10 +81,18 @@ export interface AgentsCreateRequest {
|
|
|
81
81
|
languages?: Phonic.LanguageCode[];
|
|
82
82
|
/** These words, or short phrases, will be more accurately recognized by the agent. */
|
|
83
83
|
boosted_keywords?: string[];
|
|
84
|
-
/** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint
|
|
84
|
+
/** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
|
|
85
85
|
configuration_endpoint?: Phonic.CreateAgentRequest.ConfigurationEndpoint | null;
|
|
86
86
|
/** Float between 0.0 and 1.0 representing the percentage of inbound calls handled by Agent. Defaults to `1.0`. Requires `phone_number` to be set when less than 1.0. */
|
|
87
87
|
inbound_rollout?: number;
|
|
88
88
|
/** E.164 formatted phone number where non-agent calls will be forwarded. Required when `inbound_rollout < 1.0`, must be `null` when `inbound_rollout = 1.0`. Defaults to `null`. */
|
|
89
89
|
inbound_rollout_forward_phone_number?: string | null;
|
|
90
|
+
/** Voice activity detection prebuffer duration in milliseconds. */
|
|
91
|
+
vad_prebuffer_duration_ms?: number;
|
|
92
|
+
/** Minimum speech duration for voice activity detection in milliseconds. */
|
|
93
|
+
vad_min_speech_duration_ms?: number;
|
|
94
|
+
/** Minimum silence duration for voice activity detection in milliseconds. */
|
|
95
|
+
vad_min_silence_duration_ms?: number;
|
|
96
|
+
/** Voice activity detection threshold. */
|
|
97
|
+
vad_threshold?: number;
|
|
90
98
|
}
|
package/dist/esm/api/resources/agents/client/requests/AgentsDeleteCustomPhoneNumberRequest.d.mts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* project: "main",
|
|
8
|
+
* phone_number: "+15551234567"
|
|
9
|
+
* }
|
|
10
|
+
*/
|
|
11
|
+
export interface AgentsDeleteCustomPhoneNumberRequest {
|
|
12
|
+
/** The name of the project containing the agent. Only used when `nameOrId` is a name. */
|
|
13
|
+
project?: string;
|
|
14
|
+
/** The E.164 formatted phone number to remove (e.g., "+15551234567"). */
|
|
15
|
+
phone_number: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* project: "main",
|
|
8
|
+
* phone_number: "+15551234567",
|
|
9
|
+
* configuration_endpoint: {
|
|
10
|
+
* url: "https://api.example.com/config",
|
|
11
|
+
* headers: {
|
|
12
|
+
* "Authorization": "Bearer token123"
|
|
13
|
+
* },
|
|
14
|
+
* timeout_ms: 7000
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
*/
|
|
18
|
+
export interface AgentsUpdatePhoneNumberRequest {
|
|
19
|
+
/** The name of the project containing the agent. Only used when `nameOrId` is a name. */
|
|
20
|
+
project?: string;
|
|
21
|
+
/** The E.164 formatted phone number to add (e.g., "+15551234567"). */
|
|
22
|
+
phone_number: string;
|
|
23
|
+
/** When not `null`, the agent will call this endpoint to get configuration options for calls on this phone number. */
|
|
24
|
+
configuration_endpoint?: AgentsUpdatePhoneNumberRequest.ConfigurationEndpoint | null;
|
|
25
|
+
}
|
|
26
|
+
export declare namespace AgentsUpdatePhoneNumberRequest {
|
|
27
|
+
/**
|
|
28
|
+
* When not `null`, the agent will call this endpoint to get configuration options for calls on this phone number.
|
|
29
|
+
*/
|
|
30
|
+
interface ConfigurationEndpoint {
|
|
31
|
+
/** URL to call */
|
|
32
|
+
url: string;
|
|
33
|
+
/** Object of key-value pairs. */
|
|
34
|
+
headers?: Record<string, string>;
|
|
35
|
+
/** Timeout in milliseconds for the endpoint call. */
|
|
36
|
+
timeout_ms?: number;
|
|
37
|
+
}
|
|
38
|
+
}
|