@vapi-ai/web 1.0.232 → 1.0.234

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
@@ -72,6 +72,11 @@ vapi.on('volume-level', (volume) => {
72
72
  console.log(`Assistant volume level: ${volume}`);
73
73
  });
74
74
 
75
+ // Function calls and transcripts will be sent via messages
76
+ vapi.on('message', (message) => {
77
+ console.log(message);
78
+ });
79
+
75
80
  vapi.on('error', (e) => {
76
81
  console.error(e)
77
82
  });
package/api.ts CHANGED
@@ -29,7 +29,7 @@ export interface CustomModel {
29
29
  * If you have your own LLM, you can use the URL of your LLM endpoint here.
30
30
  */
31
31
  provider: "custom";
32
- /** These are the options that will be passed to the provider. */
32
+ /** These is the URL we'll POST during the conversation. */
33
33
  url: string;
34
34
  /** This sets the objective and understanding for the assistant. */
35
35
  systemPrompt?: string;
@@ -115,7 +115,11 @@ export interface OpenAIModel {
115
115
  model: "gpt-4" | "gpt-3.5-turbo";
116
116
  /** This sets the objective and understanding for the assistant. */
117
117
  systemPrompt?: string;
118
- /** This is the temperature that will be used for OpenAI calls. */
118
+ /**
119
+ * This is the temperature that will be used for OpenAI calls.
120
+ * @min 0
121
+ * @max 2
122
+ */
119
123
  temperature?: number;
120
124
  /** These are the functions that the assistant can execute during the call. */
121
125
  functions?: OpenAIFunction[];
@@ -148,15 +152,19 @@ export interface RimeAIVoice {
148
152
  }
149
153
 
150
154
  export interface CreateAssistantDTO {
155
+ /**
156
+ * This is the name of the assistant. This is just for your own reference.
157
+ * @maxLength 100
158
+ */
159
+ name?: string;
160
+ /** These are the options for the assistant's transcriber. */
161
+ transcriber?: DeepgramTranscriber;
151
162
  /** These are the options for the assistant's LLM. */
152
- model?:
153
- | ({
154
- provider: "openai";
155
- } & OpenAIModel)
156
- | ({
157
- provider: "custom";
158
- } & CustomModel);
159
- /** These are the options for the assistant's voice. */
163
+ model?: "0" | "1" | "2" | OpenAIModel | CustomModel;
164
+ /**
165
+ * These are the options for the assistant's voice.
166
+ * @default "jennifer-playht"
167
+ */
160
168
  voice?:
161
169
  | "jennifer-playht"
162
170
  | "melissa-playht"
@@ -222,38 +230,6 @@ export interface CreateAssistantDTO {
222
230
  | "pt-BR"
223
231
  | "es"
224
232
  | "es-419";
225
- /**
226
- * Use `model.systemPrompt` instead.
227
- * @deprecated
228
- */
229
- context?: string;
230
- /**
231
- * Use `model.functions` instead.
232
- * @deprecated
233
- */
234
- functions?: OpenAIFunction[];
235
- /**
236
- * Add a Server URL to your Org on the Account page in the dashboard instead.
237
- * @deprecated
238
- */
239
- callbackUrl?: string;
240
- /**
241
- * Use `model.url` instead.
242
- * @deprecated
243
- */
244
- customLlmUrl?: string;
245
- /**
246
- * Use `transcriber.keywords` instead.
247
- * @deprecated
248
- */
249
- keywords?: string[];
250
- /**
251
- * This is the name of the assistant. This is just for your own reference.
252
- * @maxLength 100
253
- */
254
- name?: string;
255
- /** These are the options for the assistant's transcriber. */
256
- transcriber?: DeepgramTranscriber;
257
233
  /** This is the number to forward to if assistant runs into issues. */
258
234
  forwardingPhoneNumber?: string;
259
235
  /**
@@ -261,6 +237,7 @@ export interface CreateAssistantDTO {
261
237
  *
262
238
  * If unspecified, it will wait for the user to speak.
263
239
  * @maxLength 1000
240
+ * @default "Hey there!"
264
241
  */
265
242
  firstMessage?: string;
266
243
  /**
@@ -288,15 +265,19 @@ export interface CreateAssistantDTO {
288
265
  }
289
266
 
290
267
  export interface Assistant {
268
+ /**
269
+ * This is the name of the assistant. This is just for your own reference.
270
+ * @maxLength 100
271
+ */
272
+ name?: string;
273
+ /** These are the options for the assistant's transcriber. */
274
+ transcriber?: DeepgramTranscriber;
291
275
  /** These are the options for the assistant's LLM. */
292
- model?:
293
- | ({
294
- provider: "openai";
295
- } & OpenAIModel)
296
- | ({
297
- provider: "custom";
298
- } & CustomModel);
299
- /** These are the options for the assistant's voice. */
276
+ model?: "0" | "1" | "2" | OpenAIModel | CustomModel;
277
+ /**
278
+ * These are the options for the assistant's voice.
279
+ * @default "jennifer-playht"
280
+ */
300
281
  voice?:
301
282
  | "jennifer-playht"
302
283
  | "melissa-playht"
@@ -362,38 +343,6 @@ export interface Assistant {
362
343
  | "pt-BR"
363
344
  | "es"
364
345
  | "es-419";
365
- /**
366
- * Use `model.systemPrompt` instead.
367
- * @deprecated
368
- */
369
- context?: string;
370
- /**
371
- * Use `model.functions` instead.
372
- * @deprecated
373
- */
374
- functions?: OpenAIFunction[];
375
- /**
376
- * Add a Server URL to your Org on the Account page in the dashboard instead.
377
- * @deprecated
378
- */
379
- callbackUrl?: string;
380
- /**
381
- * Use `model.url` instead.
382
- * @deprecated
383
- */
384
- customLlmUrl?: string;
385
- /**
386
- * Use `transcriber.keywords` instead.
387
- * @deprecated
388
- */
389
- keywords?: string[];
390
- /**
391
- * This is the name of the assistant. This is just for your own reference.
392
- * @maxLength 100
393
- */
394
- name?: string;
395
- /** These are the options for the assistant's transcriber. */
396
- transcriber?: DeepgramTranscriber;
397
346
  /** This is the number to forward to if assistant runs into issues. */
398
347
  forwardingPhoneNumber?: string;
399
348
  /**
@@ -401,6 +350,7 @@ export interface Assistant {
401
350
  *
402
351
  * If unspecified, it will wait for the user to speak.
403
352
  * @maxLength 1000
353
+ * @default "Hey there!"
404
354
  */
405
355
  firstMessage?: string;
406
356
  /**
@@ -442,15 +392,19 @@ export interface Assistant {
442
392
  }
443
393
 
444
394
  export interface UpdateAssistantDTO {
395
+ /**
396
+ * This is the name of the assistant. This is just for your own reference.
397
+ * @maxLength 100
398
+ */
399
+ name?: string;
400
+ /** These are the options for the assistant's transcriber. */
401
+ transcriber?: DeepgramTranscriber;
445
402
  /** These are the options for the assistant's LLM. */
446
- model?:
447
- | ({
448
- provider: "openai";
449
- } & OpenAIModel)
450
- | ({
451
- provider: "custom";
452
- } & CustomModel);
453
- /** These are the options for the assistant's voice. */
403
+ model?: "0" | "1" | "2" | OpenAIModel | CustomModel;
404
+ /**
405
+ * These are the options for the assistant's voice.
406
+ * @default "jennifer-playht"
407
+ */
454
408
  voice?:
455
409
  | "jennifer-playht"
456
410
  | "melissa-playht"
@@ -516,38 +470,6 @@ export interface UpdateAssistantDTO {
516
470
  | "pt-BR"
517
471
  | "es"
518
472
  | "es-419";
519
- /**
520
- * Use `model.systemPrompt` instead.
521
- * @deprecated
522
- */
523
- context?: string;
524
- /**
525
- * Use `model.functions` instead.
526
- * @deprecated
527
- */
528
- functions?: OpenAIFunction[];
529
- /**
530
- * Add a Server URL to your Org on the Account page in the dashboard instead.
531
- * @deprecated
532
- */
533
- callbackUrl?: string;
534
- /**
535
- * Use `model.url` instead.
536
- * @deprecated
537
- */
538
- customLlmUrl?: string;
539
- /**
540
- * Use `transcriber.keywords` instead.
541
- * @deprecated
542
- */
543
- keywords?: string[];
544
- /**
545
- * This is the name of the assistant. This is just for your own reference.
546
- * @maxLength 100
547
- */
548
- name?: string;
549
- /** These are the options for the assistant's transcriber. */
550
- transcriber?: DeepgramTranscriber;
551
473
  /** This is the number to forward to if assistant runs into issues. */
552
474
  forwardingPhoneNumber?: string;
553
475
  /**
@@ -555,6 +477,7 @@ export interface UpdateAssistantDTO {
555
477
  *
556
478
  * If unspecified, it will wait for the user to speak.
557
479
  * @maxLength 1000
480
+ * @default "Hey there!"
558
481
  */
559
482
  firstMessage?: string;
560
483
  /**
@@ -614,30 +537,26 @@ export interface ImportTwilioPhoneNumberDTO {
614
537
  export interface Call {
615
538
  /** This is the type of call. */
616
539
  type?: "inboundPhoneCall" | "outboundPhoneCall" | "webCall";
617
- /**
618
- * Use `status` instead.
619
- * @deprecated
620
- */
621
- twilioCallStatus?: string;
622
540
  /** This is the status of the call. */
623
541
  status?: "queued" | "ringing" | "in-progress" | "forwarding" | "ended";
624
542
  /** This is the explanation for how the call ended. */
625
543
  endedReason?:
626
- | "assistant-ended"
544
+ | "assistant-ended-call"
627
545
  | "assistant-error"
628
- | "assistant-join-timeout"
629
- | "busy"
630
- | "canceled"
631
- | "customer-ended"
632
- | "forwarded"
633
- | "max-duration-timeout"
634
- | "no-answer"
546
+ | "assistant-forwarded-call"
547
+ | "assistant-join-timed-out"
548
+ | "assistant-not-found"
549
+ | "manually-canceled"
550
+ | "customer-busy"
551
+ | "customer-ended-call"
552
+ | "customer-did-not-answer"
553
+ | "db-error"
554
+ | "exceeded-max-duration"
635
555
  | "no-server-available"
636
556
  | "server-shutdown"
637
- | "silence-timeout"
638
- | "twilio-call-error"
639
- | "twilio-websocket-close"
640
- | "twilio-websocket-error"
557
+ | "silence-timed-out"
558
+ | "twilio-failed-to-connect-call"
559
+ | "twilio-closed-websocket"
641
560
  | "unknown-error"
642
561
  | "voicemail";
643
562
  /** This is the unique identifier for the call. */
@@ -715,11 +634,6 @@ export interface Call {
715
634
  }
716
635
 
717
636
  export interface CreateOutboundCallDTO {
718
- /**
719
- * Use `customer` instead.
720
- * @deprecated
721
- */
722
- customerPhoneNumber?: string;
723
637
  /** This is the assistant that will be used for the call. To use a transient assistant, use `assistant` instead. */
724
638
  assistantId?: string;
725
639
  /** This is the assistant that will be used for the call. To use an existing assistant, use `assistantId` instead. */
@@ -757,6 +671,111 @@ export interface CreateWebCallDTO {
757
671
  assistant?: CreateAssistantDTO;
758
672
  }
759
673
 
674
+ export interface CreateTwilioCredentialDTO {
675
+ provider: "twilio";
676
+ /** This is hidden in the API responses. */
677
+ authToken: string;
678
+ accountSid: string;
679
+ }
680
+
681
+ export interface CreateDeepgramCredentialDTO {
682
+ provider: "deepgram";
683
+ /** This is hidden in the API responses. */
684
+ apiKey: string;
685
+ }
686
+
687
+ export interface CreateAzureCredentialDTO {
688
+ provider: "azure-openai";
689
+ /** This is hidden in the API responses. */
690
+ openAIKey: string;
691
+ openAIEndpoint: string;
692
+ }
693
+
694
+ export interface CreateElevenLabsCredentialDTO {
695
+ provider: "11labs";
696
+ /** This is hidden in the API responses. */
697
+ apiKey: string;
698
+ }
699
+
700
+ export interface CreatePlayHTCredentialDTO {
701
+ provider: "playht";
702
+ /** This is hidden in the API responses. */
703
+ apiKey: string;
704
+ userId: string;
705
+ }
706
+
707
+ export interface CreateRimeAICredentialDTO {
708
+ provider: "rimeai";
709
+ /** This is hidden in the API responses. */
710
+ apiKey: string;
711
+ }
712
+
713
+ export interface UpdateTwilioCredentialDTO {
714
+ provider: "twilio";
715
+ /** This is hidden in the API responses. */
716
+ authToken: string;
717
+ accountSid: string;
718
+ }
719
+
720
+ export interface UpdateDeepgramCredentialDTO {
721
+ provider: "deepgram";
722
+ /** This is hidden in the API responses. */
723
+ apiKey: string;
724
+ }
725
+
726
+ export interface UpdateAzureCredentialDTO {
727
+ provider: "azure-openai";
728
+ /** This is hidden in the API responses. */
729
+ openAIKey: string;
730
+ openAIEndpoint: string;
731
+ }
732
+
733
+ export interface UpdateElevenLabsCredentialDTO {
734
+ provider: "11labs";
735
+ /** This is hidden in the API responses. */
736
+ apiKey: string;
737
+ }
738
+
739
+ export interface UpdatePlayHTCredentialDTO {
740
+ provider: "playht";
741
+ /** This is hidden in the API responses. */
742
+ apiKey: string;
743
+ userId: string;
744
+ }
745
+
746
+ export interface UpdateRimeAICredentialDTO {
747
+ provider: "rimeai";
748
+ /** This is hidden in the API responses. */
749
+ apiKey: string;
750
+ }
751
+
752
+ export interface Credential {
753
+ /** This is hidden in the API responses. */
754
+ authToken?: string;
755
+ /** This is hidden in the API responses. */
756
+ apiKey?: string;
757
+ /** This is hidden in the API responses. */
758
+ openAIKey?: string;
759
+ provider: "twilio" | "deepgram" | "azure-openai" | "11labs" | "playht" | "rimeai";
760
+ /** This is the unique identifier for the credential. */
761
+ id: string;
762
+ /** This is the unique identifier for the org that this credential belongs to. */
763
+ orgId: string;
764
+ /**
765
+ * This is the ISO 8601 date-time string of when the credential was created.
766
+ * @format date-time
767
+ */
768
+ createdAt: string;
769
+ /**
770
+ * This is the ISO 8601 date-time string of when the assistant was last updated.
771
+ * @format date-time
772
+ */
773
+ updatedAt: string;
774
+ accountSid?: string;
775
+ openAIEndpoint?: string;
776
+ userId?: string;
777
+ }
778
+
760
779
  export interface BuyPhoneNumberDTO {
761
780
  /**
762
781
  * This is the area code of the phone number to purchase.
@@ -1233,6 +1252,144 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1233
1252
  ...params,
1234
1253
  }),
1235
1254
  };
1255
+ credential = {
1256
+ /**
1257
+ * No description
1258
+ *
1259
+ * @tags Credentials
1260
+ * @name CredentialControllerCreate
1261
+ * @summary Create Credential
1262
+ * @request POST:/credential
1263
+ * @secure
1264
+ */
1265
+ credentialControllerCreate: (
1266
+ data:
1267
+ | ({
1268
+ provider: "twilio";
1269
+ } & CreateTwilioCredentialDTO)
1270
+ | ({
1271
+ provider: "deepgram";
1272
+ } & CreateDeepgramCredentialDTO)
1273
+ | ({
1274
+ provider: "azure-openai";
1275
+ } & CreateAzureCredentialDTO)
1276
+ | ({
1277
+ provider: "11labs";
1278
+ } & CreateElevenLabsCredentialDTO)
1279
+ | ({
1280
+ provider: "playht";
1281
+ } & CreatePlayHTCredentialDTO)
1282
+ | ({
1283
+ provider: "rimeai";
1284
+ } & CreateRimeAICredentialDTO),
1285
+ params: RequestParams = {},
1286
+ ) =>
1287
+ this.request<Credential, any>({
1288
+ path: `/credential`,
1289
+ method: "POST",
1290
+ body: data,
1291
+ secure: true,
1292
+ type: ContentType.Json,
1293
+ format: "json",
1294
+ ...params,
1295
+ }),
1296
+
1297
+ /**
1298
+ * No description
1299
+ *
1300
+ * @tags Credentials
1301
+ * @name CredentialControllerFindAll
1302
+ * @summary List Credentials
1303
+ * @request GET:/credential
1304
+ * @secure
1305
+ */
1306
+ credentialControllerFindAll: (params: RequestParams = {}) =>
1307
+ this.request<Credential[], any>({
1308
+ path: `/credential`,
1309
+ method: "GET",
1310
+ secure: true,
1311
+ format: "json",
1312
+ ...params,
1313
+ }),
1314
+
1315
+ /**
1316
+ * No description
1317
+ *
1318
+ * @tags Credentials
1319
+ * @name CredentialControllerFindOne
1320
+ * @summary Get Credential
1321
+ * @request GET:/credential/{id}
1322
+ * @secure
1323
+ */
1324
+ credentialControllerFindOne: (id: string, params: RequestParams = {}) =>
1325
+ this.request<Credential, any>({
1326
+ path: `/credential/${id}`,
1327
+ method: "GET",
1328
+ secure: true,
1329
+ format: "json",
1330
+ ...params,
1331
+ }),
1332
+
1333
+ /**
1334
+ * No description
1335
+ *
1336
+ * @tags Credentials
1337
+ * @name CredentialControllerUpdate
1338
+ * @summary Update Credential
1339
+ * @request PUT:/credential/{id}
1340
+ * @secure
1341
+ */
1342
+ credentialControllerUpdate: (
1343
+ id: string,
1344
+ data:
1345
+ | ({
1346
+ provider: "twilio";
1347
+ } & UpdateTwilioCredentialDTO)
1348
+ | ({
1349
+ provider: "deepgram";
1350
+ } & UpdateDeepgramCredentialDTO)
1351
+ | ({
1352
+ provider: "azure-openai";
1353
+ } & UpdateAzureCredentialDTO)
1354
+ | ({
1355
+ provider: "11labs";
1356
+ } & UpdateElevenLabsCredentialDTO)
1357
+ | ({
1358
+ provider: "playht";
1359
+ } & UpdatePlayHTCredentialDTO)
1360
+ | ({
1361
+ provider: "rimeai";
1362
+ } & UpdateRimeAICredentialDTO),
1363
+ params: RequestParams = {},
1364
+ ) =>
1365
+ this.request<Credential, any>({
1366
+ path: `/credential/${id}`,
1367
+ method: "PUT",
1368
+ body: data,
1369
+ secure: true,
1370
+ type: ContentType.Json,
1371
+ format: "json",
1372
+ ...params,
1373
+ }),
1374
+
1375
+ /**
1376
+ * No description
1377
+ *
1378
+ * @tags Credentials
1379
+ * @name CredentialControllerRemove
1380
+ * @summary Delete Credential
1381
+ * @request DELETE:/credential/{id}
1382
+ * @secure
1383
+ */
1384
+ credentialControllerRemove: (id: string, params: RequestParams = {}) =>
1385
+ this.request<Credential, any>({
1386
+ path: `/credential/${id}`,
1387
+ method: "DELETE",
1388
+ secure: true,
1389
+ format: "json",
1390
+ ...params,
1391
+ }),
1392
+ };
1236
1393
  phoneNumber = {
1237
1394
  /**
1238
1395
  * No description
@@ -1340,10 +1497,11 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1340
1497
  * @secure
1341
1498
  */
1342
1499
  phoneNumberControllerRemove: (id: string, params: RequestParams = {}) =>
1343
- this.request<void, any>({
1500
+ this.request<PhoneNumber, any>({
1344
1501
  path: `/phone-number/${id}`,
1345
1502
  method: "DELETE",
1346
1503
  secure: true,
1504
+ format: "json",
1347
1505
  ...params,
1348
1506
  }),
1349
1507
  };
package/dist/api.d.ts CHANGED
@@ -17,7 +17,7 @@ export interface CustomModel {
17
17
  * If you have your own LLM, you can use the URL of your LLM endpoint here.
18
18
  */
19
19
  provider: "custom";
20
- /** These are the options that will be passed to the provider. */
20
+ /** These is the URL we'll POST during the conversation. */
21
21
  url: string;
22
22
  /** This sets the objective and understanding for the assistant. */
23
23
  systemPrompt?: string;
@@ -84,7 +84,11 @@ export interface OpenAIModel {
84
84
  model: "gpt-4" | "gpt-3.5-turbo";
85
85
  /** This sets the objective and understanding for the assistant. */
86
86
  systemPrompt?: string;
87
- /** This is the temperature that will be used for OpenAI calls. */
87
+ /**
88
+ * This is the temperature that will be used for OpenAI calls.
89
+ * @min 0
90
+ * @max 2
91
+ */
88
92
  temperature?: number;
89
93
  /** These are the functions that the assistant can execute during the call. */
90
94
  functions?: OpenAIFunction[];
@@ -114,44 +118,6 @@ export interface RimeAIVoice {
114
118
  voiceId: string;
115
119
  }
116
120
  export interface CreateAssistantDTO {
117
- /** These are the options for the assistant's LLM. */
118
- model?: ({
119
- provider: "openai";
120
- } & OpenAIModel) | ({
121
- provider: "custom";
122
- } & CustomModel);
123
- /** These are the options for the assistant's voice. */
124
- voice?: "jennifer-playht" | "melissa-playht" | "will-playht" | "chris-playht" | "matt-playht" | "jack-playht" | "ruby-playht" | "davis-playht" | "donna-playht" | "michael-playht" | "burt-11labs" | "andrea-11labs" | "phillip-11labs" | "steve-11labs" | "joseph-11labs" | "myra-11labs" | "paula-11labs" | "ryan-11labs" | "drew-11labs" | "paul-11labs" | "mrb-11labs" | "matilda-11labs" | "kai-rimeai" | "zion-rimeai" | "xavier-rimeai" | "marty-rimeai" | "hudson-rimeai" | "savannah-rimeai" | "colette-rimeai" | "daphne-rimeai" | "aurora-rimeai" | "nova-rimeai" | "apollo-beta" | "orion-beta" | "aurora-beta" | "asteria-beta" | "stella-beta" | "artemis-beta" | "andromeda-beta" | "atlas-beta" | ElevenLabsVoice | PlayHTVoice | RimeAIVoice | BetaVoice;
125
- /**
126
- * This sets the spoken language of the user. The assistant will do its best to respond in the same language.
127
- * When using a language other than `en-*`, only `11labs` voices will pronounce the words correctly. There will also be ~1sec of additional latency.
128
- */
129
- language?: "en" | "en-US" | "en-AU" | "en-GB" | "en-NZ" | "en-IN" | "fr" | "fr-CA" | "de" | "hi" | "hi-Latn" | "pt" | "pt-BR" | "es" | "es-419";
130
- /**
131
- * Use `model.systemPrompt` instead.
132
- * @deprecated
133
- */
134
- context?: string;
135
- /**
136
- * Use `model.functions` instead.
137
- * @deprecated
138
- */
139
- functions?: OpenAIFunction[];
140
- /**
141
- * Add a Server URL to your Org on the Account page in the dashboard instead.
142
- * @deprecated
143
- */
144
- callbackUrl?: string;
145
- /**
146
- * Use `model.url` instead.
147
- * @deprecated
148
- */
149
- customLlmUrl?: string;
150
- /**
151
- * Use `transcriber.keywords` instead.
152
- * @deprecated
153
- */
154
- keywords?: string[];
155
121
  /**
156
122
  * This is the name of the assistant. This is just for your own reference.
157
123
  * @maxLength 100
@@ -159,6 +125,18 @@ export interface CreateAssistantDTO {
159
125
  name?: string;
160
126
  /** These are the options for the assistant's transcriber. */
161
127
  transcriber?: DeepgramTranscriber;
128
+ /** These are the options for the assistant's LLM. */
129
+ model?: "0" | "1" | "2" | OpenAIModel | CustomModel;
130
+ /**
131
+ * These are the options for the assistant's voice.
132
+ * @default "jennifer-playht"
133
+ */
134
+ voice?: "jennifer-playht" | "melissa-playht" | "will-playht" | "chris-playht" | "matt-playht" | "jack-playht" | "ruby-playht" | "davis-playht" | "donna-playht" | "michael-playht" | "burt-11labs" | "andrea-11labs" | "phillip-11labs" | "steve-11labs" | "joseph-11labs" | "myra-11labs" | "paula-11labs" | "ryan-11labs" | "drew-11labs" | "paul-11labs" | "mrb-11labs" | "matilda-11labs" | "kai-rimeai" | "zion-rimeai" | "xavier-rimeai" | "marty-rimeai" | "hudson-rimeai" | "savannah-rimeai" | "colette-rimeai" | "daphne-rimeai" | "aurora-rimeai" | "nova-rimeai" | "apollo-beta" | "orion-beta" | "aurora-beta" | "asteria-beta" | "stella-beta" | "artemis-beta" | "andromeda-beta" | "atlas-beta" | ElevenLabsVoice | PlayHTVoice | RimeAIVoice | BetaVoice;
135
+ /**
136
+ * This sets the spoken language of the user. The assistant will do its best to respond in the same language.
137
+ * When using a language other than `en-*`, only `11labs` voices will pronounce the words correctly. There will also be ~1sec of additional latency.
138
+ */
139
+ language?: "en" | "en-US" | "en-AU" | "en-GB" | "en-NZ" | "en-IN" | "fr" | "fr-CA" | "de" | "hi" | "hi-Latn" | "pt" | "pt-BR" | "es" | "es-419";
162
140
  /** This is the number to forward to if assistant runs into issues. */
163
141
  forwardingPhoneNumber?: string;
164
142
  /**
@@ -166,6 +144,7 @@ export interface CreateAssistantDTO {
166
144
  *
167
145
  * If unspecified, it will wait for the user to speak.
168
146
  * @maxLength 1000
147
+ * @default "Hey there!"
169
148
  */
170
149
  firstMessage?: string;
171
150
  /**
@@ -192,44 +171,6 @@ export interface CreateAssistantDTO {
192
171
  fillersEnabled?: boolean;
193
172
  }
194
173
  export interface Assistant {
195
- /** These are the options for the assistant's LLM. */
196
- model?: ({
197
- provider: "openai";
198
- } & OpenAIModel) | ({
199
- provider: "custom";
200
- } & CustomModel);
201
- /** These are the options for the assistant's voice. */
202
- voice?: "jennifer-playht" | "melissa-playht" | "will-playht" | "chris-playht" | "matt-playht" | "jack-playht" | "ruby-playht" | "davis-playht" | "donna-playht" | "michael-playht" | "burt-11labs" | "andrea-11labs" | "phillip-11labs" | "steve-11labs" | "joseph-11labs" | "myra-11labs" | "paula-11labs" | "ryan-11labs" | "drew-11labs" | "paul-11labs" | "mrb-11labs" | "matilda-11labs" | "kai-rimeai" | "zion-rimeai" | "xavier-rimeai" | "marty-rimeai" | "hudson-rimeai" | "savannah-rimeai" | "colette-rimeai" | "daphne-rimeai" | "aurora-rimeai" | "nova-rimeai" | "apollo-beta" | "orion-beta" | "aurora-beta" | "asteria-beta" | "stella-beta" | "artemis-beta" | "andromeda-beta" | "atlas-beta" | ElevenLabsVoice | PlayHTVoice | RimeAIVoice | BetaVoice;
203
- /**
204
- * This sets the spoken language of the user. The assistant will do its best to respond in the same language.
205
- * When using a language other than `en-*`, only `11labs` voices will pronounce the words correctly. There will also be ~1sec of additional latency.
206
- */
207
- language?: "en" | "en-US" | "en-AU" | "en-GB" | "en-NZ" | "en-IN" | "fr" | "fr-CA" | "de" | "hi" | "hi-Latn" | "pt" | "pt-BR" | "es" | "es-419";
208
- /**
209
- * Use `model.systemPrompt` instead.
210
- * @deprecated
211
- */
212
- context?: string;
213
- /**
214
- * Use `model.functions` instead.
215
- * @deprecated
216
- */
217
- functions?: OpenAIFunction[];
218
- /**
219
- * Add a Server URL to your Org on the Account page in the dashboard instead.
220
- * @deprecated
221
- */
222
- callbackUrl?: string;
223
- /**
224
- * Use `model.url` instead.
225
- * @deprecated
226
- */
227
- customLlmUrl?: string;
228
- /**
229
- * Use `transcriber.keywords` instead.
230
- * @deprecated
231
- */
232
- keywords?: string[];
233
174
  /**
234
175
  * This is the name of the assistant. This is just for your own reference.
235
176
  * @maxLength 100
@@ -237,6 +178,18 @@ export interface Assistant {
237
178
  name?: string;
238
179
  /** These are the options for the assistant's transcriber. */
239
180
  transcriber?: DeepgramTranscriber;
181
+ /** These are the options for the assistant's LLM. */
182
+ model?: "0" | "1" | "2" | OpenAIModel | CustomModel;
183
+ /**
184
+ * These are the options for the assistant's voice.
185
+ * @default "jennifer-playht"
186
+ */
187
+ voice?: "jennifer-playht" | "melissa-playht" | "will-playht" | "chris-playht" | "matt-playht" | "jack-playht" | "ruby-playht" | "davis-playht" | "donna-playht" | "michael-playht" | "burt-11labs" | "andrea-11labs" | "phillip-11labs" | "steve-11labs" | "joseph-11labs" | "myra-11labs" | "paula-11labs" | "ryan-11labs" | "drew-11labs" | "paul-11labs" | "mrb-11labs" | "matilda-11labs" | "kai-rimeai" | "zion-rimeai" | "xavier-rimeai" | "marty-rimeai" | "hudson-rimeai" | "savannah-rimeai" | "colette-rimeai" | "daphne-rimeai" | "aurora-rimeai" | "nova-rimeai" | "apollo-beta" | "orion-beta" | "aurora-beta" | "asteria-beta" | "stella-beta" | "artemis-beta" | "andromeda-beta" | "atlas-beta" | ElevenLabsVoice | PlayHTVoice | RimeAIVoice | BetaVoice;
188
+ /**
189
+ * This sets the spoken language of the user. The assistant will do its best to respond in the same language.
190
+ * When using a language other than `en-*`, only `11labs` voices will pronounce the words correctly. There will also be ~1sec of additional latency.
191
+ */
192
+ language?: "en" | "en-US" | "en-AU" | "en-GB" | "en-NZ" | "en-IN" | "fr" | "fr-CA" | "de" | "hi" | "hi-Latn" | "pt" | "pt-BR" | "es" | "es-419";
240
193
  /** This is the number to forward to if assistant runs into issues. */
241
194
  forwardingPhoneNumber?: string;
242
195
  /**
@@ -244,6 +197,7 @@ export interface Assistant {
244
197
  *
245
198
  * If unspecified, it will wait for the user to speak.
246
199
  * @maxLength 1000
200
+ * @default "Hey there!"
247
201
  */
248
202
  firstMessage?: string;
249
203
  /**
@@ -284,44 +238,6 @@ export interface Assistant {
284
238
  updatedAt: string;
285
239
  }
286
240
  export interface UpdateAssistantDTO {
287
- /** These are the options for the assistant's LLM. */
288
- model?: ({
289
- provider: "openai";
290
- } & OpenAIModel) | ({
291
- provider: "custom";
292
- } & CustomModel);
293
- /** These are the options for the assistant's voice. */
294
- voice?: "jennifer-playht" | "melissa-playht" | "will-playht" | "chris-playht" | "matt-playht" | "jack-playht" | "ruby-playht" | "davis-playht" | "donna-playht" | "michael-playht" | "burt-11labs" | "andrea-11labs" | "phillip-11labs" | "steve-11labs" | "joseph-11labs" | "myra-11labs" | "paula-11labs" | "ryan-11labs" | "drew-11labs" | "paul-11labs" | "mrb-11labs" | "matilda-11labs" | "kai-rimeai" | "zion-rimeai" | "xavier-rimeai" | "marty-rimeai" | "hudson-rimeai" | "savannah-rimeai" | "colette-rimeai" | "daphne-rimeai" | "aurora-rimeai" | "nova-rimeai" | "apollo-beta" | "orion-beta" | "aurora-beta" | "asteria-beta" | "stella-beta" | "artemis-beta" | "andromeda-beta" | "atlas-beta" | ElevenLabsVoice | PlayHTVoice | RimeAIVoice | BetaVoice;
295
- /**
296
- * This sets the spoken language of the user. The assistant will do its best to respond in the same language.
297
- * When using a language other than `en-*`, only `11labs` voices will pronounce the words correctly. There will also be ~1sec of additional latency.
298
- */
299
- language?: "en" | "en-US" | "en-AU" | "en-GB" | "en-NZ" | "en-IN" | "fr" | "fr-CA" | "de" | "hi" | "hi-Latn" | "pt" | "pt-BR" | "es" | "es-419";
300
- /**
301
- * Use `model.systemPrompt` instead.
302
- * @deprecated
303
- */
304
- context?: string;
305
- /**
306
- * Use `model.functions` instead.
307
- * @deprecated
308
- */
309
- functions?: OpenAIFunction[];
310
- /**
311
- * Add a Server URL to your Org on the Account page in the dashboard instead.
312
- * @deprecated
313
- */
314
- callbackUrl?: string;
315
- /**
316
- * Use `model.url` instead.
317
- * @deprecated
318
- */
319
- customLlmUrl?: string;
320
- /**
321
- * Use `transcriber.keywords` instead.
322
- * @deprecated
323
- */
324
- keywords?: string[];
325
241
  /**
326
242
  * This is the name of the assistant. This is just for your own reference.
327
243
  * @maxLength 100
@@ -329,6 +245,18 @@ export interface UpdateAssistantDTO {
329
245
  name?: string;
330
246
  /** These are the options for the assistant's transcriber. */
331
247
  transcriber?: DeepgramTranscriber;
248
+ /** These are the options for the assistant's LLM. */
249
+ model?: "0" | "1" | "2" | OpenAIModel | CustomModel;
250
+ /**
251
+ * These are the options for the assistant's voice.
252
+ * @default "jennifer-playht"
253
+ */
254
+ voice?: "jennifer-playht" | "melissa-playht" | "will-playht" | "chris-playht" | "matt-playht" | "jack-playht" | "ruby-playht" | "davis-playht" | "donna-playht" | "michael-playht" | "burt-11labs" | "andrea-11labs" | "phillip-11labs" | "steve-11labs" | "joseph-11labs" | "myra-11labs" | "paula-11labs" | "ryan-11labs" | "drew-11labs" | "paul-11labs" | "mrb-11labs" | "matilda-11labs" | "kai-rimeai" | "zion-rimeai" | "xavier-rimeai" | "marty-rimeai" | "hudson-rimeai" | "savannah-rimeai" | "colette-rimeai" | "daphne-rimeai" | "aurora-rimeai" | "nova-rimeai" | "apollo-beta" | "orion-beta" | "aurora-beta" | "asteria-beta" | "stella-beta" | "artemis-beta" | "andromeda-beta" | "atlas-beta" | ElevenLabsVoice | PlayHTVoice | RimeAIVoice | BetaVoice;
255
+ /**
256
+ * This sets the spoken language of the user. The assistant will do its best to respond in the same language.
257
+ * When using a language other than `en-*`, only `11labs` voices will pronounce the words correctly. There will also be ~1sec of additional latency.
258
+ */
259
+ language?: "en" | "en-US" | "en-AU" | "en-GB" | "en-NZ" | "en-IN" | "fr" | "fr-CA" | "de" | "hi" | "hi-Latn" | "pt" | "pt-BR" | "es" | "es-419";
332
260
  /** This is the number to forward to if assistant runs into issues. */
333
261
  forwardingPhoneNumber?: string;
334
262
  /**
@@ -336,6 +264,7 @@ export interface UpdateAssistantDTO {
336
264
  *
337
265
  * If unspecified, it will wait for the user to speak.
338
266
  * @maxLength 1000
267
+ * @default "Hey there!"
339
268
  */
340
269
  firstMessage?: string;
341
270
  /**
@@ -392,15 +321,10 @@ export interface ImportTwilioPhoneNumberDTO {
392
321
  export interface Call {
393
322
  /** This is the type of call. */
394
323
  type?: "inboundPhoneCall" | "outboundPhoneCall" | "webCall";
395
- /**
396
- * Use `status` instead.
397
- * @deprecated
398
- */
399
- twilioCallStatus?: string;
400
324
  /** This is the status of the call. */
401
325
  status?: "queued" | "ringing" | "in-progress" | "forwarding" | "ended";
402
326
  /** This is the explanation for how the call ended. */
403
- endedReason?: "assistant-ended" | "assistant-error" | "assistant-join-timeout" | "busy" | "canceled" | "customer-ended" | "forwarded" | "max-duration-timeout" | "no-answer" | "no-server-available" | "server-shutdown" | "silence-timeout" | "twilio-call-error" | "twilio-websocket-close" | "twilio-websocket-error" | "unknown-error" | "voicemail";
327
+ endedReason?: "assistant-ended-call" | "assistant-error" | "assistant-forwarded-call" | "assistant-join-timed-out" | "assistant-not-found" | "manually-canceled" | "customer-busy" | "customer-ended-call" | "customer-did-not-answer" | "db-error" | "exceeded-max-duration" | "no-server-available" | "server-shutdown" | "silence-timed-out" | "twilio-failed-to-connect-call" | "twilio-closed-websocket" | "unknown-error" | "voicemail";
404
328
  /** This is the unique identifier for the call. */
405
329
  id: string;
406
330
  /** This is the unique identifier for the org that this call belongs to. */
@@ -475,11 +399,6 @@ export interface Call {
475
399
  phoneNumber?: ImportTwilioPhoneNumberDTO;
476
400
  }
477
401
  export interface CreateOutboundCallDTO {
478
- /**
479
- * Use `customer` instead.
480
- * @deprecated
481
- */
482
- customerPhoneNumber?: string;
483
402
  /** This is the assistant that will be used for the call. To use a transient assistant, use `assistant` instead. */
484
403
  assistantId?: string;
485
404
  /** This is the assistant that will be used for the call. To use an existing assistant, use `assistantId` instead. */
@@ -515,6 +434,98 @@ export interface CreateWebCallDTO {
515
434
  /** This is the assistant that will be used for the call. To use an existing assistant, use `assistantId` instead. */
516
435
  assistant?: CreateAssistantDTO;
517
436
  }
437
+ export interface CreateTwilioCredentialDTO {
438
+ provider: "twilio";
439
+ /** This is hidden in the API responses. */
440
+ authToken: string;
441
+ accountSid: string;
442
+ }
443
+ export interface CreateDeepgramCredentialDTO {
444
+ provider: "deepgram";
445
+ /** This is hidden in the API responses. */
446
+ apiKey: string;
447
+ }
448
+ export interface CreateAzureCredentialDTO {
449
+ provider: "azure-openai";
450
+ /** This is hidden in the API responses. */
451
+ openAIKey: string;
452
+ openAIEndpoint: string;
453
+ }
454
+ export interface CreateElevenLabsCredentialDTO {
455
+ provider: "11labs";
456
+ /** This is hidden in the API responses. */
457
+ apiKey: string;
458
+ }
459
+ export interface CreatePlayHTCredentialDTO {
460
+ provider: "playht";
461
+ /** This is hidden in the API responses. */
462
+ apiKey: string;
463
+ userId: string;
464
+ }
465
+ export interface CreateRimeAICredentialDTO {
466
+ provider: "rimeai";
467
+ /** This is hidden in the API responses. */
468
+ apiKey: string;
469
+ }
470
+ export interface UpdateTwilioCredentialDTO {
471
+ provider: "twilio";
472
+ /** This is hidden in the API responses. */
473
+ authToken: string;
474
+ accountSid: string;
475
+ }
476
+ export interface UpdateDeepgramCredentialDTO {
477
+ provider: "deepgram";
478
+ /** This is hidden in the API responses. */
479
+ apiKey: string;
480
+ }
481
+ export interface UpdateAzureCredentialDTO {
482
+ provider: "azure-openai";
483
+ /** This is hidden in the API responses. */
484
+ openAIKey: string;
485
+ openAIEndpoint: string;
486
+ }
487
+ export interface UpdateElevenLabsCredentialDTO {
488
+ provider: "11labs";
489
+ /** This is hidden in the API responses. */
490
+ apiKey: string;
491
+ }
492
+ export interface UpdatePlayHTCredentialDTO {
493
+ provider: "playht";
494
+ /** This is hidden in the API responses. */
495
+ apiKey: string;
496
+ userId: string;
497
+ }
498
+ export interface UpdateRimeAICredentialDTO {
499
+ provider: "rimeai";
500
+ /** This is hidden in the API responses. */
501
+ apiKey: string;
502
+ }
503
+ export interface Credential {
504
+ /** This is hidden in the API responses. */
505
+ authToken?: string;
506
+ /** This is hidden in the API responses. */
507
+ apiKey?: string;
508
+ /** This is hidden in the API responses. */
509
+ openAIKey?: string;
510
+ provider: "twilio" | "deepgram" | "azure-openai" | "11labs" | "playht" | "rimeai";
511
+ /** This is the unique identifier for the credential. */
512
+ id: string;
513
+ /** This is the unique identifier for the org that this credential belongs to. */
514
+ orgId: string;
515
+ /**
516
+ * This is the ISO 8601 date-time string of when the credential was created.
517
+ * @format date-time
518
+ */
519
+ createdAt: string;
520
+ /**
521
+ * This is the ISO 8601 date-time string of when the assistant was last updated.
522
+ * @format date-time
523
+ */
524
+ updatedAt: string;
525
+ accountSid?: string;
526
+ openAIEndpoint?: string;
527
+ userId?: string;
528
+ }
518
529
  export interface BuyPhoneNumberDTO {
519
530
  /**
520
531
  * This is the area code of the phone number to purchase.
@@ -758,6 +769,82 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
758
769
  */
759
770
  callControllerCreateWebCall: (data: CreateWebCallDTO, params?: RequestParams) => Promise<HttpResponse<Call, any>>;
760
771
  };
772
+ credential: {
773
+ /**
774
+ * No description
775
+ *
776
+ * @tags Credentials
777
+ * @name CredentialControllerCreate
778
+ * @summary Create Credential
779
+ * @request POST:/credential
780
+ * @secure
781
+ */
782
+ credentialControllerCreate: (data: ({
783
+ provider: "twilio";
784
+ } & CreateTwilioCredentialDTO) | ({
785
+ provider: "deepgram";
786
+ } & CreateDeepgramCredentialDTO) | ({
787
+ provider: "azure-openai";
788
+ } & CreateAzureCredentialDTO) | ({
789
+ provider: "11labs";
790
+ } & CreateElevenLabsCredentialDTO) | ({
791
+ provider: "playht";
792
+ } & CreatePlayHTCredentialDTO) | ({
793
+ provider: "rimeai";
794
+ } & CreateRimeAICredentialDTO), params?: RequestParams) => Promise<HttpResponse<Credential, any>>;
795
+ /**
796
+ * No description
797
+ *
798
+ * @tags Credentials
799
+ * @name CredentialControllerFindAll
800
+ * @summary List Credentials
801
+ * @request GET:/credential
802
+ * @secure
803
+ */
804
+ credentialControllerFindAll: (params?: RequestParams) => Promise<HttpResponse<Credential[], any>>;
805
+ /**
806
+ * No description
807
+ *
808
+ * @tags Credentials
809
+ * @name CredentialControllerFindOne
810
+ * @summary Get Credential
811
+ * @request GET:/credential/{id}
812
+ * @secure
813
+ */
814
+ credentialControllerFindOne: (id: string, params?: RequestParams) => Promise<HttpResponse<Credential, any>>;
815
+ /**
816
+ * No description
817
+ *
818
+ * @tags Credentials
819
+ * @name CredentialControllerUpdate
820
+ * @summary Update Credential
821
+ * @request PUT:/credential/{id}
822
+ * @secure
823
+ */
824
+ credentialControllerUpdate: (id: string, data: ({
825
+ provider: "twilio";
826
+ } & UpdateTwilioCredentialDTO) | ({
827
+ provider: "deepgram";
828
+ } & UpdateDeepgramCredentialDTO) | ({
829
+ provider: "azure-openai";
830
+ } & UpdateAzureCredentialDTO) | ({
831
+ provider: "11labs";
832
+ } & UpdateElevenLabsCredentialDTO) | ({
833
+ provider: "playht";
834
+ } & UpdatePlayHTCredentialDTO) | ({
835
+ provider: "rimeai";
836
+ } & UpdateRimeAICredentialDTO), params?: RequestParams) => Promise<HttpResponse<Credential, any>>;
837
+ /**
838
+ * No description
839
+ *
840
+ * @tags Credentials
841
+ * @name CredentialControllerRemove
842
+ * @summary Delete Credential
843
+ * @request DELETE:/credential/{id}
844
+ * @secure
845
+ */
846
+ credentialControllerRemove: (id: string, params?: RequestParams) => Promise<HttpResponse<Credential, any>>;
847
+ };
761
848
  phoneNumber: {
762
849
  /**
763
850
  * No description
@@ -818,7 +905,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
818
905
  * @request DELETE:/phone-number/{id}
819
906
  * @secure
820
907
  */
821
- phoneNumberControllerRemove: (id: string, params?: RequestParams) => Promise<HttpResponse<void, any>>;
908
+ phoneNumberControllerRemove: (id: string, params?: RequestParams) => Promise<HttpResponse<PhoneNumber, any>>;
822
909
  };
823
910
  }
824
911
  export {};
package/dist/api.js CHANGED
@@ -258,6 +258,58 @@ class Api extends HttpClient {
258
258
  */
259
259
  callControllerCreateWebCall: (data, params = {}) => this.request(Object.assign({ path: `/call/web`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json" }, params)),
260
260
  };
261
+ this.credential = {
262
+ /**
263
+ * No description
264
+ *
265
+ * @tags Credentials
266
+ * @name CredentialControllerCreate
267
+ * @summary Create Credential
268
+ * @request POST:/credential
269
+ * @secure
270
+ */
271
+ credentialControllerCreate: (data, params = {}) => this.request(Object.assign({ path: `/credential`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json" }, params)),
272
+ /**
273
+ * No description
274
+ *
275
+ * @tags Credentials
276
+ * @name CredentialControllerFindAll
277
+ * @summary List Credentials
278
+ * @request GET:/credential
279
+ * @secure
280
+ */
281
+ credentialControllerFindAll: (params = {}) => this.request(Object.assign({ path: `/credential`, method: "GET", secure: true, format: "json" }, params)),
282
+ /**
283
+ * No description
284
+ *
285
+ * @tags Credentials
286
+ * @name CredentialControllerFindOne
287
+ * @summary Get Credential
288
+ * @request GET:/credential/{id}
289
+ * @secure
290
+ */
291
+ credentialControllerFindOne: (id, params = {}) => this.request(Object.assign({ path: `/credential/${id}`, method: "GET", secure: true, format: "json" }, params)),
292
+ /**
293
+ * No description
294
+ *
295
+ * @tags Credentials
296
+ * @name CredentialControllerUpdate
297
+ * @summary Update Credential
298
+ * @request PUT:/credential/{id}
299
+ * @secure
300
+ */
301
+ credentialControllerUpdate: (id, data, params = {}) => this.request(Object.assign({ path: `/credential/${id}`, method: "PUT", body: data, secure: true, type: ContentType.Json, format: "json" }, params)),
302
+ /**
303
+ * No description
304
+ *
305
+ * @tags Credentials
306
+ * @name CredentialControllerRemove
307
+ * @summary Delete Credential
308
+ * @request DELETE:/credential/{id}
309
+ * @secure
310
+ */
311
+ credentialControllerRemove: (id, params = {}) => this.request(Object.assign({ path: `/credential/${id}`, method: "DELETE", secure: true, format: "json" }, params)),
312
+ };
261
313
  this.phoneNumber = {
262
314
  /**
263
315
  * No description
@@ -318,7 +370,7 @@ class Api extends HttpClient {
318
370
  * @request DELETE:/phone-number/{id}
319
371
  * @secure
320
372
  */
321
- phoneNumberControllerRemove: (id, params = {}) => this.request(Object.assign({ path: `/phone-number/${id}`, method: "DELETE", secure: true }, params)),
373
+ phoneNumberControllerRemove: (id, params = {}) => this.request(Object.assign({ path: `/phone-number/${id}`, method: "DELETE", secure: true, format: "json" }, params)),
322
374
  };
323
375
  }
324
376
  }
package/dist/vapi.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  /// <reference types="node" />
2
2
  import { Call, CreateAssistantDTO } from "./api";
3
3
  import EventEmitter from "events";
4
- type VapiEventNames = "call-end" | "call-start" | "volume-level" | "speech-start" | "speech-end" | "error";
4
+ type VapiEventNames = "call-end" | "call-start" | "volume-level" | "speech-start" | "speech-end" | "message" | "error";
5
5
  type VapiEventListeners = {
6
6
  "call-end": () => void;
7
7
  "call-start": () => void;
8
8
  "volume-level": (volume: number) => void;
9
9
  "speech-start": () => void;
10
10
  "speech-end": () => void;
11
+ message: (message: any) => void;
11
12
  error: (error: any) => void;
12
13
  };
13
14
  declare class VapiEventEmitter extends EventEmitter {
@@ -24,6 +25,7 @@ export default class Vapi extends VapiEventEmitter {
24
25
  constructor(apiToken: string, apiBaseUrl?: string);
25
26
  private cleanup;
26
27
  start(assistant: CreateAssistantDTO | string): Promise<Call | null>;
28
+ private onAppMessage;
27
29
  private handleRemoteParticipantsAudioLevel;
28
30
  stop(): void;
29
31
  }
package/dist/vapi.js CHANGED
@@ -139,6 +139,7 @@ class Vapi extends VapiEventEmitter {
139
139
  });
140
140
  this.call.startRemoteParticipantsAudioLevelObserver(100);
141
141
  this.call.on("remote-participants-audio-level", (e) => this.handleRemoteParticipantsAudioLevel(e));
142
+ this.call.on("app-message", (e) => this.onAppMessage(e));
142
143
  this.call.updateInputSettings({
143
144
  audio: {
144
145
  processor: {
@@ -156,6 +157,17 @@ class Vapi extends VapiEventEmitter {
156
157
  }
157
158
  });
158
159
  }
160
+ onAppMessage(e) {
161
+ if (!e)
162
+ return;
163
+ try {
164
+ const parsedMessage = JSON.parse(e.data);
165
+ this.emit("message", parsedMessage);
166
+ }
167
+ catch (e) {
168
+ console.error(e);
169
+ }
170
+ }
159
171
  handleRemoteParticipantsAudioLevel(e) {
160
172
  const speechLevel = Object.values(e.participantsAudioLevel).reduce((a, b) => a + b, 0);
161
173
  this.emit("volume-level", Math.min(1, speechLevel / 0.15));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vapi-ai/web",
3
- "version": "1.0.232",
3
+ "version": "1.0.234",
4
4
  "description": "",
5
5
  "main": "dist/vapi.js",
6
6
  "types": "dist/vapi.d.ts",
package/vapi.ts CHANGED
@@ -2,6 +2,7 @@ import { Call, CreateAssistantDTO } from "./api";
2
2
  import DailyIframe, {
3
3
  DailyCall,
4
4
  DailyEventObjectActiveSpeakerChange,
5
+ DailyEventObjectAppMessage,
5
6
  DailyEventObjectParticipant,
6
7
  DailyEventObjectRemoteParticipantsAudioLevel,
7
8
  } from "@daily-co/daily-js";
@@ -47,13 +48,16 @@ type VapiEventNames =
47
48
  | "volume-level"
48
49
  | "speech-start"
49
50
  | "speech-end"
51
+ | "message"
50
52
  | "error";
53
+
51
54
  type VapiEventListeners = {
52
55
  "call-end": () => void;
53
56
  "call-start": () => void;
54
57
  "volume-level": (volume: number) => void;
55
58
  "speech-start": () => void;
56
59
  "speech-end": () => void;
60
+ message: (message: any) => void;
57
61
  error: (error: any) => void;
58
62
  };
59
63
 
@@ -170,6 +174,7 @@ export default class Vapi extends VapiEventEmitter {
170
174
  this.call.on("remote-participants-audio-level", (e) =>
171
175
  this.handleRemoteParticipantsAudioLevel(e)
172
176
  );
177
+ this.call.on("app-message", (e) => this.onAppMessage(e));
173
178
 
174
179
  this.call.updateInputSettings({
175
180
  audio: {
@@ -188,6 +193,16 @@ export default class Vapi extends VapiEventEmitter {
188
193
  }
189
194
  }
190
195
 
196
+ private onAppMessage(e?: DailyEventObjectAppMessage) {
197
+ if (!e) return;
198
+ try {
199
+ const parsedMessage = JSON.parse(e.data);
200
+ this.emit("message", parsedMessage);
201
+ } catch (e) {
202
+ console.error(e);
203
+ }
204
+ }
205
+
191
206
  private handleRemoteParticipantsAudioLevel(
192
207
  e: DailyEventObjectRemoteParticipantsAudioLevel
193
208
  ) {