misterb0886
05/08/2024, 8:26 PMVapi Support
05/08/2024, 8:26 PMVapi Support
05/08/2024, 8:26 PMcallID
that can be used for server interactions within a user's web session, the official documentation doesn't provide a direct method to retrieve the callID
from the HTML script tag implementation provided by the GitHub repository you mentioned.
However, based on the discussion in the discord forum [(1)]() , a workaround in such scenarios involves using the Vapi Web SDK [(2)]() or the Vapi Web snippet. While the discussion doesn't directly address retrieving a callID
, it points towards using the SDK for more complex interactions, including server communications.
For server interactions and function calls, consider implementing server-side logic as described in the Server Events documentation [(3)]() . It outlines how to handle function calls, which can be initiated by the voice agent. While the documentation doesn't directly cover fetching a callID
through the HTML script tag method, using the SDK or server-side logic can provide a pathway to achieve your goal.
To have your voice agent call a function on your server and manage interactions based on a callID
, you might need to integrate more deeply with Vapi's backend APIs or SDK functionalities that allow tracking and managing calls, as mentioned in the examples for creating [(4)]() and listing calls [(5)]() . These APIs return detailed call objects, including a callID
, that can be stored and referenced throughout a user's session.
If integrating directly with the Vapi APIs or SDKs is not viable in your scenario, you mightVapi Support
05/08/2024, 8:26 PMcallID
. This method, while not ideal due to potential timing issues, can serve as a workaround until a more direct solution is available.
Keep in mind that for real-time, user-specific interactions, ensuring secure and accurate mapping between web sessions and call IDs is crucial to maintain privacy and data integrity.Sahil
05/09/2024, 9:53 AMmisterb0886
05/09/2024, 1:34 PMVapi Support
05/09/2024, 1:34 PMSahil
05/09/2024, 2:25 PMAayush
05/09/2024, 2:27 PMAayush
05/09/2024, 2:31 PMAayush
05/09/2024, 2:32 PMAayush
05/09/2024, 2:34 PMjs
const vapi = new Vapi("your-public-key");
// Listen for when the call starts
vapi.on("call-start", () => {
// This is where you might capture and store the call ID in the user's session
});
// Listen for when the call ends
vapi.on("call-end", () => {
// Here you can also manage the call ID and associate data return to your web application
});
misterb0886
05/09/2024, 2:37 PM