Genesys Cloud web chat interactions can be handled within Scripting, but linking a Campaign and designing a Workflow to support these interactions is somewhat different from other interaction types.
The described chat functionality has been designed and tested against the Web Chat v2 widget functionality in Genesys Cloud.
1) Configure the Web Chat widget
Within the
configuration JavaScript that is used to instantiate the web chat widget for the customers on your webpage, an additional key needs to be added to the
userData sub-object within its definition. This key consists of a name that needs to match a configuration setting within Scripting, and a value that is used to determine the
Campaign to be launched. The system-wide default key name is
awakenPopCampaign, but this can be altered by editing the value of the database entry in Scripting's
tbl_AppConfig named
Genesys Chat Pop Attribute.
For example:
awakenPopCampaign: "Insurance Queries Campaign",
|
Any customer interacting with this widget would then trigger an attempted pop for a
Campaign Identifier of "Insurance Queries Campaign".
2) Design a Workflow to display and send messages
Whenever a web chat message is sent or received, the contents of the
Script.Data layer are updated with the new message details. Because of this, the minimum scripting to process a web chat interaction is the use of the
chatReply JavaScript function and access to to the Script.Data layer.
Typically, the first step will be to parse the data within the Script.Data layer by stripping out the non-human participants so that it can be used more easily. At this point this can be done by filtering the messages by whether the sender.id matches either the customerChat.id or agentChat.id:
var chatMessages = Script.Data.GetPostDataItem("chatData").messages;
var agentChat = Script.Data.GetPostDataItem("agentChat");
var customerChat = Script.Data.GetPostDataItem("customerChat");
var filteredMessages = chatMessages.messages.filter(function(message) {
return (message.sender.id == agentChat.id || message.sender.id == customerChat.id);
});
|
Once the filter has been performed, the remaining messages will still be in the reverse-chronological order (newest first) within the array - if desired, this is a good moment to reverse the array. The next step is then to process each message for use and/or display in the Workflow. This could be as simple as outputting a plain-text sequence of messages, or as much as generating formatted and styled message bubbles.
Finally, the processed message content needs to be assigned to a Field or Variable so that it can be used or displayed in the Workflow.
Sending messages is simple: add a
Text Box or
Textarea control, and give the agent the ability to trigger the
chatReply JavaScript function that uses the value of that field for the message. The only additional steps required here are then to blank the input field's value, and trigger the refresh to display the new message.
3) Configure the Campaign linkage from the Web Chat feed to the Workflow
Once the Workflow has been designed, a Campaign must be created within Scripting that matches the identifier configured during
Step 1. It is recommended that this Campaign be created using the
Generic integration (so that
Link Columns are available), but an
internal Campaign can be used instead.
It is only possible to retrieve the most recent 100 messages from the conversation. This is a limitation within the Genesys Cloud API itself.
If the web chat widget that the customer is interacting with includes custom attributes (e.g. the customer's name), then these can be accessed in the customerData element of the Script.Data layer.
If no Campaign is popped when a web chat interaction is accepted by the agent, then it should be confirmed that the appropriate key name has been added to the widget's
userData as described in
Step 1, that this key is populated with the appropriate Campaign name, that the Campaign exists and is assigned to a Workflow, and that the Campaign is accessible for the user in question. Enabling the
Show Campaign Warning setting may be useful for troubleshooting.
There is currently no event raised in Scripting that the designer can make use of to trigger automatic refreshes of the message content, but an audible tone is played in the Genesys Cloud frame when a new message is received. As such, it's recommended that the agent has access to a manual "Refresh" button in the Workflow, and this button can also be set to Autoclick immediately when the page loads to perform the initial display.