Hi,
how can I tell if the interaction was ended by the agent? Wtih widget
Hi,
how can I tell if the interaction was ended by the agent? Wtih widget
Hi epsantos,
If you're working with the API, you can identify the agent participant of the conversation and then check the 'disconnectType' property. If it's either 'client' or 'endpoint' it should mean that the agent was the one that disconnected the interaction.
You can see all possible disconnect reasons here:
HI Prince,
I'm not using api, but the widget, can you help me identify this in the widget?
Hello,
There is no metadata propagated in the WebChatService.ended event that specifies if the chat was ended by the customer or by the Genesys Cloud platform (Disconnect action in Architect flow, timeout, Contact Center agent).
https://all.docs.genesys.com/WID/Current/SDK/WebChatService-combined#API_Events
You could try to monitor WebChatService events.
But I think the easiest way would be to leverage the CXBus before command on WebChatService.endChat.
What I mean is that if the customer ends the chat (clicking/requesting to end the chat via the Widgets UI while the chat is active), this will trigger the WebChatService.endChat command.
Via Widgets API, it is possible to interrupt a command (executing some custom code just before the Widgets command is processed). You can do this using the before command.
See here for the description of that before command: https://all.docs.genesys.com/WID/Current/SDK/GWCBusAPIOverview#oMyNewPlugin.before
And here for an example: https://developer.mypurecloud.com/api/webchat/widget-version2.html#intercept_and_override_data_based_on_before___method
In your case, you would leverage the before command on "WebChatService.endChat" (instead of "WebChat.open").
Then, you could update a local/custom javascript variable in this custom code (var customerRequestedEndChat = false; - updated to true in the custom code triggered via the before command on WebChatService.endChat).
Then, subscribing to the WebChatService.ended event (like here), when you receive this event, you could evaluate that custom variable and know if the chat was ended by the customer (customerRequestedEndChat == true), or by the Genesys Cloud platform (Disconnect action in Architect flow, timeout, Contact Center agent).
Regards,
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.