Webchat Timeout for inactive interaction

Hi Team,

Is there any timeout to auto close the chat interaction which we can configure incase the Customer is Inactive on website for X mins/ secs?

If yes ? Where and how we can configure the same ?

Regards,
Ameya

Hello,

There is a built-in mechanism to automatically disconnect a customer if he is inactive for a while (15 minutes - but only once the customer is connected to an agent).
See following notice:
No activity auto-disconnect
While connected to an agent, if the guest does not send any messages for 15 minutes, the guest will be automatically disconnected. This timeout only applies while connected to an agent; activity is not required from the guest while waiting in queue.
Taken from https://developer.mypurecloud.com/api/webchat/guestchat.html

Note that this duration is not customizable.

If you wish to do something different, you could achieve it through Widgets customization.

You can subscribe to API events on WebChat or WebChatService and start/manage your own timers (on web client/javascript side).
Ex: WebChat.started for the beginning of the chat
Ex: WebChat.messageAdded or WebChatService.messageReceived (note that these 2 are triggered when you send a response from an ArchitectFlow, when the agent sends a message or when the customer also sends a message - you can analyze the origin if needed via the structure/parameter passed to these 2 API events).

WebChatService events: WebChatService - Genesys Documentation
WebChat events: WebChat - Genesys Documentation

When you decide to terminate the chat, you could call an API command to end the chat (from customer web client/javascript side) using WebChat.endChat or WebChatService.endChat
WebChat command for endChat: WebChat - Genesys Documentation

See here for info on what can be leveraged from CXBus:
https://all.docs.genesys.com/WID/Current/GCAPI/Using_CXBus#Overview

This would be something like this in your widgets customization ("e" would contain information that you can parse to determine who sent the message if you need it):

window._genesys.widgets.onReady = function (QuickBus) {

    localWidgetPlugin = CXBus.registerPlugin('CustomChatPlugin');

    localWidgetPlugin.subscribe("WebChat.started", function (e) {
        ... your code ...
    });

    localWidgetPlugin.subscribe("WebChat.messageAdded", function (e) {
        ... your code ...
    });


    localWidgetPlugin.subscribe("WebChatService.messageReceived", function (e) {
        ... your code ...
    });

};

Regards,

Hello @Jerome.Saint-Marc,

After setting a timer of 10 min of inactivity for example, Would it be possible to send a message to warn the client first that the chat will be closed if he doesn't answer within the following 5 minutes ?

In order to avoid closing the chat window directly.

Regards,

Hello,

Just to make sure it is clear, the answer I gave above is about PureCloud WebChat v2 and Widgets v2.

"After setting a timer of 10 min of inactivity for example, Would it be possible to send a message to warn the client first that the chat will be closed if he doesn't answer within the following 5 minutes ?"

To clarify, the timer I mentioned above ("15 minutes - but only once the customer is connected to an agent") is not configurable at this time.
And it is not possible to have the server send a message warning to the customer.
The Widgets v2 don't include such built-in/native mecanism either at this time.

Also note that when the chat session is ended, the chat window is not closed. The customer receives a message that the session has been ended. But the transcript (chat window) remains opened until the customer closes it.

Now, if the question was about client based customization (as I described above, using javascript, in the web page hosting the Widgets), you could implement a timer on client side.
And if you detect no messages exchanged after 10 minutes (after the customer has been connected to an agent), you could indeed display a message (on client/customer side).
There are different ways to achieve this - with or without Widgets. One possible approach would be to leverage the WebChat.injectMessage command which will add a message in the transcript exposed to the customer. See here for info on the injectMessage command: WebChat - Genesys Documentation

Regards,

1 Like

HI and thank you @Jerome.Saint-Marc for your detailed reply.

I have followed your suggestions about injectMessage and it works just fine.

I have 3 questions:

  • Would it be possible to add a space when the bubble is inserted. As the screenshot shows, if the customer replies to this injected message, it will be inserted directly without spacing ?

  • Would it be possible to change this message from a Data Table, in order to make it simple for business team insted of hardcoding it directly in JS code ?

  • How can I reuse the same agent icon for this injected message ? for now I am just diplaying a blank icon

I really apprciate your help and support.

Thank you,

Regards,

CHARAF

"Would it be possible to add a space when the bubble is inserted. As the screenshot shows, if the customer replies to this injected message, it will be inserted directly without spacing ?"
I don't think so. The space (in fact a margin) seems to come from the css style used when there is an agent/customer message ("cx-participant"). And the css style used when injecting a message ("cx-injected") does not seem to add that margin.

I think it might be better to use a message which does not use the bubble - so it is seen as an automatically generated warning (and does not rely on the style - default or custom - used in the widgets).
Something like this maybe:

CXBus.command('WebChat.injectMessage', {
	type: 'html',
	name: 'Automatic Warning',
	text: '<i><b>Your session will be disconnected in .....</b></i>',
	custom: false
}).done(function(e){
}).fail(function(e){
});

"Would it be possible to change this message from a Data Table, in order to make it simple for business team insted of hardcoding it directly in JS code ?"
No - Not from an Architect Data Table. Remember you are on the public/customer access side and the "customer" is not authenticated on the PureCloud platform (so you can't use the Platform API).
You can still retrieve messages from any system you have, that can expose these
custom messages over a simple HTTP GET or via Web/REST service. In this case, before starting the chat, you could retrieve what you want. Trying to retrieve them while the chat is already started and active is probably not a good idea.

"How can I reuse the same agent icon for this injected message ? for now I am just diplaying a blank icon"
You will have to play with the different options/parameters of the injectMessage command.
I don't have more info than what is on the link I provided in my previous post.
As I also said, I think it would be probably better not to use a bubble for this automatic warning.
If you still want to use it, in order to get the default agent icon, it seems to require:
direction: 'left' and avatar:{ icon: 'agent' } [in the bubble element]

One more comment. As I explained in this thread, the 15 minutes inactivity timer starts when a first agent connects to the chat session.
You could use the WebChatService "agentConnected" event to start your timer on client side (I mean in your Widget custom code).

Regards,

1 Like

@Jerome.Saint-Marc Many thanks for your detailed reply.

I appreciate your explanation and support.

I have followed what you suggested and it works as expected.

I have another question regarding the time displayed after sending each message; is there any chance to change it dynamically from AM/PM to 24 hours if I am using the french i18 JSON file ? since we are deploying the webchat in France and other coutries where the main language is english.

Regards,

I had never paid attention to that option... :slight_smile: , but yes, there is a way to display timestamps in 24 hours format.

In the Widgets App configuration (window._genesys.widgets.main), there is a "timeFormat" option that you can set to 24.
window._genesys.widgets.main.timeFormat = 24;

See here for details on Widgets App level configuration: https://all.docs.genesys.com/WID/Current/SDK/App-combined#Configuration

1 Like

Thank you Jerome.

it works perfectly :+1:

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.