Williham
03/13/2025, 4:11 PMVapi Support Bot
03/13/2025, 4:13 PM.start()
function, you can either pass an assistantId directly or use an object with configurations. You can also pass assistantOverrides to include custom data like userId:
javascript
const assistantOverrides = {
variableValues: {
userId: "yourUserIdHere"
}
};
vapi.start("assistant_id_here", assistantOverrides);
This ensures your custom data is sent to the webhook during the call process [Vapi Web SDK Documentation](https://docs.vapi.ai/sdk/web).
2. The vapi.start()
method does not explicitly hold the call until the server responds to the assistant-request webhook. The method returns a promise that resolves to a call object, but the process is asynchronous. The call continues in a state of expectation for data from the server rather than "holding" until webhook feedback is received [VAPI Web SDK Documentation](https://docs.vapi.ai/sdk/web).
3. If your server responds to the assistant-request webhook with a rejection due to insufficient credits, this should prevent billable activity. When configured correctly, if the assistant request is not fulfilled due to insufficient credits, no billable activities such as connecting to a voice assistant or processing the call will occur. The system will reroute the call to a fallback and provide appropriate information to the user [Discord Link](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1341914745661554788).Vapi Support Bot
03/13/2025, 4:13 PMvapi.start()
to conversation beginning, I wasn't able to find complete documentation on this specific flow. Based on the information available, when vapi.start()
is called, it initiates a request to the server and triggers the assistant-request webhook, but the detailed step-by-step sequence isn't fully documented in the materials I have access to.
For your credit validation system, you can implement a server response like:
json
{
"message": {
"type": "assistant-request",
"error": {
"message": "Sorry, you do not have enough credits to process this request."
}
}
}
This should ensure users without credits cannot initiate billable calls.
Sources:
- [Vapi Web SDK Documentation](https://docs.vapi.ai/sdk/web)
- [Discord Link](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1341914745661554788)
- [Server URL documentation](https://docs.vapi.ai/server-url)Williham
03/13/2025, 5:01 PMShubham Bajaj
03/15/2025, 7:47 PMKyle Brunker
03/15/2025, 7:56 PMWilliham
03/16/2025, 9:32 AMKyle Brunker
03/16/2025, 6:20 PMWilliham
03/17/2025, 7:09 AMKyle Brunker
03/17/2025, 11:22 PMWilliham
03/18/2025, 12:19 PMKyle Brunker
03/19/2025, 1:24 AM/call
endpoint, which returns the listenUrl
and controlUrl
within the monitor
object.
Now that we have the user ID and a control URL, you can check the users credit status on your platform. If they are out of credits you could use the controlUrl to say a message and end the call.