Webchat v2 - Prevent customer to start writing before agent connected

Hi,
Using WebChat v2.
When the customer starts a chat session by clicking on the Chat icon, he can then immediately
start typing a first message, even though the no agent connected yet.
And it makes no difference whether the widget is setup to distribute to a queue or to a chat flow.
Is there a way to prevent that ?
Is there an event (like an 'agent joined' event) that could be used to only allow user input at that time ?
Any hint welcome.

Thanks

The documentation covers the events available, one of those is agent joined: https://developer.mypurecloud.com/api/digital/webchat/widget-version2.html#chat_start_and_end_events

However, I don't think you can block the user from typing in a message. That's not a typical behavior for a chat widget that a customer would expect - is there a specific reason why you want to add that restriction?

Hi,
Thanks for your answer.
This customer is involved in social related activities. They really want to avoid the situation where the chatter is requesting / calling for help, and this chat does not get answered because there's no 'agent' available at that time.
Thanks

The way we've seen this request be implemented is by showing/hiding the widget based on agent availability. Could be by leveraging EWT or via other methods, like checking against an SLA that a particular queue may have, or by checking against schedules. Note that those APIs do require authorization and as such cannot be done completely on a website alone.

Hi,
Thanks Lucie.
I think I will try to deactivate the typing zone when the chat session starts and reactivate it when the agent connects, using the corresponding events.
Have a good day.

Hi,
Following my own post.
I got what the customer wants using this code in the widget config file:

// Create a plugin (or reuse your own if you have one already)
var oPlugin = CXBus.registerPlugin("myPlugin");

oPlugin.subscribe('WebChatService.clientConnected', function(){
console.log("client connected");
document.getElementById("cx_input"). disabled = true;
});

oPlugin.subscribe('WebChatService.agentConnected', function(){
console.log("agent connected");
document.getElementById("cx_input"). disabled = false;
});

1 Like

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