Hello Marija,
in the webmessaging API, this event should give you all details you need
https://developer.genesys.cloud/commdigital/digital/webmessaging/websocketapi#conversation-disconnect
I don't get it what missing to address your use case ? if the disconnect is done by the agent it will be notify in the event ("human")
------------------------------
Frederic Thomas
Senior Manager, Development
------------------------------