Is there a way to finish the call with a webhook?
# support
v
Yes, you can end a Vapi call via webhook by sending a control message to the call's WebSocket. If you're using WebSocket transport, send this JSON message to the call's WebSocket URL:
Copy code
json
{ "type": "end-call" }
This will immediately terminate the call. For more details, see the [Vapi WebSocket transport documentation](https://docs.vapi.ai/calls/websocket-transport). Source: - [WebSocket Transport](https://docs.vapi.ai/calls/websocket-transport)
v
You can definitely end a call via webhook by hitting Vapi’s PATCH /calls/{callId} endpoint with the proper payload—this often works more reliably than the in-prompt tool. I’ve helped others implement this to auto-end calls when certain events fire. Do you want me to share the exact request format and best practices for handling it? Let’s connect and go through it together. @Francisco
f
thanks so much for the quick reply, yes, please, I would really appreciate it if you could share the request format, I'm using Google Apps Script to handle the webhook.
v
Great to hear! Since you’re on Google Apps Script, I can help you set up the exact request and get everything working end-to-end. This goes a bit deeper than a quick answer, so the best way is if we continue privately and I’ll guide you directly through it. @Francisco
f
thanks, I already send you a message
@User Support Bot
c
Hi Francisco, To implement a webhook that triggers after a call ends, you can define it within your workflow using post-call events like
Call.ending
as a trigger. This can be managed by creating a hook at the workflow level. Here's a brief guide on how you can achieve this: 1. **Define a Hook**: Set up a hook within your workflow to listen for the
Call.ending
event. This allows actions to be performed right after a call concludes. 2. **Configure Actions on Hook**: Within the hook, you can specify actions such as posting data to a webhook URL. This action can be specified using
do
with a function action to execute the webhook call. 3. **Use Conditional Execution (if needed)**: If you only want the webhook to be triggered under certain conditions, use
CallHookFilter
to define those conditions. For more detailed guidance, you can refer to the [Vapi July 11, 2025 Changelog](https://docs.vapi.ai/changelog/2025/7/11) where these features are further explained. This setup provides a flexible way to integrate custom handling of call end events in your workflows.
2 Views