Ivan
08/28/2024, 4:14 PMmessageResponse.results.message.endCallAfterSpokenEnabled
in the API Reference -- https://docs.vapi.ai/api-reference/messages/server-message-response.
But when my server response:
{
"results": [
{
"toolCallId": "call_NAFDN6PoLKFDIZ4x7q7woSo6",
"name": "sayAndEndCall",
"message": [
{
"type": "request-complete",
"role": "assistant",
"endCallAfterSpokenEnabled": true,
"content": "See you later!"
}
]
}
]
}
the call is not ending and Vapi log says:
{
"name": "sayAndEndCall",
"role": "tool_call_result",
"time": 1724858330445,
"result": "No result returned for call_NAFDN6PoLKFDIZ4x7q7woSo6.",
"toolCallId": "call_NAFDN6PoLKFDIZ4x7q7woSo6",
"secondsFromStart": 5.806
}
When I add result
property as mentioned at https://docs.vapi.ai/tools-calling#server-response-format-providing-results-and-context:
{
"results": [
{
"toolCallId": "call_7NaRwuEMR9J7IMdfO1KLteU0",
"name": "sayAndEndCall",
"result": "test",
"message": [
{
"type": "request-complete",
"role": "assistant",
"endCallAfterSpokenEnabled": true,
"content": "See you later!"
}
]
}
]
}
The call is also not ending and logs:
{
"name": "sayAndEndCall",
"role": "tool_call_result",
"time": 1724859397412,
"result": "Success.",
"toolCallId": "call_7NaRwuEMR9J7IMdfO1KLteU0",
"secondsFromStart": 12.731
}
What am I doing wrong? How do I activate this function? Is it implemented on the Vapi side, or is it just outdated documentation?Vapi
08/28/2024, 4:15 PMendCallAfterSpokenEnabled
property to end the call after the message is spoken. However, the issue might be with the structure of your server response. The message
property should be an object, not an array. Here's how you can correct it:
json
{
"results": [
{
"toolCallId": "call_NAFDN6PoLKFDIZ4x7q7woSo6",
"name": "sayAndEndCall",
"message": {
"type": "request-complete",
"role": "assistant",
"endCallAfterSpokenEnabled": true,
"content": "See you later!"
}
}
]
}
Make sure that your server response matches the expected format as per the VAPI documentation. If you've already tried this and it's still not working, it could be an issue on the VAPI side, or there might be additional context required that's not included in your message.
If you're still experiencing issues after making the above adjustment, please ask support for more info on this. They will be able to provide you with the most up-to-date information and assistance.Vapi
08/28/2024, 4:15 PMIvan
08/28/2024, 4:20 PM{
"results": [
{
"toolCallId": "call_NuJd0VIpuTyzt4Cpdr6v6SWo",
"name": "sayAndEndCall",
"message": {
"type": "request-complete",
"role": "assistant",
"endCallAfterSpokenEnabled": true,
"content": "See you later!"
}
}
]
}
Still negative result:
{
"name": "sayAndEndCall",
"role": "tool_call_result",
"time": 1724861862090,
"result": "No result returned for call_NuJd0VIpuTyzt4Cpdr6v6SWo.",
"toolCallId": "call_NuJd0VIpuTyzt4Cpdr6v6SWo",
"secondsFromStart": 9.124
}
Ivan
08/28/2024, 4:28 PMresult
property, and now it works! Thanks!
However, I noticed that the documentation says message
is an array and that result
is not required.
{
"results": [
{
"toolCallId": "call_v4rvcZo1VMW6DxzipcQ2x288",
"name": "sayAndEndCall",
"result": "Success.",
"message": {
"type": "request-complete",
"role": "assistant",
"endCallAfterSpokenEnabled": true,
"content": "See you later!"
}
}
]
}
https://cdn.discordapp.com/attachments/1278387163586625650/1278390646188671120/image.png?ex=66d0a191&is=66cf5011&hm=21c6427bcb6de3319f473268ca2173456d7ec0369634e229661461e1d81934f0&