@vapi-ai/web 1.0.231 → 1.0.232

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 (4) hide show
  1. package/api.ts +506 -356
  2. package/dist/api.d.ts +330 -235
  3. package/dist/api.js +42 -42
  4. package/package.json +1 -1
package/api.ts CHANGED
@@ -9,6 +9,67 @@
9
9
  * ---------------------------------------------------------------
10
10
  */
11
11
 
12
+ export interface BetaVoice {
13
+ /**
14
+ * This is the voice provider that will be used.
15
+ *
16
+ * Pro Voices: `11labs`, `playht`
17
+ *
18
+ * Basic Voices: `rimeai`, `beta`
19
+ */
20
+ provider: "beta";
21
+ /** This is the provider-specific ID that will be used. */
22
+ voiceId: string;
23
+ }
24
+
25
+ export interface CustomModel {
26
+ /**
27
+ * This is the provider that will be used for the model. Currently, only OpenAI and Custom LLM URLs are supported.
28
+ *
29
+ * If you have your own LLM, you can use the URL of your LLM endpoint here.
30
+ */
31
+ provider: "custom";
32
+ /** These are the options that will be passed to the provider. */
33
+ url: string;
34
+ /** This sets the objective and understanding for the assistant. */
35
+ systemPrompt?: string;
36
+ }
37
+
38
+ export interface DeepgramTranscriber {
39
+ /** This is the transcription provider that will be used. Currently, only Deepgram is supported. */
40
+ provider: "deepgram";
41
+ /** This is the Deepgram model that will be used. A list of models can be found here: https://developers.deepgram.com/docs/models-languages-overview */
42
+ model?:
43
+ | "nova-2"
44
+ | "nova-2-general"
45
+ | "nova-2-meeting"
46
+ | "nova-2-phonecall"
47
+ | "nova-2-finance"
48
+ | "nova-2-conversationalai"
49
+ | "nova-2-voicemail"
50
+ | "nova-2-video"
51
+ | "nova-2-medical"
52
+ | "nova-2-drivethru"
53
+ | "nova-2-automotive"
54
+ | "nova-2-custom"
55
+ | string;
56
+ /** These keywords are passed to the transcription model to help it pick up use-case specific words. Anything that may not be a common word, like your company name, should be added here. */
57
+ keywords?: string[];
58
+ }
59
+
60
+ export interface ElevenLabsVoice {
61
+ /**
62
+ * This is the voice provider that will be used.
63
+ *
64
+ * Pro Voices: `11labs`, `playht`
65
+ *
66
+ * Basic Voices: `rimeai`, `beta`
67
+ */
68
+ provider: "11labs";
69
+ /** This is the provider-specific ID that will be used. */
70
+ voiceId: string;
71
+ }
72
+
12
73
  export interface OpenAIFunctionParameterProperty {
13
74
  type: "string" | "number" | "boolean";
14
75
  enum?: string[];
@@ -43,16 +104,59 @@ export interface OpenAIFunction {
43
104
  parameters: OpenAIFunctionParameters;
44
105
  }
45
106
 
46
- export interface CreateAssistantDTO {
107
+ export interface OpenAIModel {
108
+ /**
109
+ * This is the provider that will be used for the model. Currently, only OpenAI and Custom LLM URLs are supported.
110
+ *
111
+ * If you have your own LLM, you can use the URL of your LLM endpoint here.
112
+ */
113
+ provider: "openai";
47
114
  /** This is the OpenAI model that will be used. */
48
- model?: "gpt-4" | "gpt-3.5-turbo";
115
+ model: "gpt-4" | "gpt-3.5-turbo";
116
+ /** This sets the objective and understanding for the assistant. */
117
+ systemPrompt?: string;
118
+ /** This is the temperature that will be used for OpenAI calls. */
119
+ temperature?: number;
120
+ /** These are the functions that the assistant can execute during the call. */
121
+ functions?: OpenAIFunction[];
122
+ }
123
+
124
+ export interface PlayHTVoice {
49
125
  /**
50
- * This is the voice that will be used.
126
+ * This is the voice provider that will be used.
51
127
  *
52
- * Pro Voices: `*-11labs`, `*-playht`
128
+ * Pro Voices: `11labs`, `playht`
53
129
  *
54
- * Basic Voices: `*-rimeai`
130
+ * Basic Voices: `rimeai`, `beta`
55
131
  */
132
+ provider: "playht";
133
+ /** This is the provider-specific ID that will be used. */
134
+ voiceId: string;
135
+ }
136
+
137
+ export interface RimeAIVoice {
138
+ /**
139
+ * This is the voice provider that will be used.
140
+ *
141
+ * Pro Voices: `11labs`, `playht`
142
+ *
143
+ * Basic Voices: `rimeai`, `beta`
144
+ */
145
+ provider: "rimeai";
146
+ /** This is the provider-specific ID that will be used. */
147
+ voiceId: string;
148
+ }
149
+
150
+ export interface CreateAssistantDTO {
151
+ /** 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. */
56
160
  voice?:
57
161
  | "jennifer-playht"
58
162
  | "melissa-playht"
@@ -93,10 +197,14 @@ export interface CreateAssistantDTO {
93
197
  | "stella-beta"
94
198
  | "artemis-beta"
95
199
  | "andromeda-beta"
96
- | "atlas-beta";
200
+ | "atlas-beta"
201
+ | ElevenLabsVoice
202
+ | PlayHTVoice
203
+ | RimeAIVoice
204
+ | BetaVoice;
97
205
  /**
98
206
  * This sets the spoken language of the user. The assistant will do its best to respond in the same language.
99
- * When using a language other than `en-*`, only `*-11labs` voices will pronounce the words correctly. There will also be ~1sec of additional latency.
207
+ * When using a language other than `en-*`, only `11labs` voices will pronounce the words correctly. There will also be ~1sec of additional latency.
100
208
  */
101
209
  language?:
102
210
  | "en"
@@ -115,44 +223,51 @@ export interface CreateAssistantDTO {
115
223
  | "es"
116
224
  | "es-419";
117
225
  /**
118
- * This is the name of the assistant. This is just for your own reference.
119
- * @maxLength 100
226
+ * Use `model.systemPrompt` instead.
227
+ * @deprecated
120
228
  */
121
- name?: string;
122
- /** This sets the objective and understanding for the assistant. */
123
229
  context?: string;
124
- /** These are the functions that the assistant can execute during the call. */
230
+ /**
231
+ * Use `model.functions` instead.
232
+ * @deprecated
233
+ */
125
234
  functions?: OpenAIFunction[];
126
235
  /**
127
- * This is the URL Vapi will send GET / POST requests for retrieving context, function calling, and end-of-call reports.
128
- *
129
- * All requests will be sent with the `call` object among other things relevant to that callback. You can find more details in the Function Calling documentation.
236
+ * Add a Server URL to your Org on the Account page in the dashboard instead.
237
+ * @deprecated
130
238
  */
131
239
  callbackUrl?: string;
132
240
  /**
133
- * If you are using a custom LLM, this is the URL Vapi will use instead of hitting OpenAI.
134
- *
135
- * A POST request will be sent with an array of messages, and the response should be like so:
136
- *
137
- * ```
138
- * { message: "Oh hey! How are..." }
139
- * ```
241
+ * Use `model.url` instead.
242
+ * @deprecated
140
243
  */
141
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;
142
257
  /** This is the number to forward to if assistant runs into issues. */
143
258
  forwardingPhoneNumber?: string;
144
259
  /**
145
260
  * This is the first message that the assistant will say.
146
261
  *
147
262
  * If unspecified, it will wait for the user to speak.
148
- * @maxLength 400
263
+ * @maxLength 1000
149
264
  */
150
265
  firstMessage?: string;
151
266
  /**
152
267
  * This is the message that the assistant will say if the call is forwarded to voicemail.
153
268
  *
154
269
  * If unspecified, it will hang up.
155
- * @maxLength 400
270
+ * @maxLength 1000
156
271
  */
157
272
  voicemailMessage?: string;
158
273
  /**
@@ -170,177 +285,18 @@ export interface CreateAssistantDTO {
170
285
  endCallFunctionEnabled?: boolean;
171
286
  /** This sets whether the assistant will use fillers like Well..., Okay cool..., etc. Defaults to true when using gpt-4. Else, defaults to false. */
172
287
  fillersEnabled?: boolean;
173
- /** These keywords are passed to the transcription model to help it pick up use-case specific words. Anything that may not be a common word, like your company name, should be added here. */
174
- keywords?: string[];
175
- }
176
-
177
- export interface CreateCustomerDTO {
178
- /** This is the number of the customer. */
179
- number?: string;
180
- /**
181
- * This is the name of the customer. This is just for your own reference.
182
- * @maxLength 40
183
- */
184
- name?: string;
185
- }
186
-
187
- export interface ImportTwilioPhoneNumberDTO {
188
- /** These are the digits of the phone number you own on your Twilio. */
189
- twilioPhoneNumber: string;
190
- /** This is your Twilio Account SID that will be used to handle this phone number. */
191
- twilioAccountSid: string;
192
- /** This is the Twilio Auth Token that will be used to handle this phone number. */
193
- twilioAuthToken: string;
194
- /**
195
- * This is the name of the phone number. This is just for your own reference.
196
- * @maxLength 40
197
- */
198
- name?: string;
199
- /**
200
- * This is the assistant that will be used for incoming calls to this phone number.
201
- *
202
- * If this is not set, then the phone number will not handle incoming calls.
203
- */
204
- assistantId?: string;
205
- }
206
-
207
- export interface Call {
208
- type?: "inboundPhoneCall" | "outboundPhoneCall" | "webCall";
209
- /** This is the unique identifier for the call. */
210
- id: string;
211
- /** This is the unique identifier for the org that this call belongs to. */
212
- orgId: string;
213
- /**
214
- * This is the ISO 8601 date-time string of when the call was created.
215
- * @format date-time
216
- */
217
- createdAt: string;
218
- /**
219
- * This is the ISO 8601 date-time string of when the call was last updated.
220
- * @format date-time
221
- */
222
- updatedAt: string;
223
- /**
224
- * This is the ISO 8601 date-time string of when the call was started.
225
- * @format date-time
226
- */
227
- startedAt?: string;
228
- /**
229
- * This is the ISO 8601 date-time string of when the call was ended.
230
- * @format date-time
231
- */
232
- endedAt?: string;
233
- /** This is the cost of the call in USD. */
234
- cost?: number;
235
- /** This is the transcript of the call. */
236
- transcript?: string;
237
- /** This is the URL of the recording of the call. */
238
- recordingUrl?: string;
239
- /** This is the summary of the call. */
240
- summary?: string;
241
- /**
242
- * This is the callSid of the phone call.
243
- *
244
- * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
245
- */
246
- twilioCallSid?: string;
247
- /**
248
- * This is the current status of the call.
249
- *
250
- * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
251
- */
252
- twilioCallStatus?: string;
253
- /**
254
- * This is the URL of the call that the assistant will join.
255
- *
256
- * Only relevant for `webCall` type.
257
- */
258
- webCallUrl?: string;
259
- /** This is set if the call experienced an error. */
260
- error?: string;
261
- /** This is the assistant that will be used for the call. To use a transient assistant, use `assistant` instead. */
262
- assistantId?: string;
263
- /** This is the assistant that will be used for the call. To use an existing assistant, use `assistantId` instead. */
264
- assistant?: CreateAssistantDTO;
265
- /**
266
- * This is the customer that will be called. To call a transient customer , use `customer` instead.
267
- *
268
- * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
269
- */
270
- customerId?: string;
271
- /**
272
- * This is the customer that will be called. To call an existing customer, use `customerId` instead.
273
- *
274
- * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
275
- */
276
- customer?: CreateCustomerDTO;
277
- /**
278
- * This is the phone number that will be used for the call. To use a transient number, use `phoneNumber` instead.
279
- *
280
- * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
281
- */
282
- phoneNumberId?: string;
283
- /**
284
- * This is the phone number that will be used for the call. To use an existing number, use `phoneNumberId` instead.
285
- *
286
- * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
287
- */
288
- phoneNumber?: ImportTwilioPhoneNumberDTO;
289
- }
290
-
291
- export interface CreateOutboundCallDTO {
292
- /**
293
- * Use `customer` instead.
294
- * @deprecated
295
- */
296
- customerPhoneNumber?: string;
297
- /** This is the assistant that will be used for the call. To use a transient assistant, use `assistant` instead. */
298
- assistantId?: string;
299
- /** This is the assistant that will be used for the call. To use an existing assistant, use `assistantId` instead. */
300
- assistant?: CreateAssistantDTO;
301
- /**
302
- * This is the customer that will be called. To call a transient customer , use `customer` instead.
303
- *
304
- * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
305
- */
306
- customerId?: string;
307
- /**
308
- * This is the customer that will be called. To call an existing customer, use `customerId` instead.
309
- *
310
- * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
311
- */
312
- customer?: CreateCustomerDTO;
313
- /**
314
- * This is the phone number that will be used for the call. To use a transient number, use `phoneNumber` instead.
315
- *
316
- * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
317
- */
318
- phoneNumberId?: string;
319
- /**
320
- * This is the phone number that will be used for the call. To use an existing number, use `phoneNumberId` instead.
321
- *
322
- * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
323
- */
324
- phoneNumber?: ImportTwilioPhoneNumberDTO;
325
- }
326
-
327
- export interface CreateWebCallDTO {
328
- /** This is the assistant that will be used for the call. To use a transient assistant, use `assistant` instead. */
329
- assistantId?: string;
330
- /** This is the assistant that will be used for the call. To use an existing assistant, use `assistantId` instead. */
331
- assistant?: CreateAssistantDTO;
332
288
  }
333
289
 
334
290
  export interface Assistant {
335
- /** This is the OpenAI model that will be used. */
336
- model?: "gpt-4" | "gpt-3.5-turbo";
337
- /**
338
- * This is the voice that will be used.
339
- *
340
- * Pro Voices: `*-11labs`, `*-playht`
341
- *
342
- * Basic Voices: `*-rimeai`
343
- */
291
+ /** 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. */
344
300
  voice?:
345
301
  | "jennifer-playht"
346
302
  | "melissa-playht"
@@ -381,10 +337,14 @@ export interface Assistant {
381
337
  | "stella-beta"
382
338
  | "artemis-beta"
383
339
  | "andromeda-beta"
384
- | "atlas-beta";
340
+ | "atlas-beta"
341
+ | ElevenLabsVoice
342
+ | PlayHTVoice
343
+ | RimeAIVoice
344
+ | BetaVoice;
385
345
  /**
386
346
  * This sets the spoken language of the user. The assistant will do its best to respond in the same language.
387
- * When using a language other than `en-*`, only `*-11labs` voices will pronounce the words correctly. There will also be ~1sec of additional latency.
347
+ * When using a language other than `en-*`, only `11labs` voices will pronounce the words correctly. There will also be ~1sec of additional latency.
388
348
  */
389
349
  language?:
390
350
  | "en"
@@ -403,44 +363,51 @@ export interface Assistant {
403
363
  | "es"
404
364
  | "es-419";
405
365
  /**
406
- * This is the name of the assistant. This is just for your own reference.
407
- * @maxLength 100
366
+ * Use `model.systemPrompt` instead.
367
+ * @deprecated
408
368
  */
409
- name?: string;
410
- /** This sets the objective and understanding for the assistant. */
411
369
  context?: string;
412
- /** These are the functions that the assistant can execute during the call. */
370
+ /**
371
+ * Use `model.functions` instead.
372
+ * @deprecated
373
+ */
413
374
  functions?: OpenAIFunction[];
414
375
  /**
415
- * This is the URL Vapi will send GET / POST requests for retrieving context, function calling, and end-of-call reports.
416
- *
417
- * All requests will be sent with the `call` object among other things relevant to that callback. You can find more details in the Function Calling documentation.
376
+ * Add a Server URL to your Org on the Account page in the dashboard instead.
377
+ * @deprecated
418
378
  */
419
379
  callbackUrl?: string;
420
380
  /**
421
- * If you are using a custom LLM, this is the URL Vapi will use instead of hitting OpenAI.
422
- *
423
- * A POST request will be sent with an array of messages, and the response should be like so:
424
- *
425
- * ```
426
- * { message: "Oh hey! How are..." }
427
- * ```
381
+ * Use `model.url` instead.
382
+ * @deprecated
428
383
  */
429
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;
430
397
  /** This is the number to forward to if assistant runs into issues. */
431
398
  forwardingPhoneNumber?: string;
432
399
  /**
433
400
  * This is the first message that the assistant will say.
434
401
  *
435
402
  * If unspecified, it will wait for the user to speak.
436
- * @maxLength 400
403
+ * @maxLength 1000
437
404
  */
438
405
  firstMessage?: string;
439
406
  /**
440
407
  * This is the message that the assistant will say if the call is forwarded to voicemail.
441
408
  *
442
409
  * If unspecified, it will hang up.
443
- * @maxLength 400
410
+ * @maxLength 1000
444
411
  */
445
412
  voicemailMessage?: string;
446
413
  /**
@@ -458,8 +425,6 @@ export interface Assistant {
458
425
  endCallFunctionEnabled?: boolean;
459
426
  /** This sets whether the assistant will use fillers like Well..., Okay cool..., etc. Defaults to true when using gpt-4. Else, defaults to false. */
460
427
  fillersEnabled?: boolean;
461
- /** These keywords are passed to the transcription model to help it pick up use-case specific words. Anything that may not be a common word, like your company name, should be added here. */
462
- keywords?: string[];
463
428
  /** This is the unique identifier for the assistant. */
464
429
  id: string;
465
430
  /** This is the unique identifier for the org that this assistant belongs to. */
@@ -477,15 +442,15 @@ export interface Assistant {
477
442
  }
478
443
 
479
444
  export interface UpdateAssistantDTO {
480
- /** This is the OpenAI model that will be used. */
481
- model?: "gpt-4" | "gpt-3.5-turbo";
482
- /**
483
- * This is the voice that will be used.
484
- *
485
- * Pro Voices: `*-11labs`, `*-playht`
486
- *
487
- * Basic Voices: `*-rimeai`
488
- */
445
+ /** 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. */
489
454
  voice?:
490
455
  | "jennifer-playht"
491
456
  | "melissa-playht"
@@ -526,85 +491,270 @@ export interface UpdateAssistantDTO {
526
491
  | "stella-beta"
527
492
  | "artemis-beta"
528
493
  | "andromeda-beta"
529
- | "atlas-beta";
494
+ | "atlas-beta"
495
+ | ElevenLabsVoice
496
+ | PlayHTVoice
497
+ | RimeAIVoice
498
+ | BetaVoice;
499
+ /**
500
+ * This sets the spoken language of the user. The assistant will do its best to respond in the same language.
501
+ * When using a language other than `en-*`, only `11labs` voices will pronounce the words correctly. There will also be ~1sec of additional latency.
502
+ */
503
+ language?:
504
+ | "en"
505
+ | "en-US"
506
+ | "en-AU"
507
+ | "en-GB"
508
+ | "en-NZ"
509
+ | "en-IN"
510
+ | "fr"
511
+ | "fr-CA"
512
+ | "de"
513
+ | "hi"
514
+ | "hi-Latn"
515
+ | "pt"
516
+ | "pt-BR"
517
+ | "es"
518
+ | "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
+ /** This is the number to forward to if assistant runs into issues. */
552
+ forwardingPhoneNumber?: string;
553
+ /**
554
+ * This is the first message that the assistant will say.
555
+ *
556
+ * If unspecified, it will wait for the user to speak.
557
+ * @maxLength 1000
558
+ */
559
+ firstMessage?: string;
560
+ /**
561
+ * This is the message that the assistant will say if the call is forwarded to voicemail.
562
+ *
563
+ * If unspecified, it will hang up.
564
+ * @maxLength 1000
565
+ */
566
+ voicemailMessage?: string;
567
+ /**
568
+ * This is the message that the assistant will say if it ends the call.
569
+ *
570
+ * If unspecified, it will hang up without saying anything.
571
+ * @maxLength 400
572
+ */
573
+ endCallMessage?: string;
574
+ /** This sets whether the user can interrupt the assistant while it's speaking. Defaults to true. */
575
+ interruptionsEnabled?: boolean;
576
+ /** This sets whether the assistant's calls are recorded. Defaults to true. */
577
+ recordingEnabled?: boolean;
578
+ /** This sets whether the assistant will be able to hang up the call. Defaults to false. */
579
+ endCallFunctionEnabled?: boolean;
580
+ /** This sets whether the assistant will use fillers like Well..., Okay cool..., etc. Defaults to true when using gpt-4. Else, defaults to false. */
581
+ fillersEnabled?: boolean;
582
+ }
583
+
584
+ export interface CreateCustomerDTO {
585
+ /** This is the number of the customer. */
586
+ number?: string;
587
+ /**
588
+ * This is the name of the customer. This is just for your own reference.
589
+ * @maxLength 40
590
+ */
591
+ name?: string;
592
+ }
593
+
594
+ export interface ImportTwilioPhoneNumberDTO {
595
+ /** These are the digits of the phone number you own on your Twilio. */
596
+ twilioPhoneNumber: string;
597
+ /** This is your Twilio Account SID that will be used to handle this phone number. */
598
+ twilioAccountSid: string;
599
+ /** This is the Twilio Auth Token that will be used to handle this phone number. */
600
+ twilioAuthToken: string;
601
+ /**
602
+ * This is the name of the phone number. This is just for your own reference.
603
+ * @maxLength 40
604
+ */
605
+ name?: string;
606
+ /**
607
+ * This is the assistant that will be used for incoming calls to this phone number.
608
+ *
609
+ * If this is not set, then the phone number will not handle incoming calls.
610
+ */
611
+ assistantId?: string;
612
+ }
613
+
614
+ export interface Call {
615
+ /** This is the type of call. */
616
+ type?: "inboundPhoneCall" | "outboundPhoneCall" | "webCall";
617
+ /**
618
+ * Use `status` instead.
619
+ * @deprecated
620
+ */
621
+ twilioCallStatus?: string;
622
+ /** This is the status of the call. */
623
+ status?: "queued" | "ringing" | "in-progress" | "forwarding" | "ended";
624
+ /** This is the explanation for how the call ended. */
625
+ endedReason?:
626
+ | "assistant-ended"
627
+ | "assistant-error"
628
+ | "assistant-join-timeout"
629
+ | "busy"
630
+ | "canceled"
631
+ | "customer-ended"
632
+ | "forwarded"
633
+ | "max-duration-timeout"
634
+ | "no-answer"
635
+ | "no-server-available"
636
+ | "server-shutdown"
637
+ | "silence-timeout"
638
+ | "twilio-call-error"
639
+ | "twilio-websocket-close"
640
+ | "twilio-websocket-error"
641
+ | "unknown-error"
642
+ | "voicemail";
643
+ /** This is the unique identifier for the call. */
644
+ id: string;
645
+ /** This is the unique identifier for the org that this call belongs to. */
646
+ orgId: string;
647
+ /**
648
+ * This is the ISO 8601 date-time string of when the call was created.
649
+ * @format date-time
650
+ */
651
+ createdAt: string;
652
+ /**
653
+ * This is the ISO 8601 date-time string of when the call was last updated.
654
+ * @format date-time
655
+ */
656
+ updatedAt: string;
657
+ /**
658
+ * This is the ISO 8601 date-time string of when the call was started.
659
+ * @format date-time
660
+ */
661
+ startedAt?: string;
662
+ /**
663
+ * This is the ISO 8601 date-time string of when the call was ended.
664
+ * @format date-time
665
+ */
666
+ endedAt?: string;
667
+ /** This is the cost of the call in USD. */
668
+ cost?: number;
669
+ /** This is the transcript of the call. */
670
+ transcript?: string;
671
+ /** This is the URL of the recording of the call. */
672
+ recordingUrl?: string;
673
+ /** This is the summary of the call. */
674
+ summary?: string;
675
+ /**
676
+ * This is the callSid of the phone call.
677
+ *
678
+ * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
679
+ */
680
+ twilioCallSid?: string;
681
+ /**
682
+ * This is the URL of the call that the assistant will join.
683
+ *
684
+ * Only relevant for `webCall` type.
685
+ */
686
+ webCallUrl?: string;
687
+ /** This is the assistant that will be used for the call. To use a transient assistant, use `assistant` instead. */
688
+ assistantId?: string;
689
+ /** This is the assistant that will be used for the call. To use an existing assistant, use `assistantId` instead. */
690
+ assistant?: CreateAssistantDTO;
530
691
  /**
531
- * This sets the spoken language of the user. The assistant will do its best to respond in the same language.
532
- * When using a language other than `en-*`, only `*-11labs` voices will pronounce the words correctly. There will also be ~1sec of additional latency.
692
+ * This is the customer that will be called. To call a transient customer , use `customer` instead.
693
+ *
694
+ * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
533
695
  */
534
- language?:
535
- | "en"
536
- | "en-US"
537
- | "en-AU"
538
- | "en-GB"
539
- | "en-NZ"
540
- | "en-IN"
541
- | "fr"
542
- | "fr-CA"
543
- | "de"
544
- | "hi"
545
- | "hi-Latn"
546
- | "pt"
547
- | "pt-BR"
548
- | "es"
549
- | "es-419";
696
+ customerId?: string;
550
697
  /**
551
- * This is the name of the assistant. This is just for your own reference.
552
- * @maxLength 100
698
+ * This is the customer that will be called. To call an existing customer, use `customerId` instead.
699
+ *
700
+ * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
553
701
  */
554
- name?: string;
555
- /** This sets the objective and understanding for the assistant. */
556
- context?: string;
557
- /** These are the functions that the assistant can execute during the call. */
558
- functions?: OpenAIFunction[];
702
+ customer?: CreateCustomerDTO;
559
703
  /**
560
- * This is the URL Vapi will send GET / POST requests for retrieving context, function calling, and end-of-call reports.
704
+ * This is the phone number that will be used for the call. To use a transient number, use `phoneNumber` instead.
561
705
  *
562
- * All requests will be sent with the `call` object among other things relevant to that callback. You can find more details in the Function Calling documentation.
706
+ * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
563
707
  */
564
- callbackUrl?: string;
708
+ phoneNumberId?: string;
565
709
  /**
566
- * If you are using a custom LLM, this is the URL Vapi will use instead of hitting OpenAI.
710
+ * This is the phone number that will be used for the call. To use an existing number, use `phoneNumberId` instead.
567
711
  *
568
- * A POST request will be sent with an array of messages, and the response should be like so:
712
+ * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
713
+ */
714
+ phoneNumber?: ImportTwilioPhoneNumberDTO;
715
+ }
716
+
717
+ export interface CreateOutboundCallDTO {
718
+ /**
719
+ * Use `customer` instead.
720
+ * @deprecated
721
+ */
722
+ customerPhoneNumber?: string;
723
+ /** This is the assistant that will be used for the call. To use a transient assistant, use `assistant` instead. */
724
+ assistantId?: string;
725
+ /** This is the assistant that will be used for the call. To use an existing assistant, use `assistantId` instead. */
726
+ assistant?: CreateAssistantDTO;
727
+ /**
728
+ * This is the customer that will be called. To call a transient customer , use `customer` instead.
569
729
  *
570
- * ```
571
- * { message: "Oh hey! How are..." }
572
- * ```
730
+ * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
573
731
  */
574
- customLlmUrl?: string;
575
- /** This is the number to forward to if assistant runs into issues. */
576
- forwardingPhoneNumber?: string;
732
+ customerId?: string;
577
733
  /**
578
- * This is the first message that the assistant will say.
734
+ * This is the customer that will be called. To call an existing customer, use `customerId` instead.
579
735
  *
580
- * If unspecified, it will wait for the user to speak.
581
- * @maxLength 400
736
+ * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
582
737
  */
583
- firstMessage?: string;
738
+ customer?: CreateCustomerDTO;
584
739
  /**
585
- * This is the message that the assistant will say if the call is forwarded to voicemail.
740
+ * This is the phone number that will be used for the call. To use a transient number, use `phoneNumber` instead.
586
741
  *
587
- * If unspecified, it will hang up.
588
- * @maxLength 400
742
+ * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
589
743
  */
590
- voicemailMessage?: string;
744
+ phoneNumberId?: string;
591
745
  /**
592
- * This is the message that the assistant will say if it ends the call.
746
+ * This is the phone number that will be used for the call. To use an existing number, use `phoneNumberId` instead.
593
747
  *
594
- * If unspecified, it will hang up without saying anything.
595
- * @maxLength 400
748
+ * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
596
749
  */
597
- endCallMessage?: string;
598
- /** This sets whether the user can interrupt the assistant while it's speaking. Defaults to true. */
599
- interruptionsEnabled?: boolean;
600
- /** This sets whether the assistant's calls are recorded. Defaults to true. */
601
- recordingEnabled?: boolean;
602
- /** This sets whether the assistant will be able to hang up the call. Defaults to false. */
603
- endCallFunctionEnabled?: boolean;
604
- /** This sets whether the assistant will use fillers like Well..., Okay cool..., etc. Defaults to true when using gpt-4. Else, defaults to false. */
605
- fillersEnabled?: boolean;
606
- /** These keywords are passed to the transcription model to help it pick up use-case specific words. Anything that may not be a common word, like your company name, should be added here. */
607
- keywords?: string[];
750
+ phoneNumber?: ImportTwilioPhoneNumberDTO;
751
+ }
752
+
753
+ export interface CreateWebCallDTO {
754
+ /** This is the assistant that will be used for the call. To use a transient assistant, use `assistant` instead. */
755
+ assistantId?: string;
756
+ /** This is the assistant that will be used for the call. To use an existing assistant, use `assistantId` instead. */
757
+ assistant?: CreateAssistantDTO;
608
758
  }
609
759
 
610
760
  export interface BuyPhoneNumberDTO {
@@ -911,21 +1061,23 @@ export class HttpClient<SecurityDataType = unknown> {
911
1061
  * API for building voice assistants
912
1062
  */
913
1063
  export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
914
- call = {
1064
+ assistant = {
915
1065
  /**
916
1066
  * No description
917
1067
  *
918
- * @tags Calls
919
- * @name CallControllerFindAll
920
- * @summary List Calls
921
- * @request GET:/call
1068
+ * @tags Assistants
1069
+ * @name AssistantControllerCreate
1070
+ * @summary Create Assistant
1071
+ * @request POST:/assistant
922
1072
  * @secure
923
1073
  */
924
- callControllerFindAll: (params: RequestParams = {}) =>
925
- this.request<Call[], any>({
926
- path: `/call`,
927
- method: "GET",
1074
+ assistantControllerCreate: (data: CreateAssistantDTO, params: RequestParams = {}) =>
1075
+ this.request<Assistant, any>({
1076
+ path: `/assistant`,
1077
+ method: "POST",
1078
+ body: data,
928
1079
  secure: true,
1080
+ type: ContentType.Json,
929
1081
  format: "json",
930
1082
  ...params,
931
1083
  }),
@@ -933,15 +1085,15 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
933
1085
  /**
934
1086
  * No description
935
1087
  *
936
- * @tags Calls
937
- * @name CallControllerFindOne
938
- * @summary Get Call
939
- * @request GET:/call/{id}
1088
+ * @tags Assistants
1089
+ * @name AssistantControllerFindAll
1090
+ * @summary List Assistants
1091
+ * @request GET:/assistant
940
1092
  * @secure
941
1093
  */
942
- callControllerFindOne: (id: string, params: RequestParams = {}) =>
943
- this.request<Call, any>({
944
- path: `/call/${id}`,
1094
+ assistantControllerFindAll: (params: RequestParams = {}) =>
1095
+ this.request<Assistant[], any>({
1096
+ path: `/assistant`,
945
1097
  method: "GET",
946
1098
  secure: true,
947
1099
  format: "json",
@@ -951,19 +1103,17 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
951
1103
  /**
952
1104
  * No description
953
1105
  *
954
- * @tags Calls
955
- * @name CallControllerCreatePhoneCall
956
- * @summary Create Phone Call
957
- * @request POST:/call/phone
1106
+ * @tags Assistants
1107
+ * @name AssistantControllerFindOne
1108
+ * @summary Get Assistant
1109
+ * @request GET:/assistant/{id}
958
1110
  * @secure
959
1111
  */
960
- callControllerCreatePhoneCall: (data: CreateOutboundCallDTO, params: RequestParams = {}) =>
961
- this.request<Call, any>({
962
- path: `/call/phone`,
963
- method: "POST",
964
- body: data,
1112
+ assistantControllerFindOne: (id: string, params: RequestParams = {}) =>
1113
+ this.request<Assistant, any>({
1114
+ path: `/assistant/${id}`,
1115
+ method: "GET",
965
1116
  secure: true,
966
- type: ContentType.Json,
967
1117
  format: "json",
968
1118
  ...params,
969
1119
  }),
@@ -971,56 +1121,54 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
971
1121
  /**
972
1122
  * No description
973
1123
  *
974
- * @tags Calls
975
- * @name CallControllerCreateWebCall
976
- * @summary Create Web Call
977
- * @request POST:/call/web
1124
+ * @tags Assistants
1125
+ * @name AssistantControllerUpdate
1126
+ * @summary Update Assistant
1127
+ * @request PATCH:/assistant/{id}
978
1128
  * @secure
979
1129
  */
980
- callControllerCreateWebCall: (data: CreateWebCallDTO, params: RequestParams = {}) =>
981
- this.request<Call, any>({
982
- path: `/call/web`,
983
- method: "POST",
1130
+ assistantControllerUpdate: (id: string, data: UpdateAssistantDTO, params: RequestParams = {}) =>
1131
+ this.request<Assistant, any>({
1132
+ path: `/assistant/${id}`,
1133
+ method: "PATCH",
984
1134
  body: data,
985
1135
  secure: true,
986
1136
  type: ContentType.Json,
987
1137
  format: "json",
988
1138
  ...params,
989
1139
  }),
990
- };
991
- assistant = {
1140
+
992
1141
  /**
993
1142
  * No description
994
1143
  *
995
1144
  * @tags Assistants
996
- * @name AssistantControllerCreate
997
- * @summary Create Assistant
998
- * @request POST:/assistant
1145
+ * @name AssistantControllerRemove
1146
+ * @summary Delete Assistant
1147
+ * @request DELETE:/assistant/{id}
999
1148
  * @secure
1000
1149
  */
1001
- assistantControllerCreate: (data: CreateAssistantDTO, params: RequestParams = {}) =>
1150
+ assistantControllerRemove: (id: string, params: RequestParams = {}) =>
1002
1151
  this.request<Assistant, any>({
1003
- path: `/assistant`,
1004
- method: "POST",
1005
- body: data,
1152
+ path: `/assistant/${id}`,
1153
+ method: "DELETE",
1006
1154
  secure: true,
1007
- type: ContentType.Json,
1008
1155
  format: "json",
1009
1156
  ...params,
1010
1157
  }),
1011
-
1158
+ };
1159
+ call = {
1012
1160
  /**
1013
1161
  * No description
1014
1162
  *
1015
- * @tags Assistants
1016
- * @name AssistantControllerFindAll
1017
- * @summary List Assistants
1018
- * @request GET:/assistant
1163
+ * @tags Calls
1164
+ * @name CallControllerFindAll
1165
+ * @summary List Calls
1166
+ * @request GET:/call
1019
1167
  * @secure
1020
1168
  */
1021
- assistantControllerFindAll: (params: RequestParams = {}) =>
1022
- this.request<Assistant[], any>({
1023
- path: `/assistant`,
1169
+ callControllerFindAll: (params: RequestParams = {}) =>
1170
+ this.request<Call[], any>({
1171
+ path: `/call`,
1024
1172
  method: "GET",
1025
1173
  secure: true,
1026
1174
  format: "json",
@@ -1030,15 +1178,15 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1030
1178
  /**
1031
1179
  * No description
1032
1180
  *
1033
- * @tags Assistants
1034
- * @name AssistantControllerFindOne
1035
- * @summary Get Assistant
1036
- * @request GET:/assistant/{id}
1181
+ * @tags Calls
1182
+ * @name CallControllerFindOne
1183
+ * @summary Get Call
1184
+ * @request GET:/call/{id}
1037
1185
  * @secure
1038
1186
  */
1039
- assistantControllerFindOne: (id: string, params: RequestParams = {}) =>
1040
- this.request<Assistant, any>({
1041
- path: `/assistant/${id}`,
1187
+ callControllerFindOne: (id: string, params: RequestParams = {}) =>
1188
+ this.request<Call, any>({
1189
+ path: `/call/${id}`,
1042
1190
  method: "GET",
1043
1191
  secure: true,
1044
1192
  format: "json",
@@ -1048,16 +1196,16 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1048
1196
  /**
1049
1197
  * No description
1050
1198
  *
1051
- * @tags Assistants
1052
- * @name AssistantControllerUpdate
1053
- * @summary Update Assistant
1054
- * @request PATCH:/assistant/{id}
1199
+ * @tags Calls
1200
+ * @name CallControllerCreatePhoneCall
1201
+ * @summary Create Phone Call
1202
+ * @request POST:/call/phone
1055
1203
  * @secure
1056
1204
  */
1057
- assistantControllerUpdate: (id: string, data: UpdateAssistantDTO, params: RequestParams = {}) =>
1058
- this.request<Assistant, any>({
1059
- path: `/assistant/${id}`,
1060
- method: "PATCH",
1205
+ callControllerCreatePhoneCall: (data: CreateOutboundCallDTO, params: RequestParams = {}) =>
1206
+ this.request<Call, any>({
1207
+ path: `/call/phone`,
1208
+ method: "POST",
1061
1209
  body: data,
1062
1210
  secure: true,
1063
1211
  type: ContentType.Json,
@@ -1068,17 +1216,19 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1068
1216
  /**
1069
1217
  * No description
1070
1218
  *
1071
- * @tags Assistants
1072
- * @name AssistantControllerRemove
1073
- * @summary Delete Assistant
1074
- * @request DELETE:/assistant/{id}
1219
+ * @tags Calls
1220
+ * @name CallControllerCreateWebCall
1221
+ * @summary Create Web Call
1222
+ * @request POST:/call/web
1075
1223
  * @secure
1076
1224
  */
1077
- assistantControllerRemove: (id: string, params: RequestParams = {}) =>
1078
- this.request<Assistant, any>({
1079
- path: `/assistant/${id}`,
1080
- method: "DELETE",
1225
+ callControllerCreateWebCall: (data: CreateWebCallDTO, params: RequestParams = {}) =>
1226
+ this.request<Call, any>({
1227
+ path: `/call/web`,
1228
+ method: "POST",
1229
+ body: data,
1081
1230
  secure: true,
1231
+ type: ContentType.Json,
1082
1232
  format: "json",
1083
1233
  ...params,
1084
1234
  }),