chukarslan
02/01/2025, 12:47 PMAtlas
02/01/2025, 12:48 PMVapi
02/01/2025, 12:50 PM{{questions}}
from your frontend to the VAPI assistant, you'll need to ensure that your frontend is correctly capturing the variable and then sending it as part of the API request to VAPI.
Here's a simplified example of how you might implement this:
1. Capture the {{questions}}
variable in your frontend code.
2. Make an API request to VAPI and include the {{questions}}
variable in the request body or as a query parameter.
For instance, if you're using JavaScript and AJAX to make the API call, it might look something like this:
javascript
// Assume `questions` is the variable you want to pass to the VAPI assistant
let questions = getQuestionsFromUserInput(); // Your function to get the questions
// Prepare the API request
let apiRequestData = {
type: "assistant-request",
call: {
// ... other call object properties
questions: questions // Add the dynamic variable here
}
};
// Make the API call
$.ajax({
url: 'https://api.yourvapiendpoint.com/call', // Replace with your actual VAPI endpoint
type: 'POST',
contentType: 'application/json',
data: JSON.stringify(apiRequestData),
success: function(response) {
// Handle success
console.log('Questions sent to VAPI assistant:', questions);
},
error: function(error) {
// Handle error
console.error('Error sending questions to VAPI assistant:', error);
}
});
Make sure that your backend is configured to accept this variable and pass it to the VAPI assistant accordingly. If you're still having trouble, please ensure that:
- The variable name in the API request matches what the VAPI assistant expects.
- The variable is being correctly serialized and included in the API request.
- Your VAPI assistant is configured to handle dynamic variables passed in the request.
If you've checked all of these and the issue persists, please ask support for more info on this.Vapi
02/01/2025, 12:50 PMVapi
02/01/2025, 12:51 PMchukarslan
02/02/2025, 1:33 PMShubham Bajaj
02/03/2025, 10:19 AMShubham Bajaj
02/04/2025, 11:09 AMchukarslan
02/09/2025, 3:05 PMKyle
02/10/2025, 6:04 AM