@vapi-ai/web 1.0.230 → 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 +523 -352
  2. package/dist/api.d.ts +337 -221
  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,46 +223,60 @@ 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;
273
+ /**
274
+ * This is the message that the assistant will say if it ends the call.
275
+ *
276
+ * If unspecified, it will hang up without saying anything.
277
+ * @maxLength 400
278
+ */
279
+ endCallMessage?: string;
158
280
  /** This sets whether the user can interrupt the assistant while it's speaking. Defaults to true. */
159
281
  interruptionsEnabled?: boolean;
160
282
  /** This sets whether the assistant's calls are recorded. Defaults to true. */
@@ -163,177 +285,18 @@ export interface CreateAssistantDTO {
163
285
  endCallFunctionEnabled?: boolean;
164
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. */
165
287
  fillersEnabled?: boolean;
166
- /** These keywords are passed to the transcription model to help it pick up use-case specific words. */
167
- keywords?: string[];
168
- }
169
-
170
- export interface CreateCustomerDTO {
171
- /** This is the number of the customer. */
172
- number?: string;
173
- /**
174
- * This is the name of the customer. This is just for your own reference.
175
- * @maxLength 40
176
- */
177
- name?: string;
178
- }
179
-
180
- export interface ImportTwilioPhoneNumberDTO {
181
- /** These are the digits of the phone number you own on your Twilio. */
182
- twilioPhoneNumber: string;
183
- /** This is your Twilio Account SID that will be used to handle this phone number. */
184
- twilioAccountSid: string;
185
- /** This is the Twilio Auth Token that will be used to handle this phone number. */
186
- twilioAuthToken: string;
187
- /**
188
- * This is the name of the phone number. This is just for your own reference.
189
- * @maxLength 40
190
- */
191
- name?: string;
192
- /**
193
- * This is the assistant that will be used for incoming calls to this phone number.
194
- *
195
- * If this is not set, then the phone number will not handle incoming calls.
196
- */
197
- assistantId?: string;
198
- }
199
-
200
- export interface Call {
201
- type?: "inboundPhoneCall" | "outboundPhoneCall" | "webCall";
202
- /** This is the unique identifier for the call. */
203
- id: string;
204
- /** This is the unique identifier for the org that this call belongs to. */
205
- orgId: string;
206
- /**
207
- * This is the ISO 8601 date-time string of when the call was created.
208
- * @format date-time
209
- */
210
- createdAt: string;
211
- /**
212
- * This is the ISO 8601 date-time string of when the call was last updated.
213
- * @format date-time
214
- */
215
- updatedAt: string;
216
- /**
217
- * This is the ISO 8601 date-time string of when the call was started.
218
- * @format date-time
219
- */
220
- startedAt?: string;
221
- /**
222
- * This is the ISO 8601 date-time string of when the call was ended.
223
- * @format date-time
224
- */
225
- endedAt?: string;
226
- /** This is the cost of the call in USD. */
227
- cost?: number;
228
- /** This is the transcript of the call. */
229
- transcript?: string;
230
- /** This is the URL of the recording of the call. */
231
- recordingUrl?: string;
232
- /** This is the summary of the call. */
233
- summary?: string;
234
- /**
235
- * This is the callSid of the phone call.
236
- *
237
- * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
238
- */
239
- twilioCallSid?: string;
240
- /**
241
- * This is the current status of the call.
242
- *
243
- * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
244
- */
245
- twilioCallStatus?: string;
246
- /**
247
- * This is the URL of the call that the assistant will join.
248
- *
249
- * Only relevant for `webCall` type.
250
- */
251
- webCallUrl?: string;
252
- /** This is set if the call experienced an error. */
253
- error?: string;
254
- /** This is the assistant that will be used for the call. To use a transient assistant, use `assistant` instead. */
255
- assistantId?: string;
256
- /** This is the assistant that will be used for the call. To use an existing assistant, use `assistantId` instead. */
257
- assistant?: CreateAssistantDTO;
258
- /**
259
- * This is the customer that will be called. To call a transient customer , use `customer` instead.
260
- *
261
- * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
262
- */
263
- customerId?: string;
264
- /**
265
- * This is the customer that will be called. To call an existing customer, use `customerId` instead.
266
- *
267
- * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
268
- */
269
- customer?: CreateCustomerDTO;
270
- /**
271
- * This is the phone number that will be used for the call. To use a transient number, use `phoneNumber` instead.
272
- *
273
- * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
274
- */
275
- phoneNumberId?: string;
276
- /**
277
- * This is the phone number that will be used for the call. To use an existing number, use `phoneNumberId` instead.
278
- *
279
- * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
280
- */
281
- phoneNumber?: ImportTwilioPhoneNumberDTO;
282
- }
283
-
284
- export interface CreateOutboundCallDTO {
285
- /**
286
- * Use `customer` instead.
287
- * @deprecated
288
- */
289
- customerPhoneNumber?: string;
290
- /** This is the assistant that will be used for the call. To use a transient assistant, use `assistant` instead. */
291
- assistantId?: string;
292
- /** This is the assistant that will be used for the call. To use an existing assistant, use `assistantId` instead. */
293
- assistant?: CreateAssistantDTO;
294
- /**
295
- * This is the customer that will be called. To call a transient customer , use `customer` instead.
296
- *
297
- * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
298
- */
299
- customerId?: string;
300
- /**
301
- * This is the customer that will be called. To call an existing customer, use `customerId` instead.
302
- *
303
- * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
304
- */
305
- customer?: CreateCustomerDTO;
306
- /**
307
- * This is the phone number that will be used for the call. To use a transient number, use `phoneNumber` instead.
308
- *
309
- * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
310
- */
311
- phoneNumberId?: string;
312
- /**
313
- * This is the phone number that will be used for the call. To use an existing number, use `phoneNumberId` instead.
314
- *
315
- * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
316
- */
317
- phoneNumber?: ImportTwilioPhoneNumberDTO;
318
- }
319
-
320
- export interface CreateWebCallDTO {
321
- /** This is the assistant that will be used for the call. To use a transient assistant, use `assistant` instead. */
322
- assistantId?: string;
323
- /** This is the assistant that will be used for the call. To use an existing assistant, use `assistantId` instead. */
324
- assistant?: CreateAssistantDTO;
325
288
  }
326
289
 
327
290
  export interface Assistant {
328
- /** This is the OpenAI model that will be used. */
329
- model?: "gpt-4" | "gpt-3.5-turbo";
330
- /**
331
- * This is the voice that will be used.
332
- *
333
- * Pro Voices: `*-11labs`, `*-playht`
334
- *
335
- * Basic Voices: `*-rimeai`
336
- */
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. */
337
300
  voice?:
338
301
  | "jennifer-playht"
339
302
  | "melissa-playht"
@@ -374,10 +337,14 @@ export interface Assistant {
374
337
  | "stella-beta"
375
338
  | "artemis-beta"
376
339
  | "andromeda-beta"
377
- | "atlas-beta";
340
+ | "atlas-beta"
341
+ | ElevenLabsVoice
342
+ | PlayHTVoice
343
+ | RimeAIVoice
344
+ | BetaVoice;
378
345
  /**
379
346
  * This sets the spoken language of the user. The assistant will do its best to respond in the same language.
380
- * 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.
381
348
  */
382
349
  language?:
383
350
  | "en"
@@ -396,46 +363,60 @@ export interface Assistant {
396
363
  | "es"
397
364
  | "es-419";
398
365
  /**
399
- * This is the name of the assistant. This is just for your own reference.
400
- * @maxLength 100
366
+ * Use `model.systemPrompt` instead.
367
+ * @deprecated
401
368
  */
402
- name?: string;
403
- /** This sets the objective and understanding for the assistant. */
404
369
  context?: string;
405
- /** These are the functions that the assistant can execute during the call. */
370
+ /**
371
+ * Use `model.functions` instead.
372
+ * @deprecated
373
+ */
406
374
  functions?: OpenAIFunction[];
407
375
  /**
408
- * This is the URL Vapi will send GET / POST requests for retrieving context, function calling, and end-of-call reports.
409
- *
410
- * 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
411
378
  */
412
379
  callbackUrl?: string;
413
380
  /**
414
- * If you are using a custom LLM, this is the URL Vapi will use instead of hitting OpenAI.
415
- *
416
- * A POST request will be sent with an array of messages, and the response should be like so:
417
- *
418
- * ```
419
- * { message: "Oh hey! How are..." }
420
- * ```
381
+ * Use `model.url` instead.
382
+ * @deprecated
421
383
  */
422
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;
423
397
  /** This is the number to forward to if assistant runs into issues. */
424
398
  forwardingPhoneNumber?: string;
425
399
  /**
426
400
  * This is the first message that the assistant will say.
427
401
  *
428
402
  * If unspecified, it will wait for the user to speak.
429
- * @maxLength 400
403
+ * @maxLength 1000
430
404
  */
431
405
  firstMessage?: string;
432
406
  /**
433
407
  * This is the message that the assistant will say if the call is forwarded to voicemail.
434
408
  *
435
409
  * If unspecified, it will hang up.
436
- * @maxLength 400
410
+ * @maxLength 1000
437
411
  */
438
412
  voicemailMessage?: string;
413
+ /**
414
+ * This is the message that the assistant will say if it ends the call.
415
+ *
416
+ * If unspecified, it will hang up without saying anything.
417
+ * @maxLength 400
418
+ */
419
+ endCallMessage?: string;
439
420
  /** This sets whether the user can interrupt the assistant while it's speaking. Defaults to true. */
440
421
  interruptionsEnabled?: boolean;
441
422
  /** This sets whether the assistant's calls are recorded. Defaults to true. */
@@ -444,8 +425,6 @@ export interface Assistant {
444
425
  endCallFunctionEnabled?: boolean;
445
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. */
446
427
  fillersEnabled?: boolean;
447
- /** These keywords are passed to the transcription model to help it pick up use-case specific words. */
448
- keywords?: string[];
449
428
  /** This is the unique identifier for the assistant. */
450
429
  id: string;
451
430
  /** This is the unique identifier for the org that this assistant belongs to. */
@@ -463,15 +442,15 @@ export interface Assistant {
463
442
  }
464
443
 
465
444
  export interface UpdateAssistantDTO {
466
- /** This is the OpenAI model that will be used. */
467
- model?: "gpt-4" | "gpt-3.5-turbo";
468
- /**
469
- * This is the voice that will be used.
470
- *
471
- * Pro Voices: `*-11labs`, `*-playht`
472
- *
473
- * Basic Voices: `*-rimeai`
474
- */
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. */
475
454
  voice?:
476
455
  | "jennifer-playht"
477
456
  | "melissa-playht"
@@ -512,78 +491,270 @@ export interface UpdateAssistantDTO {
512
491
  | "stella-beta"
513
492
  | "artemis-beta"
514
493
  | "andromeda-beta"
515
- | "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;
516
681
  /**
517
- * This sets the spoken language of the user. The assistant will do its best to respond in the same language.
518
- * When using a language other than `en-*`, only `*-11labs` voices will pronounce the words correctly. There will also be ~1sec of additional latency.
682
+ * This is the URL of the call that the assistant will join.
683
+ *
684
+ * Only relevant for `webCall` type.
519
685
  */
520
- language?:
521
- | "en"
522
- | "en-US"
523
- | "en-AU"
524
- | "en-GB"
525
- | "en-NZ"
526
- | "en-IN"
527
- | "fr"
528
- | "fr-CA"
529
- | "de"
530
- | "hi"
531
- | "hi-Latn"
532
- | "pt"
533
- | "pt-BR"
534
- | "es"
535
- | "es-419";
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;
536
691
  /**
537
- * This is the name of the assistant. This is just for your own reference.
538
- * @maxLength 100
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.
539
695
  */
540
- name?: string;
541
- /** This sets the objective and understanding for the assistant. */
542
- context?: string;
543
- /** These are the functions that the assistant can execute during the call. */
544
- functions?: OpenAIFunction[];
696
+ customerId?: string;
545
697
  /**
546
- * This is the URL Vapi will send GET / POST requests for retrieving context, function calling, and end-of-call reports.
698
+ * This is the customer that will be called. To call an existing customer, use `customerId` instead.
547
699
  *
548
- * 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.
700
+ * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
549
701
  */
550
- callbackUrl?: string;
702
+ customer?: CreateCustomerDTO;
551
703
  /**
552
- * If you are using a custom LLM, this is the URL Vapi will use instead of hitting OpenAI.
704
+ * This is the phone number that will be used for the call. To use a transient number, use `phoneNumber` instead.
553
705
  *
554
- * A POST request will be sent with an array of messages, and the response should be like so:
706
+ * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
707
+ */
708
+ phoneNumberId?: string;
709
+ /**
710
+ * This is the phone number that will be used for the call. To use an existing number, use `phoneNumberId` instead.
555
711
  *
556
- * ```
557
- * { message: "Oh hey! How are..." }
558
- * ```
712
+ * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
559
713
  */
560
- customLlmUrl?: string;
561
- /** This is the number to forward to if assistant runs into issues. */
562
- forwardingPhoneNumber?: string;
714
+ phoneNumber?: ImportTwilioPhoneNumberDTO;
715
+ }
716
+
717
+ export interface CreateOutboundCallDTO {
563
718
  /**
564
- * This is the first message that the assistant will say.
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.
565
729
  *
566
- * If unspecified, it will wait for the user to speak.
567
- * @maxLength 400
730
+ * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
568
731
  */
569
- firstMessage?: string;
732
+ customerId?: string;
570
733
  /**
571
- * This is the message that the assistant will say if the call is forwarded to voicemail.
734
+ * This is the customer that will be called. To call an existing customer, use `customerId` instead.
572
735
  *
573
- * If unspecified, it will hang up.
574
- * @maxLength 400
736
+ * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
575
737
  */
576
- voicemailMessage?: string;
577
- /** This sets whether the user can interrupt the assistant while it's speaking. Defaults to true. */
578
- interruptionsEnabled?: boolean;
579
- /** This sets whether the assistant's calls are recorded. Defaults to true. */
580
- recordingEnabled?: boolean;
581
- /** This sets whether the assistant will be able to hang up the call. Defaults to false. */
582
- endCallFunctionEnabled?: boolean;
583
- /** This sets whether the assistant will use fillers like Well..., Okay cool..., etc. Defaults to true when using gpt-4. Else, defaults to false. */
584
- fillersEnabled?: boolean;
585
- /** These keywords are passed to the transcription model to help it pick up use-case specific words. */
586
- keywords?: string[];
738
+ customer?: CreateCustomerDTO;
739
+ /**
740
+ * This is the phone number that will be used for the call. To use a transient number, use `phoneNumber` instead.
741
+ *
742
+ * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
743
+ */
744
+ phoneNumberId?: string;
745
+ /**
746
+ * This is the phone number that will be used for the call. To use an existing number, use `phoneNumberId` instead.
747
+ *
748
+ * Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
749
+ */
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;
587
758
  }
588
759
 
589
760
  export interface BuyPhoneNumberDTO {
@@ -890,21 +1061,23 @@ export class HttpClient<SecurityDataType = unknown> {
890
1061
  * API for building voice assistants
891
1062
  */
892
1063
  export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
893
- call = {
1064
+ assistant = {
894
1065
  /**
895
1066
  * No description
896
1067
  *
897
- * @tags Calls
898
- * @name CallControllerFindAll
899
- * @summary List Calls
900
- * @request GET:/call
1068
+ * @tags Assistants
1069
+ * @name AssistantControllerCreate
1070
+ * @summary Create Assistant
1071
+ * @request POST:/assistant
901
1072
  * @secure
902
1073
  */
903
- callControllerFindAll: (params: RequestParams = {}) =>
904
- this.request<Call[], any>({
905
- path: `/call`,
906
- method: "GET",
1074
+ assistantControllerCreate: (data: CreateAssistantDTO, params: RequestParams = {}) =>
1075
+ this.request<Assistant, any>({
1076
+ path: `/assistant`,
1077
+ method: "POST",
1078
+ body: data,
907
1079
  secure: true,
1080
+ type: ContentType.Json,
908
1081
  format: "json",
909
1082
  ...params,
910
1083
  }),
@@ -912,15 +1085,15 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
912
1085
  /**
913
1086
  * No description
914
1087
  *
915
- * @tags Calls
916
- * @name CallControllerFindOne
917
- * @summary Get Call
918
- * @request GET:/call/{id}
1088
+ * @tags Assistants
1089
+ * @name AssistantControllerFindAll
1090
+ * @summary List Assistants
1091
+ * @request GET:/assistant
919
1092
  * @secure
920
1093
  */
921
- callControllerFindOne: (id: string, params: RequestParams = {}) =>
922
- this.request<Call, any>({
923
- path: `/call/${id}`,
1094
+ assistantControllerFindAll: (params: RequestParams = {}) =>
1095
+ this.request<Assistant[], any>({
1096
+ path: `/assistant`,
924
1097
  method: "GET",
925
1098
  secure: true,
926
1099
  format: "json",
@@ -930,19 +1103,17 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
930
1103
  /**
931
1104
  * No description
932
1105
  *
933
- * @tags Calls
934
- * @name CallControllerCreatePhoneCall
935
- * @summary Create Phone Call
936
- * @request POST:/call/phone
1106
+ * @tags Assistants
1107
+ * @name AssistantControllerFindOne
1108
+ * @summary Get Assistant
1109
+ * @request GET:/assistant/{id}
937
1110
  * @secure
938
1111
  */
939
- callControllerCreatePhoneCall: (data: CreateOutboundCallDTO, params: RequestParams = {}) =>
940
- this.request<Call, any>({
941
- path: `/call/phone`,
942
- method: "POST",
943
- body: data,
1112
+ assistantControllerFindOne: (id: string, params: RequestParams = {}) =>
1113
+ this.request<Assistant, any>({
1114
+ path: `/assistant/${id}`,
1115
+ method: "GET",
944
1116
  secure: true,
945
- type: ContentType.Json,
946
1117
  format: "json",
947
1118
  ...params,
948
1119
  }),
@@ -950,56 +1121,54 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
950
1121
  /**
951
1122
  * No description
952
1123
  *
953
- * @tags Calls
954
- * @name CallControllerCreateWebCall
955
- * @summary Create Web Call
956
- * @request POST:/call/web
1124
+ * @tags Assistants
1125
+ * @name AssistantControllerUpdate
1126
+ * @summary Update Assistant
1127
+ * @request PATCH:/assistant/{id}
957
1128
  * @secure
958
1129
  */
959
- callControllerCreateWebCall: (data: CreateWebCallDTO, params: RequestParams = {}) =>
960
- this.request<Call, any>({
961
- path: `/call/web`,
962
- method: "POST",
1130
+ assistantControllerUpdate: (id: string, data: UpdateAssistantDTO, params: RequestParams = {}) =>
1131
+ this.request<Assistant, any>({
1132
+ path: `/assistant/${id}`,
1133
+ method: "PATCH",
963
1134
  body: data,
964
1135
  secure: true,
965
1136
  type: ContentType.Json,
966
1137
  format: "json",
967
1138
  ...params,
968
1139
  }),
969
- };
970
- assistant = {
1140
+
971
1141
  /**
972
1142
  * No description
973
1143
  *
974
1144
  * @tags Assistants
975
- * @name AssistantControllerCreate
976
- * @summary Create Assistant
977
- * @request POST:/assistant
1145
+ * @name AssistantControllerRemove
1146
+ * @summary Delete Assistant
1147
+ * @request DELETE:/assistant/{id}
978
1148
  * @secure
979
1149
  */
980
- assistantControllerCreate: (data: CreateAssistantDTO, params: RequestParams = {}) =>
1150
+ assistantControllerRemove: (id: string, params: RequestParams = {}) =>
981
1151
  this.request<Assistant, any>({
982
- path: `/assistant`,
983
- method: "POST",
984
- body: data,
1152
+ path: `/assistant/${id}`,
1153
+ method: "DELETE",
985
1154
  secure: true,
986
- type: ContentType.Json,
987
1155
  format: "json",
988
1156
  ...params,
989
1157
  }),
990
-
1158
+ };
1159
+ call = {
991
1160
  /**
992
1161
  * No description
993
1162
  *
994
- * @tags Assistants
995
- * @name AssistantControllerFindAll
996
- * @summary List Assistants
997
- * @request GET:/assistant
1163
+ * @tags Calls
1164
+ * @name CallControllerFindAll
1165
+ * @summary List Calls
1166
+ * @request GET:/call
998
1167
  * @secure
999
1168
  */
1000
- assistantControllerFindAll: (params: RequestParams = {}) =>
1001
- this.request<Assistant[], any>({
1002
- path: `/assistant`,
1169
+ callControllerFindAll: (params: RequestParams = {}) =>
1170
+ this.request<Call[], any>({
1171
+ path: `/call`,
1003
1172
  method: "GET",
1004
1173
  secure: true,
1005
1174
  format: "json",
@@ -1009,15 +1178,15 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1009
1178
  /**
1010
1179
  * No description
1011
1180
  *
1012
- * @tags Assistants
1013
- * @name AssistantControllerFindOne
1014
- * @summary Get Assistant
1015
- * @request GET:/assistant/{id}
1181
+ * @tags Calls
1182
+ * @name CallControllerFindOne
1183
+ * @summary Get Call
1184
+ * @request GET:/call/{id}
1016
1185
  * @secure
1017
1186
  */
1018
- assistantControllerFindOne: (id: string, params: RequestParams = {}) =>
1019
- this.request<Assistant, any>({
1020
- path: `/assistant/${id}`,
1187
+ callControllerFindOne: (id: string, params: RequestParams = {}) =>
1188
+ this.request<Call, any>({
1189
+ path: `/call/${id}`,
1021
1190
  method: "GET",
1022
1191
  secure: true,
1023
1192
  format: "json",
@@ -1027,16 +1196,16 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1027
1196
  /**
1028
1197
  * No description
1029
1198
  *
1030
- * @tags Assistants
1031
- * @name AssistantControllerUpdate
1032
- * @summary Update Assistant
1033
- * @request PATCH:/assistant/{id}
1199
+ * @tags Calls
1200
+ * @name CallControllerCreatePhoneCall
1201
+ * @summary Create Phone Call
1202
+ * @request POST:/call/phone
1034
1203
  * @secure
1035
1204
  */
1036
- assistantControllerUpdate: (id: string, data: UpdateAssistantDTO, params: RequestParams = {}) =>
1037
- this.request<Assistant, any>({
1038
- path: `/assistant/${id}`,
1039
- method: "PATCH",
1205
+ callControllerCreatePhoneCall: (data: CreateOutboundCallDTO, params: RequestParams = {}) =>
1206
+ this.request<Call, any>({
1207
+ path: `/call/phone`,
1208
+ method: "POST",
1040
1209
  body: data,
1041
1210
  secure: true,
1042
1211
  type: ContentType.Json,
@@ -1047,17 +1216,19 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1047
1216
  /**
1048
1217
  * No description
1049
1218
  *
1050
- * @tags Assistants
1051
- * @name AssistantControllerRemove
1052
- * @summary Delete Assistant
1053
- * @request DELETE:/assistant/{id}
1219
+ * @tags Calls
1220
+ * @name CallControllerCreateWebCall
1221
+ * @summary Create Web Call
1222
+ * @request POST:/call/web
1054
1223
  * @secure
1055
1224
  */
1056
- assistantControllerRemove: (id: string, params: RequestParams = {}) =>
1057
- this.request<Assistant, any>({
1058
- path: `/assistant/${id}`,
1059
- method: "DELETE",
1225
+ callControllerCreateWebCall: (data: CreateWebCallDTO, params: RequestParams = {}) =>
1226
+ this.request<Call, any>({
1227
+ path: `/call/web`,
1228
+ method: "POST",
1229
+ body: data,
1060
1230
  secure: true,
1231
+ type: ContentType.Json,
1061
1232
  format: "json",
1062
1233
  ...params,
1063
1234
  }),