SlaviSavanovic
04/22/2025, 2:55 PMVapi Support Bot
04/22/2025, 2:58 PMadd-message
type via API
The most direct way is to send a message before ending the call using the add-message
type:
sh
# First send the message
curl -X POST "https://aws-us-west-2-production1-phone-call-websocket.vapi.ai/$CALL_ID/control" \
-H 'content-type: application/json' \
--data-raw '{
"type": "add-message",
"message": {
"role": "assistant",
"content": "Thank you for your time. I will end this call now. Goodbye!"
},
"triggerResponseEnabled": true
}'
# Wait for message to be spoken
sleep 2
# Then end the call
curl -X POST "https://aws-us-west-2-production1-phone-call-websocket.vapi.ai/$CALL_ID/control" \
-H 'content-type: application/json' \
--data-raw '{
"type": "end-call"
}'
This approach ensures the message is spoken before the call ends, as mentioned in the [documentation](https://discord.com/channels/1211482211119796234/1296705973737488505).
### 2. Using the endCallMessage
parameter
The endCallMessage
parameter defines the message the assistant will speak when it decides to end the call, as noted in the [outbound sales documentation](https://docs.vapi.ai/examples/outbound-sales).
### 3. Using the say
method with endCallAfterSpoken
You can use the say
method with the endCallAfterSpoken
parameter set to true
to gracefully end the call after a message is spoken:
json
{
"say": "Thank you for your time. Goodbye!",
"endCallAfterSpoken": true
}
This requires implementing logic to detect when objectives are met and then triggering the say
method, as mentioned in the [documentation](https://discord.com/channels/1211482211119796234/1336004944150401166).Vapi Support Bot
04/22/2025, 2:58 PMmessages
list in the endCall
object
Looking at your attached image, you can see that the endCall
object includes a messages
list. This list can contain objects that define messages to be spoken while the tool is running. You can customize these messages for the endCall
tool.
For example, similar to how the "voicemail" tool uses a "request-complete" message:
json
"messages": [
{
"type": "request-complete",
"content": "Thank you for your time. Goodbye!",
"endCallAfterSpokenEnabled": true
}
]
Is there anything specific about these methods you'd like me to elaborate on?
Sources:
- [Discord: Using the say
method with endCallAfterSpoken
](https://discord.com/channels/1211482211119796234/1336004944150401166)
- [Vapi Documentation: Outbound Sales Example](https://docs.vapi.ai/examples/outbound-sales)
- [Discord: Using add-message
via API](https://discord.com/channels/1211482211119796234/1296705973737488505)
- [Discord: Voicemail tool example with messages list](https://discord.com/channels/1211482211119796234/1336548894896816222)SlaviSavanovic
04/24/2025, 12:36 PMShubham Bajaj
04/25/2025, 8:16 PMShubham Bajaj
04/25/2025, 8:55 PMSlaviSavanovic
04/25/2025, 8:59 PMSlaviSavanovic
04/26/2025, 4:47 PMKyle Brunker
04/27/2025, 8:56 PM