phonic 0.25.1 → 0.25.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -50,23 +50,23 @@ const phonic = new Phonic("ph_...");
50
50
  ### List agents
51
51
 
52
52
  ```ts
53
- const agentsResult = await phonic.agents.list({ project: "my-project" });
53
+ const agentsResult = await phonic.agents.list({ project: "main" });
54
54
  ```
55
55
 
56
56
  ### Get agent
57
57
 
58
58
  ```ts
59
- const agentResult = await phonic.agents.get("my-agent", { project: "my-project" });
59
+ const agentResult = await phonic.agents.get("chris", { project: "main" });
60
60
  ```
61
61
 
62
62
  ### Create agent
63
63
 
64
64
  ```ts
65
65
  const createAgentResult = await phonic.agents.create({
66
- name: "my-agent",
66
+ name: "chris",
67
67
 
68
68
  // Optional fields
69
- project: "my-project", // Defaults to "main"
69
+ project: "main", // Defaults to "main"
70
70
  phoneNumber: "assign-automatically", // Defaults to null
71
71
  timezone: "Australia/Melbourne", // Defaults to "America/Los_Angeles"
72
72
  audioFormat: "mulaw_8000", // Defaults to "pcm_44100". Must be "mulaw_8000" when `phoneNumber` is "assign-automatically"
@@ -99,11 +99,11 @@ const createAgentResult = await phonic.agents.create({
99
99
  ### Update agent
100
100
 
101
101
  ```ts
102
- const updateAgentResult = await phonic.agents.update("my-agent", {
103
- name: "my-updated-agent",
102
+ const updateAgentResult = await phonic.agents.update("chris", {
103
+ name: "chris",
104
104
 
105
105
  // Optional fields
106
- project: "my-project",
106
+ project: "main",
107
107
  phoneNumber: "assign-automatically", // or null
108
108
  timezone: "Australia/Melbourne",
109
109
  voiceId: "sarah",
@@ -137,10 +137,9 @@ const updateAgentResult = await phonic.agents.update("my-agent", {
137
137
 
138
138
  ```ts
139
139
  const deleteAgentResult = await phonic.agents.delete({
140
- name: "my-agent",
141
-
140
+ name: "chris",
142
141
  // Optional fields
143
- project: "my-project",
142
+ project: "main",
144
143
  });
145
144
  ```
146
145
 
@@ -164,6 +163,7 @@ const toolResult = await phonic.tools.get("next_invoice");
164
163
  const createToolResult = await phonic.tools.create({
165
164
  name: "next_invoice",
166
165
  description: "Returns the next invoice of the given user",
166
+ endpointMethod: "POST",
167
167
  endpointUrl: "https://myapp.com/webhooks/next-invoice",
168
168
  endpointHeaders: {
169
169
  Authorization: "Bearer 123"
@@ -199,6 +199,7 @@ const createToolResult = await phonic.tools.create({
199
199
  const updateToolResult = await phonic.tools.update("next_invoice", {
200
200
  name: "next_invoice_updated",
201
201
  description: "Updated description.",
202
+ endpointMethod: "POST",
202
203
  endpointUrl: "https://myapp.com/webhooks/next-invoice-updated",
203
204
  endpointHeaders: {
204
205
  Authorization: "Bearer 456"
@@ -285,16 +286,11 @@ const conversationResult = await phonic.conversations.getByExternalId({
285
286
  ```ts
286
287
  const outboundCallResult = await phonic.conversations.outboundCall("+19189396241", {
287
288
  // Optional fields
288
- welcome_message: "Hello, how can I help you?",
289
- project: "main",
290
- system_prompt: "You are a helpful assistant.",
291
- voice_id: "grant",
292
- enable_silent_audio_fallback: true,
293
- vad_prebuffer_duration_ms: 1800,
294
- vad_min_speech_duration_ms: 40,
295
- vad_min_silence_duration_ms: 550,
296
- vad_threshold: 0.6,
297
- tools: ["keypad_input", "natural_conversation_ending"]
289
+ agent: "chris",
290
+ template_variables: {
291
+ customer_name: "David",
292
+ subject: "Chess"
293
+ },
298
294
  });
299
295
  ```
300
296
 
@@ -313,6 +309,7 @@ const twilioOutboundCallResult = await phonic.conversations.twilio.outboundCall(
313
309
  },
314
310
  {
315
311
  // Optional fields
312
+ agent: "chris",
316
313
  welcome_message: "Hello, how can I help you?",
317
314
  project: "main",
318
315
  system_prompt: "You are a helpful assistant.",
@@ -336,17 +333,14 @@ const phonicWebSocket = phonic.sts.websocket({
336
333
  input_format: "mulaw_8000",
337
334
 
338
335
  // Optional fields
339
- project: "main",
340
- system_prompt: "You are a helpful assistant.",
336
+ agent: "chris",
337
+ template_variables: {
338
+ customer_name: "David",
339
+ subject: "Chess"
340
+ },
341
341
  welcome_message: "Hello, how can I help you?",
342
342
  voice_id: "grant",
343
343
  output_format: "mulaw_8000",
344
- enable_silent_audio_fallback: true,
345
- vad_prebuffer_duration_ms: 1800,
346
- vad_min_speech_duration_ms: 40,
347
- vad_min_silence_duration_ms: 550,
348
- vad_threshold: 0.6,
349
- tools: ["keypad_input", "natural_conversation_ending"]
350
344
  });
351
345
  ```
352
346
 
package/dist/index.d.mts CHANGED
@@ -37,10 +37,11 @@ type ISODateTime$1 = `${string}Z`;
37
37
  type PhonicSTSTool = "keypad_input" | "natural_conversation_ending" | (string & {});
38
38
  interface PhonicSTSConfigBase {
39
39
  input_format: "pcm_44100" | "mulaw_8000";
40
- system_prompt?: string;
41
- welcome_message?: string;
42
- voice_id?: string;
43
40
  output_format?: "pcm_44100" | "mulaw_8000";
41
+ voice_id?: string;
42
+ welcome_message?: string;
43
+ system_prompt?: string;
44
+ template_variables?: Record<string, string>;
44
45
  enable_silent_audio_fallback?: boolean;
45
46
  experimental_params?: Record<string, unknown>;
46
47
  tools?: Array<PhonicSTSTool>;
@@ -383,6 +384,7 @@ type Tool = {
383
384
  id: string;
384
385
  name: string;
385
386
  description: string;
387
+ endpoint_method: "POST";
386
388
  endpoint_url: string;
387
389
  endpoint_headers: Record<string, string>;
388
390
  endpoint_timeout_ms: number;
@@ -397,6 +399,7 @@ type GetToolSuccessResponse = DataOrError<{
397
399
  type CreateToolParams = {
398
400
  name: string;
399
401
  description: string;
402
+ endpointMethod: "POST";
400
403
  endpointUrl: string;
401
404
  endpointHeaders?: Record<string, string>;
402
405
  endpointTimeoutMs?: number;
@@ -409,6 +412,7 @@ type CreateToolSuccessResponse = {
409
412
  type UpdateToolParams = {
410
413
  name?: string;
411
414
  description?: string;
415
+ endpointMethod?: "POST";
412
416
  endpointUrl?: string;
413
417
  endpointHeaders?: Record<string, string>;
414
418
  endpointTimeoutMs?: number;
package/dist/index.d.ts CHANGED
@@ -37,10 +37,11 @@ type ISODateTime$1 = `${string}Z`;
37
37
  type PhonicSTSTool = "keypad_input" | "natural_conversation_ending" | (string & {});
38
38
  interface PhonicSTSConfigBase {
39
39
  input_format: "pcm_44100" | "mulaw_8000";
40
- system_prompt?: string;
41
- welcome_message?: string;
42
- voice_id?: string;
43
40
  output_format?: "pcm_44100" | "mulaw_8000";
41
+ voice_id?: string;
42
+ welcome_message?: string;
43
+ system_prompt?: string;
44
+ template_variables?: Record<string, string>;
44
45
  enable_silent_audio_fallback?: boolean;
45
46
  experimental_params?: Record<string, unknown>;
46
47
  tools?: Array<PhonicSTSTool>;
@@ -383,6 +384,7 @@ type Tool = {
383
384
  id: string;
384
385
  name: string;
385
386
  description: string;
387
+ endpoint_method: "POST";
386
388
  endpoint_url: string;
387
389
  endpoint_headers: Record<string, string>;
388
390
  endpoint_timeout_ms: number;
@@ -397,6 +399,7 @@ type GetToolSuccessResponse = DataOrError<{
397
399
  type CreateToolParams = {
398
400
  name: string;
399
401
  description: string;
402
+ endpointMethod: "POST";
400
403
  endpointUrl: string;
401
404
  endpointHeaders?: Record<string, string>;
402
405
  endpointTimeoutMs?: number;
@@ -409,6 +412,7 @@ type CreateToolSuccessResponse = {
409
412
  type UpdateToolParams = {
410
413
  name?: string;
411
414
  description?: string;
415
+ endpointMethod?: "POST";
412
416
  endpointUrl?: string;
413
417
  endpointHeaders?: Record<string, string>;
414
418
  endpointTimeoutMs?: number;
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ __export(index_exports, {
35
35
  module.exports = __toCommonJS(index_exports);
36
36
 
37
37
  // package.json
38
- var version = "0.25.1";
38
+ var version = "0.25.3";
39
39
 
40
40
  // src/agents/index.ts
41
41
  var Agents = class {
@@ -383,6 +383,7 @@ var Tools = class {
383
383
  {
384
384
  name: params.name,
385
385
  description: params.description,
386
+ endpoint_method: params.endpointMethod,
386
387
  endpoint_url: params.endpointUrl,
387
388
  endpoint_headers: params.endpointHeaders,
388
389
  endpoint_timeout_ms: params.endpointTimeoutMs,
@@ -397,6 +398,7 @@ var Tools = class {
397
398
  {
398
399
  name: params.name,
399
400
  description: params.description,
401
+ endpoint_method: params.endpointMethod,
400
402
  endpoint_url: params.endpointUrl,
401
403
  endpoint_headers: params.endpointHeaders,
402
404
  endpoint_timeout_ms: params.endpointTimeoutMs,
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.25.1";
2
+ var version = "0.25.3";
3
3
 
4
4
  // src/agents/index.ts
5
5
  var Agents = class {
@@ -347,6 +347,7 @@ var Tools = class {
347
347
  {
348
348
  name: params.name,
349
349
  description: params.description,
350
+ endpoint_method: params.endpointMethod,
350
351
  endpoint_url: params.endpointUrl,
351
352
  endpoint_headers: params.endpointHeaders,
352
353
  endpoint_timeout_ms: params.endpointTimeoutMs,
@@ -361,6 +362,7 @@ var Tools = class {
361
362
  {
362
363
  name: params.name,
363
364
  description: params.description,
365
+ endpoint_method: params.endpointMethod,
364
366
  endpoint_url: params.endpointUrl,
365
367
  endpoint_headers: params.endpointHeaders,
366
368
  endpoint_timeout_ms: params.endpointTimeoutMs,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phonic",
3
- "version": "0.25.1",
3
+ "version": "0.25.3",
4
4
  "description": "Phonic Node.js SDK",
5
5
  "scripts": {
6
6
  "build": "tsup",