phonic 0.30.6 → 0.30.8

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.
Files changed (55) hide show
  1. package/README.md +2 -0
  2. package/dist/cjs/Client.js +2 -2
  3. package/dist/cjs/api/resources/agents/client/Client.d.ts +6 -0
  4. package/dist/cjs/api/resources/agents/client/Client.js +6 -0
  5. package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +6 -0
  6. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +9 -1
  7. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.js +1 -0
  8. package/dist/cjs/api/resources/agents/client/requests/UpsertAgentRequest.d.ts +2 -0
  9. package/dist/cjs/api/resources/conversations/client/Client.d.ts +1 -0
  10. package/dist/cjs/api/resources/conversations/client/Client.js +1 -0
  11. package/dist/cjs/api/resources/conversations/client/Socket.d.ts +1 -1
  12. package/dist/cjs/api/resources/conversations/client/requests/OutboundCallRequest.d.ts +1 -0
  13. package/dist/cjs/api/types/Agent.d.ts +6 -1
  14. package/dist/cjs/api/types/Agent.js +1 -0
  15. package/dist/cjs/api/types/ConfigPayload.d.ts +8 -2
  16. package/dist/cjs/api/types/ConfigPayload.js +2 -0
  17. package/dist/cjs/api/types/Conversation.d.ts +4 -0
  18. package/dist/cjs/api/types/CreateAgentRequest.d.ts +7 -1
  19. package/dist/cjs/api/types/CreateAgentRequest.js +1 -0
  20. package/dist/cjs/api/types/InputTextPayload.d.ts +2 -0
  21. package/dist/cjs/api/types/OutboundCallConfig.d.ts +2 -0
  22. package/dist/cjs/api/types/index.d.ts +0 -2
  23. package/dist/cjs/api/types/index.js +0 -2
  24. package/dist/cjs/version.d.ts +1 -1
  25. package/dist/cjs/version.js +1 -1
  26. package/dist/esm/Client.mjs +2 -2
  27. package/dist/esm/api/resources/agents/client/Client.d.mts +6 -0
  28. package/dist/esm/api/resources/agents/client/Client.mjs +6 -0
  29. package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +6 -0
  30. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +9 -1
  31. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.mjs +1 -0
  32. package/dist/esm/api/resources/agents/client/requests/UpsertAgentRequest.d.mts +2 -0
  33. package/dist/esm/api/resources/conversations/client/Client.d.mts +1 -0
  34. package/dist/esm/api/resources/conversations/client/Client.mjs +1 -0
  35. package/dist/esm/api/resources/conversations/client/Socket.d.mts +1 -1
  36. package/dist/esm/api/resources/conversations/client/requests/OutboundCallRequest.d.mts +1 -0
  37. package/dist/esm/api/types/Agent.d.mts +6 -1
  38. package/dist/esm/api/types/Agent.mjs +1 -0
  39. package/dist/esm/api/types/ConfigPayload.d.mts +8 -2
  40. package/dist/esm/api/types/ConfigPayload.mjs +2 -0
  41. package/dist/esm/api/types/Conversation.d.mts +4 -0
  42. package/dist/esm/api/types/CreateAgentRequest.d.mts +7 -1
  43. package/dist/esm/api/types/CreateAgentRequest.mjs +1 -0
  44. package/dist/esm/api/types/InputTextPayload.d.mts +2 -0
  45. package/dist/esm/api/types/OutboundCallConfig.d.mts +2 -0
  46. package/dist/esm/api/types/index.d.mts +0 -2
  47. package/dist/esm/api/types/index.mjs +0 -2
  48. package/dist/esm/version.d.mts +1 -1
  49. package/dist/esm/version.mjs +1 -1
  50. package/dist/index.d.mts +686 -0
  51. package/dist/index.d.ts +686 -0
  52. package/dist/index.js +643 -0
  53. package/dist/index.mjs +606 -0
  54. package/package.json +1 -1
  55. package/reference.md +7 -0
package/dist/index.mjs ADDED
@@ -0,0 +1,606 @@
1
+ // package.json
2
+ var version = "0.29.1";
3
+
4
+ // src/agents/index.ts
5
+ var Agents = class {
6
+ constructor(phonic) {
7
+ this.phonic = phonic;
8
+ }
9
+ getQueryString(params) {
10
+ const project = params?.project;
11
+ const queryString = new URLSearchParams({
12
+ ...project !== void 0 && { project }
13
+ }).toString();
14
+ return queryString;
15
+ }
16
+ getTemplateVariablesForBody(templateVariables) {
17
+ if (templateVariables === void 0) {
18
+ return void 0;
19
+ }
20
+ return Object.fromEntries(
21
+ Object.entries(templateVariables).map(([key, value]) => [
22
+ key,
23
+ {
24
+ default_value: value.defaultValue
25
+ }
26
+ ])
27
+ );
28
+ }
29
+ getConfigurationEndpointForBody(configurationEndpoint) {
30
+ if (configurationEndpoint === void 0 || configurationEndpoint === null) {
31
+ return configurationEndpoint;
32
+ }
33
+ return {
34
+ url: configurationEndpoint.url,
35
+ headers: configurationEndpoint.headers,
36
+ timeout_ms: configurationEndpoint.timeoutMs
37
+ };
38
+ }
39
+ async list(params) {
40
+ const response = await this.phonic.get(
41
+ `/agents?${this.getQueryString(params)}`
42
+ );
43
+ return response;
44
+ }
45
+ async get(nameOrId, params) {
46
+ const response = await this.phonic.get(
47
+ `/agents/${nameOrId}?${this.getQueryString(params)}`
48
+ );
49
+ return response;
50
+ }
51
+ async create(params) {
52
+ const response = await this.phonic.post(
53
+ `/agents?${this.getQueryString(params)}`,
54
+ {
55
+ name: params.name,
56
+ phone_number: params.phoneNumber,
57
+ timezone: params.timezone,
58
+ audio_format: params.phoneNumber === "assign-automatically" ? "mulaw_8000" : params.audioFormat,
59
+ audio_speed: params.audioSpeed,
60
+ voice_id: params.voiceId,
61
+ welcome_message: params.welcomeMessage,
62
+ system_prompt: params.systemPrompt,
63
+ template_variables: this.getTemplateVariablesForBody(
64
+ params.templateVariables
65
+ ),
66
+ tools: params.tools,
67
+ no_input_poke_sec: params.noInputPokeSec,
68
+ no_input_poke_text: params.noInputPokeText,
69
+ no_input_end_conversation_sec: params.noInputEndConversationSec,
70
+ boosted_keywords: params.boostedKeywords,
71
+ configuration_endpoint: this.getConfigurationEndpointForBody(
72
+ params.configurationEndpoint
73
+ )
74
+ }
75
+ );
76
+ return response;
77
+ }
78
+ async update(nameOrId, params) {
79
+ const response = await this.phonic.patch(
80
+ `/agents/${nameOrId}?${this.getQueryString(params)}`,
81
+ {
82
+ name: params.name,
83
+ phone_number: params.phoneNumber,
84
+ timezone: params.timezone,
85
+ audio_format: params.phoneNumber === "assign-automatically" ? "mulaw_8000" : params.audioFormat,
86
+ voice_id: params.voiceId,
87
+ audio_speed: params.audioSpeed,
88
+ welcome_message: params.welcomeMessage,
89
+ system_prompt: params.systemPrompt,
90
+ template_variables: this.getTemplateVariablesForBody(
91
+ params.templateVariables
92
+ ),
93
+ tools: params.tools,
94
+ no_input_poke_sec: params.noInputPokeSec,
95
+ no_input_poke_text: params.noInputPokeText,
96
+ no_input_end_conversation_sec: params.noInputEndConversationSec,
97
+ boosted_keywords: params.boostedKeywords,
98
+ configuration_endpoint: this.getConfigurationEndpointForBody(
99
+ params.configurationEndpoint
100
+ )
101
+ }
102
+ );
103
+ return response;
104
+ }
105
+ async upsert(params) {
106
+ const response = await this.phonic.put(
107
+ `/agents/upsert?${this.getQueryString(params)}`,
108
+ {
109
+ name: params.name,
110
+ phone_number: params.phoneNumber,
111
+ timezone: params.timezone,
112
+ audio_format: params.phoneNumber === "assign-automatically" ? "mulaw_8000" : params.audioFormat,
113
+ voice_id: params.voiceId,
114
+ welcome_message: params.welcomeMessage,
115
+ system_prompt: params.systemPrompt,
116
+ audio_speed: params.audioSpeed,
117
+ template_variables: this.getTemplateVariablesForBody(
118
+ params.templateVariables
119
+ ),
120
+ tools: params.tools,
121
+ no_input_poke_sec: params.noInputPokeSec,
122
+ no_input_poke_text: params.noInputPokeText,
123
+ no_input_end_conversation_sec: params.noInputEndConversationSec,
124
+ boosted_keywords: params.boostedKeywords,
125
+ configuration_endpoint: this.getConfigurationEndpointForBody(
126
+ params.configurationEndpoint
127
+ )
128
+ }
129
+ );
130
+ return response;
131
+ }
132
+ async delete(nameOrId, params) {
133
+ const response = await this.phonic.delete(
134
+ `/agents/${nameOrId}?${this.getQueryString(params)}`
135
+ );
136
+ return response;
137
+ }
138
+ };
139
+
140
+ // src/conversations/twilio/index.ts
141
+ var Twilio = class {
142
+ constructor(phonic) {
143
+ this.phonic = phonic;
144
+ }
145
+ async outboundCall(params, config) {
146
+ const response = await this.phonic.post(
147
+ "/conversations/twilio/outbound_call",
148
+ {
149
+ from_phone_number: params.from_phone_number,
150
+ to_phone_number: params.to_phone_number,
151
+ config
152
+ },
153
+ {
154
+ "X-Twilio-Account-Sid": params.account_sid,
155
+ "X-Twilio-Api-Key-Sid": params.api_key_sid,
156
+ "X-Twilio-Api-Key-Secret": params.api_key_secret
157
+ }
158
+ );
159
+ return response;
160
+ }
161
+ };
162
+
163
+ // src/conversations/index.ts
164
+ var Conversations = class {
165
+ constructor(phonic) {
166
+ this.phonic = phonic;
167
+ this.twilio = new Twilio(phonic);
168
+ }
169
+ twilio;
170
+ async list({
171
+ project,
172
+ durationMin,
173
+ durationMax,
174
+ startedAtMin,
175
+ startedAtMax
176
+ }) {
177
+ const queryString = new URLSearchParams({
178
+ ...project !== void 0 && { project },
179
+ ...durationMin !== void 0 && { duration_min: String(durationMin) },
180
+ ...durationMax !== void 0 && { duration_max: String(durationMax) },
181
+ ...startedAtMin !== void 0 && { started_at_min: startedAtMin },
182
+ ...startedAtMax !== void 0 && { started_at_max: startedAtMax }
183
+ }).toString();
184
+ const response = await this.phonic.get(
185
+ `/conversations?${queryString}`
186
+ );
187
+ return response;
188
+ }
189
+ async get(id) {
190
+ const response = await this.phonic.get(
191
+ `/conversations/${id}`
192
+ );
193
+ return response;
194
+ }
195
+ async getByExternalId({
196
+ project,
197
+ externalId
198
+ }) {
199
+ const queryString = new URLSearchParams({
200
+ ...project !== void 0 && { project },
201
+ external_id: externalId
202
+ }).toString();
203
+ const response = await this.phonic.get(
204
+ `/conversations?${queryString}`
205
+ );
206
+ return response;
207
+ }
208
+ async outboundCall(toPhoneNumber, config) {
209
+ const response = await this.phonic.post(
210
+ "/conversations/outbound_call",
211
+ {
212
+ to_phone_number: toPhoneNumber,
213
+ config
214
+ }
215
+ );
216
+ return response;
217
+ }
218
+ };
219
+
220
+ // src/projects/index.ts
221
+ var Projects = class {
222
+ constructor(phonic) {
223
+ this.phonic = phonic;
224
+ }
225
+ async list() {
226
+ const response = await this.phonic.get("/projects");
227
+ return response;
228
+ }
229
+ async get(nameOrId) {
230
+ const response = await this.phonic.get(
231
+ `/projects/${nameOrId}`
232
+ );
233
+ return response;
234
+ }
235
+ async create(params) {
236
+ const response = await this.phonic.post(
237
+ "/projects",
238
+ {
239
+ name: params.name
240
+ }
241
+ );
242
+ return response;
243
+ }
244
+ async update(nameOrId, params) {
245
+ const response = await this.phonic.patch(
246
+ `/projects/${nameOrId}`,
247
+ {
248
+ name: params.name,
249
+ default_agent: params.defaultAgent
250
+ }
251
+ );
252
+ return response;
253
+ }
254
+ async delete(nameOrId) {
255
+ const response = await this.phonic.delete(
256
+ `/projects/${nameOrId}`
257
+ );
258
+ return response;
259
+ }
260
+ };
261
+
262
+ // src/sts/index.ts
263
+ import WebSocket from "ws";
264
+
265
+ // src/sts/websocket.ts
266
+ var PhonicSTSWebSocket = class {
267
+ constructor(ws, config) {
268
+ this.ws = ws;
269
+ this.config = config;
270
+ this.buffer.push(
271
+ JSON.stringify({
272
+ type: "config",
273
+ ...this.config
274
+ })
275
+ );
276
+ this.ws.onopen = () => {
277
+ for (const message of this.buffer) {
278
+ this.ws.send(message);
279
+ }
280
+ this.isOpen = true;
281
+ };
282
+ this.ws.onmessage = (event) => {
283
+ if (this.onMessageCallback === null) {
284
+ return;
285
+ }
286
+ if (typeof event.data !== "string") {
287
+ throw new Error("Received non-string message");
288
+ }
289
+ const dataObj = JSON.parse(
290
+ event.data
291
+ );
292
+ this.onMessageCallback(dataObj);
293
+ };
294
+ this.ws.onclose = (event) => {
295
+ if (this.onCloseCallback === null) {
296
+ return;
297
+ }
298
+ this.onCloseCallback(event);
299
+ };
300
+ this.ws.onerror = (event) => {
301
+ if (this.onErrorCallback === null) {
302
+ return;
303
+ }
304
+ this.onErrorCallback(event);
305
+ };
306
+ this.onMessage = this.onMessage.bind(this);
307
+ this.onClose = this.onClose.bind(this);
308
+ this.onError = this.onError.bind(this);
309
+ this.audioChunk = this.audioChunk.bind(this);
310
+ this.sendToolCallOutput = this.sendToolCallOutput.bind(this);
311
+ this.updateSystemPrompt = this.updateSystemPrompt.bind(this);
312
+ this.setExternalId = this.setExternalId.bind(this);
313
+ this.close = this.close.bind(this);
314
+ }
315
+ onMessageCallback = null;
316
+ onCloseCallback = null;
317
+ onErrorCallback = null;
318
+ buffer = [];
319
+ isOpen = false;
320
+ processUserMessage(message) {
321
+ const messageStr = JSON.stringify(message);
322
+ if (this.isOpen) {
323
+ this.ws.send(messageStr);
324
+ } else {
325
+ this.buffer.push(messageStr);
326
+ }
327
+ }
328
+ onMessage(callback) {
329
+ this.onMessageCallback = callback;
330
+ }
331
+ onClose(callback) {
332
+ this.onCloseCallback = callback;
333
+ }
334
+ onError(callback) {
335
+ this.onErrorCallback = callback;
336
+ }
337
+ audioChunk({ audio }) {
338
+ this.processUserMessage({
339
+ type: "audio_chunk",
340
+ audio
341
+ });
342
+ }
343
+ sendToolCallOutput({
344
+ toolCallId,
345
+ output
346
+ }) {
347
+ this.processUserMessage({
348
+ type: "tool_call_output",
349
+ tool_call_id: toolCallId,
350
+ output
351
+ });
352
+ }
353
+ updateSystemPrompt({ systemPrompt }) {
354
+ this.processUserMessage({
355
+ type: "update_system_prompt",
356
+ system_prompt: systemPrompt
357
+ });
358
+ }
359
+ setExternalId({ externalId }) {
360
+ this.processUserMessage({
361
+ type: "set_external_id",
362
+ external_id: externalId
363
+ });
364
+ }
365
+ close(code) {
366
+ this.ws.close(code ?? 1e3);
367
+ }
368
+ };
369
+
370
+ // src/sts/index.ts
371
+ var SpeechToSpeech = class {
372
+ constructor(phonic) {
373
+ this.phonic = phonic;
374
+ }
375
+ websocket(config) {
376
+ const wsBaseUrl = this.phonic.baseUrl.replace(/^http/, "ws");
377
+ const queryString = new URLSearchParams({
378
+ ...this.phonic.__downstreamWebSocketUrl !== null && {
379
+ downstream_websocket_url: this.phonic.__downstreamWebSocketUrl
380
+ }
381
+ }).toString();
382
+ const phonicApiWsUrl = `${wsBaseUrl}/v1/sts/ws?${queryString}`;
383
+ const ws = new WebSocket(phonicApiWsUrl, {
384
+ headers: this.phonic.headers
385
+ });
386
+ return new PhonicSTSWebSocket(ws, config);
387
+ }
388
+ };
389
+
390
+ // src/tools/index.ts
391
+ var Tools = class {
392
+ constructor(phonic) {
393
+ this.phonic = phonic;
394
+ }
395
+ getQueryString(params) {
396
+ const project = params?.project;
397
+ const queryString = new URLSearchParams({
398
+ ...project !== void 0 && { project }
399
+ }).toString();
400
+ return queryString;
401
+ }
402
+ getParametersForBody(parameters) {
403
+ if (parameters === void 0) {
404
+ return void 0;
405
+ }
406
+ return parameters.map((parameter) => {
407
+ return {
408
+ type: parameter.type,
409
+ name: parameter.name,
410
+ description: parameter.description,
411
+ is_required: parameter.isRequired,
412
+ ...parameter.type === "array" && {
413
+ item_type: parameter.itemType
414
+ }
415
+ };
416
+ });
417
+ }
418
+ async list(params) {
419
+ const response = await this.phonic.get(
420
+ `/tools?${this.getQueryString(params)}`
421
+ );
422
+ return response;
423
+ }
424
+ async get(nameOrId, params) {
425
+ const response = await this.phonic.get(
426
+ `/tools/${nameOrId}?${this.getQueryString(params)}`
427
+ );
428
+ return response;
429
+ }
430
+ async create(params) {
431
+ const body = {
432
+ name: params.name,
433
+ description: params.description,
434
+ type: params.type,
435
+ execution_mode: params.executionMode,
436
+ parameters: this.getParametersForBody(params.parameters)
437
+ };
438
+ if (params.type === "custom_webhook") {
439
+ body.endpoint_method = params.endpointMethod;
440
+ body.endpoint_url = params.endpointUrl;
441
+ body.endpoint_headers = params.endpointHeaders;
442
+ body.endpoint_timeout_ms = params.endpointTimeoutMs;
443
+ }
444
+ if (params.type === "custom_websocket") {
445
+ body.tool_call_output_timeout_ms = params.toolCallOutputTimeoutMs;
446
+ }
447
+ const response = await this.phonic.post(
448
+ `/tools?${this.getQueryString(params)}`,
449
+ body
450
+ );
451
+ return response;
452
+ }
453
+ async update(nameOrId, params) {
454
+ const response = await this.phonic.patch(
455
+ `/tools/${nameOrId}?${this.getQueryString(params)}`,
456
+ {
457
+ name: params.name,
458
+ description: params.description,
459
+ type: params.type,
460
+ execution_mode: params.executionMode,
461
+ endpoint_method: params.endpointMethod,
462
+ endpoint_url: params.endpointUrl,
463
+ endpoint_headers: params.endpointHeaders,
464
+ endpoint_timeout_ms: params.endpointTimeoutMs,
465
+ parameters: this.getParametersForBody(params.parameters),
466
+ tool_call_output_timeout_ms: params.toolCallOutputTimeoutMs
467
+ }
468
+ );
469
+ return response;
470
+ }
471
+ async delete(nameOrId, params) {
472
+ const response = await this.phonic.delete(
473
+ `/tools/${nameOrId}?${this.getQueryString(params)}`
474
+ );
475
+ return response;
476
+ }
477
+ };
478
+
479
+ // src/voices/index.ts
480
+ var Voices = class {
481
+ constructor(phonic) {
482
+ this.phonic = phonic;
483
+ }
484
+ async list({ model }) {
485
+ const response = await this.phonic.get(
486
+ `/voices?model=${encodeURIComponent(model)}`
487
+ );
488
+ return response;
489
+ }
490
+ async get(id) {
491
+ const response = await this.phonic.get(
492
+ `/voices/${id}`
493
+ );
494
+ return response;
495
+ }
496
+ };
497
+
498
+ // src/phonic.ts
499
+ var defaultBaseUrl = "https://api.phonic.co";
500
+ var defaultUserAgent = `phonic-node:${version}`;
501
+ var Phonic = class {
502
+ constructor(apiKey, config) {
503
+ this.apiKey = apiKey;
504
+ if (typeof process === "undefined") {
505
+ throw new Error(
506
+ "Phonic SDK is intended to be used in Node.js environment."
507
+ );
508
+ }
509
+ if (!this.apiKey) {
510
+ throw new Error(
511
+ 'API key is missing. Pass it to the constructor: `new Phonic("ph_...")`'
512
+ );
513
+ }
514
+ this.baseUrl = (config?.baseUrl ?? defaultBaseUrl).replace(/\/$/, "");
515
+ this.__downstreamWebSocketUrl = config?.__downstreamWebSocketUrl || null;
516
+ this.headers = {
517
+ Authorization: `Bearer ${this.apiKey}`,
518
+ "User-Agent": process.env.PHONIC_USER_AGENT || defaultUserAgent,
519
+ "Content-Type": "application/json",
520
+ ...config?.headers
521
+ };
522
+ }
523
+ baseUrl;
524
+ __downstreamWebSocketUrl;
525
+ headers;
526
+ agents = new Agents(this);
527
+ conversations = new Conversations(this);
528
+ projects = new Projects(this);
529
+ tools = new Tools(this);
530
+ voices = new Voices(this);
531
+ sts = new SpeechToSpeech(this);
532
+ async fetchRequest(path, options) {
533
+ try {
534
+ const { headers, ...restOptions } = options;
535
+ const response = await fetch(`${this.baseUrl}/v1${path}`, {
536
+ headers: {
537
+ ...this.headers,
538
+ ...headers
539
+ },
540
+ ...restOptions
541
+ });
542
+ if (response.ok) {
543
+ const data = await response.json();
544
+ return { data, error: null };
545
+ }
546
+ try {
547
+ const data = await response.json();
548
+ return {
549
+ data: null,
550
+ error: {
551
+ message: data.error.message || response.statusText,
552
+ param_errors: data.param_errors
553
+ }
554
+ };
555
+ } catch (error) {
556
+ return {
557
+ data: null,
558
+ error: {
559
+ message: response.statusText
560
+ }
561
+ };
562
+ }
563
+ } catch (error) {
564
+ console.error(error);
565
+ return {
566
+ data: null,
567
+ error: {
568
+ message: "Fetch request failed"
569
+ }
570
+ };
571
+ }
572
+ }
573
+ async get(path) {
574
+ return this.fetchRequest(path, { method: "GET" });
575
+ }
576
+ async post(path, body, headers) {
577
+ return this.fetchRequest(path, {
578
+ method: "POST",
579
+ body: JSON.stringify(body),
580
+ headers
581
+ });
582
+ }
583
+ async patch(path, body, headers) {
584
+ return this.fetchRequest(path, {
585
+ method: "PATCH",
586
+ body: JSON.stringify(body),
587
+ headers
588
+ });
589
+ }
590
+ async put(path, body, headers) {
591
+ return this.fetchRequest(path, {
592
+ method: "PUT",
593
+ body: JSON.stringify(body),
594
+ headers
595
+ });
596
+ }
597
+ async delete(path, headers) {
598
+ return this.fetchRequest(path, {
599
+ method: "DELETE",
600
+ headers
601
+ });
602
+ }
603
+ };
604
+ export {
605
+ Phonic
606
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phonic",
3
- "version": "0.30.6",
3
+ "version": "0.30.8",
4
4
  "private": false,
5
5
  "repository": "github:Phonic-Co/phonic-node",
6
6
  "type": "commonjs",
package/reference.md CHANGED
@@ -100,6 +100,7 @@ await client.agents.create({
100
100
  timezone: "America/Los_Angeles",
101
101
  voice_id: "grant",
102
102
  audio_speed: 1,
103
+ background_noise_level: 0,
103
104
  welcome_message: "Hi {{customer_name}}. How can I help you today?",
104
105
  system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
105
106
  template_variables: {
@@ -111,6 +112,7 @@ await client.agents.create({
111
112
  tools: ["keypad_input"],
112
113
  no_input_poke_sec: 30,
113
114
  no_input_poke_text: "Are you still there?",
115
+ recognized_languages: ["en", "es"],
114
116
  boosted_keywords: ["Load ID", "dispatch"],
115
117
  configuration_endpoint: {
116
118
  url: "https://api.example.com/config",
@@ -189,6 +191,7 @@ await client.agents.upsert({
189
191
  timezone: "America/Los_Angeles",
190
192
  voice_id: "grant",
191
193
  audio_speed: 1,
194
+ background_noise_level: 0,
192
195
  welcome_message: "Hi {{customer_name}}. How can I help you today?",
193
196
  system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
194
197
  template_variables: {
@@ -200,6 +203,7 @@ await client.agents.upsert({
200
203
  tools: ["keypad_input"],
201
204
  no_input_poke_sec: 30,
202
205
  no_input_poke_text: "Are you still there?",
206
+ recognized_languages: ["en", "es"],
203
207
  boosted_keywords: ["Load ID", "dispatch"],
204
208
  configuration_endpoint: {
205
209
  url: "https://api.example.com/config",
@@ -424,6 +428,7 @@ await client.agents.update("nameOrId", {
424
428
  timezone: "America/Los_Angeles",
425
429
  voice_id: "grant",
426
430
  audio_speed: 1,
431
+ background_noise_level: 0,
427
432
  welcome_message: "Hi {{customer_name}}. How can I help you today?",
428
433
  system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
429
434
  template_variables: {
@@ -435,6 +440,7 @@ await client.agents.update("nameOrId", {
435
440
  tools: ["keypad_input"],
436
441
  no_input_poke_sec: 30,
437
442
  no_input_poke_text: "Are you still there?",
443
+ recognized_languages: ["en", "es"],
438
444
  boosted_keywords: ["Load ID", "dispatch"],
439
445
  configuration_endpoint: {
440
446
  url: "https://api.example.com/config",
@@ -1949,6 +1955,7 @@ await client.conversations.outboundCall({
1949
1955
  no_input_poke_sec: 30,
1950
1956
  no_input_poke_text: "Are you still there?",
1951
1957
  no_input_end_conversation_sec: 180,
1958
+ recognized_languages: ["en", "es"],
1952
1959
  boosted_keywords: ["Load ID", "dispatch"],
1953
1960
  tools: ["keypad_input"],
1954
1961
  },