thenumu
04/16/2024, 5:07 PMVapi Support
04/16/2024, 5:07 PMVapi Support
04/16/2024, 5:07 PMserverUrl
to your external API endpoint. Additionally, you would manage the request details, including the method and body content, on your server or the endpoint that handles the function call from Vapi [(1)]() .
Here's a conceptual example of defining a custom function in your assistant configuration:
json
{
"functions": [
{
"name": "fetchPrediction",
"description": "Fetches prediction from external server",
"parameters": {
"type": "object",
"properties": {
"question": {
"type": "string",
"description": "The question for prediction"
}
}
},
"serverUrl": "https://your-server-url.com/handle-function"
}
]
}
This example does not directly execute the POST request within Vapi but triggers a custom function that should be handled by your server. Your server would then construct and execute the POST request to the external API with the raw JSON body.
Remember that the actual request to the external API, including setting the request method to POST and specifying the JSON body, would be implemented on your server, which receives the function call from Vapi.
For specifics on making HTTP requests from your server, you would use your server-side technology's appropriate HTTP client capabilities, similar to how you might be using Postman or cURL for testing.Vapi Support
04/16/2024, 5:09 PMthenumu
04/16/2024, 5:09 PM