stormy-gold
stormy-gold2y ago

Create web calls from client

Hi, when I checked the API Docs I could only find the /call/phone endpoint which requires a real phone number. When I checked the Web SDK I stumbled upon /call/web, this endpoint is undocumented though. My plan was to modify the web sdk to allow joining a Daily meeting by overriding the webcallUrl it uses internally. Is this way supported, recommended and is there possibly any easier way
12 Replies
Ask Inkeep
Ask Inkeep2y ago
Hi @JuzTim, I'm an AI assistant for Vapi. I'll analyze available sources and get back to you shortly. ----------------------------- While I generate an answer, here are some sources that might be helpful: * Web SDK * Create Phone Call * Vapi Web SDK * Web Calling -----------------------------
Ask Inkeep
Ask Inkeep2y ago
Answer The /call/web endpoint is not recommended for direct use. It's intended to be used via the Web SDK or other provided tools, rather than calling it directly via custom modifications (1) (2) . To create and manage web calls, you should use the Web SDK. Here is how you can get started with the Web SDK: 1. Installation:
yarn add @vapi-ai/web

yarn add @vapi-ai/web

or
npm install @vapi-ai/web

npm install @vapi-ai/web

2. Usage:
import Vapi from '@vapi-ai/web';

const vapi = new Vapi('your-public-key');

vapi.start({
model: {
provider: "openai",
model: "gpt-3.5-turbo",
messages: [
{
role: "system",
content: "You are an assistant.",
},
],
},
voice: {
provider: "11labs",
voiceId: "burt",
},
});

import Vapi from '@vapi-ai/web';

const vapi = new Vapi('your-public-key');

vapi.start({
model: {
provider: "openai",
model: "gpt-3.5-turbo",
messages: [
{
role: "system",
content: "You are an assistant.",
},
],
},
voice: {
provider: "11labs",
voiceId: "burt",
},
});

3. Listening to Events:
vapi.on('call-start', () => {
console.log('Call has started');
});

vapi.on('call-end', () => {
console.log('Call has ended');
});

vapi.on('message', (message) => {
console.log(message);
});

vapi.on('call-start', () => {
console.log('Call has started');
});

vapi.on('call-end', () => {
console.log('Call has ended');
});

vapi.on('message', (message) => {
console.log(message);
});

For more detailed information, you can refer to the Web SDK documentation (3) (4) (5) (6) (7) .
stormy-gold
stormy-goldOP2y ago
I don't want to use the web sdk to create web calls.
Ask Inkeep
Ask Inkeep2y ago
Thanks for the follow-up, @JuzTim. I'll get back to you soon. ----------------------------- While I generate an answer, here are some sources that might be helpful: * Web SDK * Create Phone Call * Vapi Web SDK * Vapi iOS SDK -----------------------------
Ask Inkeep
Ask Inkeep2y ago
Answer Directly using the /call/web endpoint is not documented or recommended. The intended approach is through the Web SDK. If you choose to proceed without the Web SDK, you may encounter issues with support or stability that aren't addressed in the documentation. For more details on supported methods, you can refer to these sources: - Vapi Web SDK (1) - Create Phone Call (2)
Ask Inkeep
Ask Inkeep2y ago
Got it. Tagging @Vapi Team for additional help.
stormy-gold
stormy-goldOP2y ago
Creating the webcalls from the client is a bit of a problem for us because we need control over which clients can initiate calls and which cant
compatible-turquoise
compatible-turquoise2y ago
It is not meant for directly called you will need to use any SDK for it. That's why it is hidden.
stormy-gold
stormy-goldOP2y ago
what could we do in our usecase then we need individual access on a per-user level to the call functionality
Ask Inkeep
Ask Inkeep2y ago
Got it. Tagging @Vapi Team for additional help.
compatible-turquoise
compatible-turquoise2y ago
@JuzTim can you dm me your proper usecase so that i can help you? with examples
stormy-gold
stormy-goldOP2y ago
sent

Did you find this page helpful?