Aryan bisht
03/30/2025, 9:55 AMVapi Support Bot
03/30/2025, 9:57 AM.send()
method in the Vapi Web SDK to send messages to the assistant:
javascript
vapi.send({
type: "add-message",
message: {
role: "system",
content: "The user has pressed the button, say peanuts",
},
});
According to the [Vapi SDK documentation](https://docs.vapi.ai/sdk/web), this allows you to send intermediate messages to the assistant during a call.
## Receiving Messages from the Assistant
To receive messages from the assistant, you can use the message
event:
javascript
vapi.on("message", (message) => {
console.log(message);
});
This will let you receive various assistant messages back to the client during the call, as mentioned in the [Vapi SDK documentation](https://docs.vapi.ai/sdk/web).
## Backend Integration Options
For backend integration, you have several options:
1. **Server URLs**: You can send real-time conversation data to your backend using server URLs. According to the [Vapi server URL documentation](https://docs.vapi.ai/server-url), this is essential for building more complex applications.
2. **Webhooks**: You can configure your assistant to send server messages to a webhook, which is more reliable than client-side events because it works even if the client disconnects before the call ends, as noted in [Discord discussions](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1342410769232302122).Vapi Support Bot
03/30/2025, 9:57 AMprovider
and model
in the model
parameter of the Assistant.
2. **Voice Providers with Low Latency**: If voice is part of your application, providers like Cartesia.ai offer "Ultrafast Voice Synthesis" with "Low Latency Streaming" as mentioned in the [Cartesia provider documentation](https://docs.vapi.ai/providers/voice/cartesia).
Is there anything specific about these integration methods or alternatives you'd like me to explain further?
Sources:
- [Vapi SDK documentation](https://docs.vapi.ai/sdk/web)
- [Vapi server URL documentation](https://docs.vapi.ai/server-url)
- [Discord discussions](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1342410769232302122)
- [Discord discussions](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1339634926248525935)
- [Provider documentation](https://docs.vapi.ai/customization/provider-keys)
- [Cartesia provider documentation](https://docs.vapi.ai/providers/voice/cartesia)Aditya
03/30/2025, 10:58 AMAryan bisht
03/30/2025, 11:40 AMAditya
03/31/2025, 10:43 AM