When a call is ended on your end, such as the recipient ends the call or the user ends the call from your UI, we'll need to be notified to close the phone widget in Upsales.
If your app does not use the Pickup webhook, Upsales also checks the /ongoing endpoint every 10 seconds during a call and closes the widget when no call is returned. If your app uses the Pickup webhook, Upsales does not check /ongoing during the call, so the Hangup webhook is what closes the widget.
To tell Upsales that you want to control the hangup flow, add the capability hangupHook to your config json.
"capabilities": {
"hangupHook": true
}
Initiate a manual run of your app to notify Upsales that a phone call has been hung up by the recipient. Include the userId of the user who is on the call: Upsales sends the event to that user only. Add a notification property to the body to trigger the correct event.
{
"notification": {
"event": "phone.hangup",
"data": {}
}
}
Upsales first sends the manual run to your app's /external endpoint. The hangup event is sent only after your app answers that request with status 200 or 201.