RudraRockz
05/29/2025, 12:30 PMVapi Support Bot
05/29/2025, 12:32 PM/api/generate endpoint:
js
app.post("/api/generate", async (req, res) => {
try {
// Your logic here
res.json({ success: true, questions: [] }); // Example response
} catch (e) {
res.status(500).json({ error: "Internal server error" });
}
});
Make sure your server always responds within 7.5 seconds, even on error, to prevent Vapi from crashing your site. This should help you debug if the crash is due to missing or delayed responses.
Reference: [Vapi error handling and server requirements](https://docs.vapi.ai/assistants/personalization#error-handling)
Source:
- [Personalization with user information (Vapi docs)](https://docs.vapi.ai/assistants/personalization)Vapi Support Bot
05/29/2025, 12:32 PM/api/generate endpoint:
js
app.post("/api/generate", async (req, res) => {
try {
// Your logic here
res.json({ success: true, questions: [] }); // Example response
} catch (e) {
res.status(500).json({ error: "Internal server error" });
}
});
Make sure your server always responds within 7.5 seconds, even on error, to prevent Vapi from crashing your site. This should help you debug if the crash is due to missing or delayed responses.
Reference: [Vapi error handling and server requirements](https://docs.vapi.ai/assistants/personalization#error-handling)
Source:
- [Personalization with user information (Vapi docs)](https://docs.vapi.ai/assistants/personalization)Vapi Support Bot
05/29/2025, 12:32 PMtools array should include your function like this:
json
{
"type": "function",
"function": {
"name": "generate_interview",
"parameters": {
"type": "object",
"properties": {
"type": { "type": "string" },
"userId": { "type": "string" }
}
}
},
"async": false,
"server": { "url": "http://192.168.56.1:13000/api/generate" }
}
Your server must respond with:
json
{
"results": [
{ "toolCallId": "X", "result": "Y" }
]
}
Make sure your endpoint is publicly accessible and responds within 7.5 seconds, or the function will fail and may crash the site.
[See the Custom Tools Guide for details.](https://docs.vapi.ai/tools/custom-tools)
Source:
- [Custom Tools Guide](https://docs.vapi.ai/tools/custom-tools)Vapi Support Bot
05/29/2025, 12:32 PMtools array should include your function like this:
json
{
"type": "function",
"function": {
"name": "generate_interview",
"parameters": {
"type": "object",
"properties": {
"type": { "type": "string" },
"userId": { "type": "string" }
}
}
},
"async": false,
"server": { "url": "http://192.168.56.1:13000/api/generate" }
}
Your server must respond with:
json
{
"results": [
{ "toolCallId": "X", "result": "Y" }
]
}
Make sure your endpoint is publicly accessible and responds within 7.5 seconds, or the function will fail and may crash the site.
[See the Custom Tools Guide for details.](https://docs.vapi.ai/tools/custom-tools)
Source:
- [Custom Tools Guide](https://docs.vapi.ai/tools/custom-tools)Vapi Support Bot
05/29/2025, 12:33 PM/api/generate endpoint responds to Vapi's POST request with a valid JSON object like:
json
{ "result": "Your generated interview questions here." }
If your server doesn't respond within 7.5 seconds or returns invalid JSON, the call may fail or crash the site. Double-check your endpoint and error handling.
[See function call handling in the docs.](https://docs.vapi.ai/server-url/events#function-calling)
Source:
- [Vapi Server Events: Function Calling](https://docs.vapi.ai/server-url/events#function-calling)Vapi Support Bot
05/29/2025, 12:33 PM/api/generate endpoint responds to Vapi's POST request with a valid JSON object like:
json
{ "result": "Your generated interview questions here." }
If your server doesn't respond within 7.5 seconds or returns invalid JSON, the call may fail or crash the site. Double-check your endpoint and error handling.
[See function call handling in the docs.](https://docs.vapi.ai/server-url/events#function-calling)
Source:
- [Vapi Server Events: Function Calling](https://docs.vapi.ai/server-url/events#function-calling)Vapi Support Bot
05/29/2025, 12:34 PMVapi Support Bot
05/29/2025, 12:34 PMChiranjeet Mishra
05/30/2025, 10:45 AMRudraRockz
06/01/2025, 2:12 PMChiranjeet Mishra
06/02/2025, 8:52 PM