Hello Uzai,
Unfortunately, I don't think there is a WDE API Command to send a custom notice.
Sending Notice:Just in case, you can send message or notice (custom notice or push url) from a routing strategy (URS/ORS).
There is an article describing this here:
https://developer.genesys.com/eservices-chat-sending-a-message-from-a-routing-strategy/At WDE level, using Commands (https://docs.genesys.com/Documentation/IW/latest/Developer/Chat), I think you can only send a message or a push url notice.
Chain InteractionChatSendMessage or Chain InteractionChatPushUrl
I don't have an available WDE install at the moment, so I can't check in the dlls (Chat module and Enterprise SDK) or exploring available commands if one was added for Custom Notice or if it is still as the developer guide says.
If there is none for Custom Notice, you might try to check at Enterprise level if there is something that allows sending a custom notice (specifying Notice.Custom or close to this as the type). I think there are some Web Media related methods in the IChatService.
Regarding Push URL:As I said, I unfortunately don't have a working environment right now with WDE, but it would be worth checking the following, in case it works like Custom Notice.
a) Check if PushURL are saved/appear in the transcript sent to a customer.
b) Check if there is something built in WDE InteractionChatPushUrl command that checks if the string is a url or not (to verify if you can just send any text string as a PushUrl).
Widgets:On Widgets side, the messages should indeed trigger the WebChatService.mesageReceived.
All messages (including the ones sent by the customer from the widget) should trigger that handler.
And in the data available in that function, you should find the messages, with their type.
But you could also use the registerPreProcessor command in WebChatService.
The code referenced via this command is triggered before a message is displayed in the chat live transcript (widgets side).
You can manipulate it - either to modify the content or to avoid displaying the message in the customer transcript.
I am not sure the code below will work as is - found it in my computer and it is rather old (old widget version).
But the principle and WebChatService command should be accurate.
In this example, I was using the CustomNotice or Message, but you can use PushUrl as well.
I was checking if the text was starting with a specific prefix, and in that case, modify the message to avoid its display.
You may have to modify the part to avoid the display of the message - if what I am showing below is not enough anymore.
I did the code before Widgets UI was changed to support Accessibility (WCAG 2.1 Level AA).
If what I have written is not enough, you could try with returning null.
The preProcessor code should look like this (more or less):
window._genesys.widgets.onReady = function (QuickBus) {
CXBus.subscribe("WebChatService.ready", function(){
CXBus.command("WebChatService.registerPreProcessor", {
preprocessor: function(oMessage){
console.log("Custom code received a message from WebChatService");
if(oMessage.type && oMessage.text){
if(oMessage.type === "CustomNotice" || oMessage.type === "Message"){
var SURVEY_PREFIX = 'survey:';
if (oMessage.text.indexOf(SURVEY_PREFIX) >= 0)
{
// store the survey url
.....
// Hide message from chat transcript
oMessage.text = "";
// For message type, try "" or "CustomNotice" if empty value doesn't work (I didn't test).
oMessage.type = "CustomNotice";
}
}
}
return oMessage;
}
});
});
}
Hope this will help.
Regards,
------------------------------
Jerome Saint-Marc
Genesys - Employees
------------------------------
Original Message:
Sent: 02-25-2021 08:05
From: Uzay Doksoez
Subject: Sending key/value pairs from WDE to Genesys Chat Widget
Hi Jim,
thank you very much for your response and your suggestion. I started also meanwhile trying to solve the issue on this was after I did not find a way how to solve this with propagated key/value-pairs.
Can you tell me how I can send custom notices from WDE?
How can I handle this on the Widget side, do I need to hook to messageReceivved event from WebChatService or is there any other place to get the custom notice on the widget side?
Thank you for your support.
BR,
Uzay
PS: hope this is not duplicated as I did not see the first response.
------------------------------
BR,
Uzay
Original Message:
Sent: 02-24-2021 11:23
From: Jim Crespino
Subject: Sending key/value pairs from WDE to Genesys Chat Widget
Uzay,
As far as I know the Genesys Widgets do not receive and/or publish events when user data is updated in the contact center. If you want/need to get data to the widget from WDE then you'll need to send an actual chat message from WDE to the web visitor. When you send that message you'll specify that it is a custom notice instead of a standard message. Custom notices are not displayed in the transcript and you can then write a widget plug-in that can intercept that custom notice, pull out the data, and react appropriately.
Hope that helps.
------------------------------
Jim Crespino
Senior Director, Developer Evangelism
Genesys
https://developer.genesys.com
Original Message:
Sent: 02-23-2021 17:00
From: Uzay Doksoez
Subject: Sending key/value pairs from WDE to Genesys Chat Widget
Hi all,
I want to send user data from WDE to Genesys Chat Widget.
Let's consider I prepare some custom code in WDE and set the user data "URS_WidgetKey" with the value "WidgetValue" on the chat interaction.
How can I get this information on the Widget side so I can retrieve in the Widget the key/value-pair "URS_WidgetKey"/ "WidgetValue" which was set by WDE?
Is there any mechanism in place I can use?
I checked a lot of documentation on CXBus and WebChat and WebChatService but was not able to find anything how we can send data from WDE to the Widget.
Is there any advice someone can give me how to send information from WDE to Genesys Chat Widget?
Thank you very much for your support,
Uzay
#DigitalChannels
#GenesysEngageDev
#Implementation
------------------------------
BR,
Uzay
------------------------------