Use VAPI with WebRTC.
# support
y
The use-case is to communicate with VAPI using webrtc. I need some insights on how can I achieve this?
v
Hi there! 👋 I can help with integrating VAPI with WebRTC for real-time communication. Based on the documentation I found, VAPI's Web SDK is designed specifically for this purpose - it manages audio streams using WebRTC for real-time communication in web applications. Here's how you can get started: 1. **Install the Web SDK**:
Copy code
bash
npm install @vapi-ai/web
2. **Import and initialize**:
Copy code
javascript
import Vapi from "@vapi-ai/web";
const vapi = new Vapi("your-public-key");
3. **Start a call**:
Copy code
javascript
const call = await vapi.start("assistantId");
// You can also use a configuration object for more detailed setups
The Web SDK handles the WebRTC communication behind the scenes, managing the audio stream to and from the client [effectively](https://docs.vapi.ai/sdk/web). For server-side integration, VAPI offers SDKs in multiple languages: - Python - TypeScript - Java - Ruby - C# - Go These can be used alongside the Web SDK to create a complete solution. I wasn't able to find specific sample projects or tutorials that explicitly demonstrate VAPI with WebRTC integration in the documentation. The examples available (like Outbound Sales, Inbound Support, and Pizza Website) focus on VAPI use cases but don't specifically address WebRTC implementation details. If you have more specific questions about your implementation, I'd be happy to help further! Sources: - [VAPI Web SDK Documentation](https://docs.vapi.ai/sdk/web) - [VAPI Server SDKs](https://docs.vapi.ai/server-sdks)
y
I need to use webRTC but not directly in the browser using web sdk. I need to communicate with a server (our client's) via webrtc (They have a setup for this).
@Shubham Bajaj @bryant @Sahil can anyone help us with this?
k
Hi Yash, Currently, we don't offer native support for this feature. To achieve it, you would need to pass the user's audio through one of our SDKs after converting it, and then follow the same process when returning a response. Please note that this approach may introduce significant latency.
y
Thanks for the response @Mason Do you have some reference where I can look for this alternative approach?
k
Since this would be a custom use case, there isn't any docs on it that I'm aware of. I can check with the team for sure and if I can dig anything up I'll shoot you a message.
y
Sure @Mason That will be super helpful!
17 Views