Genesys Engage on-premises

 View Only

Discussion Thread View
  • 1.  Sending key/value pairs from WDE to Genesys Chat Widget

    Posted 02-23-2021 17:01
    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
    ------------------------------


  • 2.  RE: Sending key/value pairs from WDE to Genesys Chat Widget

    GENESYS
    Posted 02-24-2021 11:23
    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
    ------------------------------



  • 3.  RE: Sending key/value pairs from WDE to Genesys Chat Widget

    Posted 02-25-2021 08:29
    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
    ------------------------------



  • 4.  RE: Sending key/value pairs from WDE to Genesys Chat Widget

    GENESYS
    Posted 03-02-2021 05:00
    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
    ------------------------------



  • 5.  RE: Sending key/value pairs from WDE to Genesys Chat Widget

    Posted 03-02-2021 06:04
    Hi Jerome,

    thank you for your response.

    I tried the way with the PushURL. The drawback here is that the string sent is displayed in the agent's transcript which is not really what we want to have.
    I must find a way to send a message which is displayed neither in the customer's nor in the agent's transcript.

    I found one way which might help sending a Notify request with TypingStopped, but this an event which might occur to often to be registered and handled only in some cases.

    Do you think WDE will add the string when I use PushURL but sending the request not through a command chain but directly using PSDK Request Notify?

    Do you think we could use Update User Data service and have a hook on the widget side?
    https://docs.genesys.com/Documentation/GMS/latest/API/ChatAPIv2#scrollNav-12

    As you might feel I'm currently running out of ideas how to get the info from WDE to the Widget.

    Hope for any input which brings me forward.

    BR,
    Uzay

    ------------------------------
    BR,
    Uzay
    ------------------------------



  • 6.  RE: Sending key/value pairs from WDE to Genesys Chat Widget

    GENESYS
    Posted 03-02-2021 08:23
    Hello,

    PushUrl and CustomNotice will always be displayed on Agent side (WDE active chat). I don't think there is a way around this.
    What Jim meant by CustomNotice not displayed and what I meant by PushUrl were related to the historical transcript - the one stored in UCS. When the transcript is extracted, processed and sent to customer via email, it is possible that custom notice do not appear there (and possibly PushUrl - but as I said I am not sure and it needs to be verified).
    But it will always be there in the WDE active chat.
    I don't even know if you can manipulate this in WDE via customization. As the Chat module just displays the messages it receives over the chat channel/protocol.

    Regarding TypingStarted/TypingStoppped, as far as I know, the WDE Command does not allow you to set a string/value. It is just an "event" reflected on customer chat (widget) and agent chat (WDE) displaying that agent started/stopped typing or customer started/stopped typing.
    You could try doing this at lower level - Enterprise SDK or PSDK Chat protocol if it exposes a method and if it is possible (there is a string attribute - which is always set to is typing or something like that). The widget probably just cares about the type of chat (Notice.TypingStarted) and probably not about the content of the string.

    "Do you think WDE will add the string when I use PushURL but sending the request not through a command chain but directly using PSDK Request Notify?"
    I am not sure I understand the question. The chat message and the notice (custom, pushUrl, typing started, typing stopped) are sent via WebChat protocol (I mean FlexChat or BasicChat - connection to ChatServer). If ever you send a push url via PSDK Chat Protocol, I think WDE will display it as it just automatically displays messages it receives via its connection to ChatServer. I don't have a way to verify/test it not having an environment with WDE at this time.

    Regarding the Update User Data on GMS side:
    I don't think it will do what you need/want. As you can see in the response example (link you have sent), the request allows you to have the customer side request an update of user data. But the response does not propagate back all/any user data. It is just meant to allow a customer side to update data, not read them.
    There is also a widget command for update of user data - based on that GMS API request: https://docs.genesys.com/Documentation/GWC/latest/WidgetsAPI/WebChatServiceCommands#scrollNav-10
    You can still give it a try in case something changed since the time I tried it (a year or two ago). But chances it propagates all user data back is low (I mean user data set by widget + user data set/updated on Genesys routing or agent desktop).

    So as I wrote above, I don't think there is a way (or not a way I am aware of going really deep in WDE customization) which will allow you to hide messages/notices/pushurl on agent side (WDE).
    But on customer side, you can try to hide them with the method I have proposed - doing a widget customization and leveraging the WebChatService.registerPreProcessor.

    Regards,

    ------------------------------
    Jerome Saint-Marc
    Genesys - Employees
    ------------------------------



Need Help finding something?

Check out the Genesys Knowledge Network - your all-in-one access point for Genesys resources