Genesys Engage on-premises

 View Only
Discussion Thread View
Expand all | Collapse all

Rich Messaging using Chat Bot

  • 1.  Rich Messaging using Chat Bot

    Posted 02-07-2019 10:49
    Hi,
    I am trying to test using a chat bot (running on BGS server) to send a simple quick-reply rich message back to the client web chat widget. The documentation (Documentation:GWC:Deployment:GWCRM:Current - Genesys Documentation) gives the following example JSON code:

    {
      "type": "Message",
      "contentType": "quick-replies",

      "messageType": "text",
      "text": "Will 3:00PM tomorrow work for you?",
      "content": [
          {"id": "1", "type": "quick-reply", "action": "message","text": "Sounds Good."},
          {"id": "2", "type": "quick-reply", "action": "message","text": "No, sorry."},
          {"id": "3", "type": "quick-reply", "action": "message","text": "What else?"}
        ]
    }

    I am using the following method to send the message back to the web page widget chat:
    sendMessage(ChatMessage message, Enums.Visibility visibility, String receiverId)

    I have tried to add this code to my onSessionActivity() method. I see the message in my web chat widget "Will 3:00PM tomorrow work for you?", but I don't see anything after that. My code is as follows:

    public void onSessionActivity(ChatEventInfo eventInfo) {
      cbpInstance.sendMessage("Hello");

      String contentBody = null;
      contentBody = "{\"type\": \"Message\"," +
        "\"content\": [" +
        "{\"id\": 1, \"type\": \"quick-reply\", \"action\": \"message\",\"text\": \"Sounds Good.\"}," +
        "{\"id\": 2, \"type\": \"quick-reply\", \"action\": \"message\",\"text\": \"No, sorry.\"}," +
        "{\"id\": 3, \"type\": \"quick-reply\", \"action\": \"message\",\"text\": \"What else?\"}]}";

        PlatformExtension platformExtension = cbpInstance.getPlatformExtension();
        ChatMessage newStructuredMessage = null;
        newStructuredMessage = platformExtension.createStructuredMessage("Will 3:00PM tomorrow work for you?");

        newStructuredMessage.setMessageType("Message");
        newStructuredMessage.addStructuredEntry("facebook-messenger", contentBody, "quick-replies", null);

        theLogger.info("About to send structured message");
        cbpInstance.sendMessage(newStructuredMessage, Enums.Visibility.ALL, null);
    }

    Checking the logs, I see the debug message "About to send structured message", but no error after that. (I've copied this part of the log below).

    I'm not sure if I've structured the 'contentBody' variable correctly with the sample JSON data. Also, the documentation mentions to use "facebook-messenger" for the mediaOrigin value. I've added this, as well as put this in my web page widget configuration, eg:

    webchat: {
      dataURL: "http://<my-servers-ip>/gms_port_8010/genesys/2/chat/customer-support",
      apikey: "",
      userData: {
      ChatBotID: "RichMessagingBot",
      ChatBotName: "RichMessagingBot",
      ChatBotHoldup: "true",
      StopBotOnAgentArrival: "true",
      StopBotOnCustomerLeft : "true",
      Visibility : "ALL",
      Nickname : "RichMessagingBot",
      MediaOrigin : "facebook-messenger"
    },
    autoInvite: {
      enabled: false,
      timeToInviteSeconds: 5,
      inviteTimeoutSeconds: 30
    },
      uploadsEnabled: true
    }

    Any help or advice would be greatly appreciated.

    Thank you.



    DMS/BGS Log File:
    2019-02-07T15:29:01.677 Std 45301 (CBP.sess-bot).(RichMessagingBot-RichMessagingBot.00430aE515KD003D.09AGSK2VBH7BE000) INFO [BotLogger] - About to send structured message
    2019-02-07T15:29:01.677 Trc 45311 (CBP.sess-int).(RichMessagingBot-RichMessagingBot.00430aE515KD003D.09AGSK2VBH7BE000) DEBUG [BasicChatClient] - Processing chat event: Chat Event with type=MESSAGE, eventId=10, seconds_from_start=7, userId=00CF5C5C4EB900A9, visibility=ALL, message_text='' [truncated from size (bytes) = 34], msgCheck=NONE, receiverId=null
    2019-02-07T15:29:29.411 Trc 45311 (CBP.sess-int).(RichMessagingBot-RichMessagingBot.00430aE515KD003D.09AGSK2VBH7BE000) DEBUG [BasicChatClient] - Processing chat event: Chat Event with type=NOTICE, eventId=11, seconds_from_start=35, userId=00CF5C5C4EB800A6, visibility=ALL, message_text=null, msgCheck=NONE, noticeText=null, noticeType=TYPING_STARTED, receiverId=null, userData=<output is suppressed>
    2019-02-07T15:29:30.129 Trc 45311 (CBP.sess-int).(RichMessagingBot-RichMessagingBot.00430aE515KD003D.09AGSK2VBH7BE000) DEBUG [BasicChatClient] - Processing chat event: Chat Event with type=MESSAGE, eventId=12, seconds_from_start=36, userId=00CF5C5C4EB800A6, visibility=ALL, message_text='' [truncated from size (bytes) = 3], msgCheck=NONE, receiverId=null
    2019-02-07T15:29:30.333 Trc 45311 (CBP.sess-int).(RichMessagingBot-RichMessagingBot.00430aE515KD003D.09AGSK2VBH7BE000) DEBUG [BasicChatClient] - Processing chat event: Chat Event with type=MESSAGE, eventId=13, seconds_from_start=36, userId=00CF5C5C4EB900A9, visibility=ALL, message_text='' [truncated from size (bytes) = 34], msgCheck=NONE, receiverId=null
    2019-02-07T15:29:30.333 Std 45301 (CBP.sess-bot).(RichMessagingBot-RichMessagingBot.00430aE515KD003D.09AGSK2VBH7BE000) INFO [BotLogger] - About to send structured message
    2019-02-07T15:29:30.348 Trc 45311 (CBP.sess-int).(RichMessagingBot-RichMessagingBot.00430aE515KD003D.09AGSK2VBH7BE000) DEBUG [BasicChatClient] - Processing chat event: Chat Event with type=MESSAGE, eventId=14, seconds_from_start=36, userId=00CF5C5C4EB900A9, visibility=ALL, message_text='' [truncated from size (bytes) = 34], msgCheck=NONE, receiverId=null
    #DigitalChannels
    #Unsure/Other

    ------------------------------
    Pratik Mehta

    ------------------------------


  • 2.  RE: Rich Messaging using Chat Bot

    Posted 02-07-2019 11:00
    Edited by Pratik Mehta 02-07-2019 11:02
      |   view attached
    Just to add to the above, as per documentation, I am using required versions of components:
    Chat Server: 8.5.203.07
    Genesys Mobile Services: 8.5.201.04
    Genesys Widgets: 9.0.006.02

    My goal for this test is for the reply back to the client in the web chat window using Genesys Widgets to look like the image attached.

    Thanks again.

    ------------------------------
    Pratik Mehta
    ------------------------------



  • 3.  RE: Rich Messaging using Chat Bot

    Posted 04-16-2019 13:05
    Hello to everybody!
    Any feedback about this topic? We are having the same problem to send a structured message through Platform SDK. Any hint?
    Thx in advance for your help.

    ------------------------------
    Giuliano Ferri
    Indra Italia spa
    ------------------------------



  • 4.  RE: Rich Messaging using Chat Bot

    Posted 04-17-2019 07:25
    Hi Pratik,
    you didn't specify which SDK you are using.
    Could you add that, please?

    And, more in detail, we found that you are using "PlatformExtension" and "createStructuredMessage" method, but I not founded it in the last java version.

    Thanks
    Gaetano

    ------------------------------
    Gaetano Gala
    Indra Italia spa
    ------------------------------



  • 5.  RE: Rich Messaging using Chat Bot

    GENESYS
    Posted 04-17-2019 11:54
    According to the Genesys product team, Genesys Chat/Widgets doesn't yet support rich messaging.  The rich messaging features in the API are meant to send rich messages to platforms that support it such as Apple Business Chat or Facebook Messenger.  Rich messaging is on the roadmap for Genesys Chat/Widgets, but I have no firm timeframe for when that feature will be available.

    ------------------------------
    Jim Crespino
    Director, Developer Enablement
    Genesys
    https://developer.genesys.com
    ------------------------------



  • 6.  RE: Rich Messaging using Chat Bot

    Posted 04-18-2019 09:06
    Hello Jim,
    thanks for your reply. To be honest, our real requirement is a little bit different because we should provide currently this kind of interface through a mobile app. So, we can manage the rendering of rich messages as we prefer. But, in order to allow a future upgrade to a web interface, we'd like to use the same way to transmit this kind of data to the remote endpoint (app or web).
    So, could you tell us how we can send a structured message through Platform SDK?
    Is there something that we can use now and it will be used when the rich messaging will be supported for Genesys Chat/Widgets?

    Thanks again for your support.

    ------------------------------
    Giuliano Ferri
    Indra Italia spa
    ------------------------------



  • 7.  RE: Rich Messaging using Chat Bot

    GENESYS
    Posted 04-18-2019 12:10
    Giuliano,

    Can you tell me where the Platform SDK comes into play in your architecture?  I assume that you mobile app is probably communicating back to the contact center using Genesys Mobile Services (GMS), correct?  Are you developing a standalone component within the contact center that will use the PSDK to send structure messages to the mobile user?

    Any details you can share would be helpful.  In the mean time I'm tracking down details about the future structured messages that Genesys will support.

    ------------------------------
    Jim Crespino
    Director, Developer Enablement
    Genesys
    https://developer.genesys.com
    ------------------------------



  • 8.  RE: Rich Messaging using Chat Bot

    Posted 04-18-2019 13:59
    Jim,
    you're right, that was not clear!
    The mobile app is communicating to the contact center using GMS and then Chat Server. A routing strategy assign the interaction to a web application developed with PSDK: this web app manages (virtual) agent states (logged in, ready, not ready, logged out), answers the interaction, sends and receives messages to and from the customer (on the mobile app) and closes the interaction or transfers it to a human agent.
    I assume that this web application should be able to send structured messages to the mobile user but we'd like to do that in a standard way.
    Let me know if you need more details.
    Thanks again for your help.

    ------------------------------
    Giuliano Ferri
    Indra Italia spa
    ------------------------------



  • 9.  RE: Rich Messaging using Chat Bot

    GENESYS
    Posted 04-18-2019 15:53
    Giuliano,

    Were you aware that Genesys now has a productized solution for bots called the Genesys Bot Gateway Server (BGS): https://docs.genesys.com/Documentation/BGS.  Not that your approach is invalid, but you might look into it for some time in the future.  BGS can certainly save you from having to have agent seat licenses for your virtual agents.

    With that said, Genesys' approach to rich messaging is done using Standard Responses.  You use the eServices Manager Plug-in for GAX to define standard responses for rich messages.  The standard response is in the form of a JSON object.  Since each messaging platform has a different format, the JSON object allows you to define the properties required by each platform (Facebook, Apple Business Chat, Genesys, etc).

    Your "bot" server would need to pull a rich message standard response from UCS, parse the JSON to find the right object that represents your messaging channel, and then build the chat message response to send.  This will go through your app, through GMS, to the mobile app.

    Your mobile app will receive the chat message from GMS and will need to parse the chat event, recognize that it is a rich message, and display the message appropriately.

    I'll send you a direct message with some pre-release docs on the specifics.

    -Jim

    ------------------------------
    Jim Crespino
    Director, Developer Enablement
    Genesys
    https://developer.genesys.com
    ------------------------------



  • 10.  RE: Rich Messaging using Chat Bot

    Posted 04-19-2019 13:27
    Hello Jim,
    yes, I'm certainly aware of the existence of BGS product, now. But the problem is that we developed this kind of solution for a customer a couple of years ago, when BGS was not available and probably not conceived at all.
    Now, the customer is asking us to add some rich messaging features (mainly quick replies but not only) and we would like to use some standardized way to transmit this kind of information to the endpoint. This is because, between other reasons, we hope that this kind of info could be rendered properly within UCS and in the WDE contact history. At least in a near future.

    Having said that: we're aware that, using Platform SDK, we could get all the info we want from UCS and not only, including standard responses. But our problem is: how we can send this json to the mobile app? We can send it through the standard text in a RequestMessage on basic chat protocol but, in this case, the whole json will be displayed as-is in the contact history.
    Coming back to the first message of this thread, Pratik is using PlatformExtension object but we're not able to find it within PSDK 9.0.001.7, the version we're using for this project.
    Could you try to clarify this point, please?

    Thanks again for your precious help.

    ------------------------------
    Giuliano Ferri
    Indra Italia spa
    ------------------------------



  • 11.  RE: Rich Messaging using Chat Bot

    GENESYS
    Posted 04-22-2019 11:13
    Giuliano & Pratik,

    When you send a RequestMessage, the JSON for your structure message needs to be stored in the EventAttributes property per the documentation I sent to you as a private reply.

    ------------------------------
    Jim Crespino
    Senior Director, Developer Evangelism
    Genesys
    https://developer.genesys.com
    ------------------------------



  • 12.  RE: Rich Messaging using Chat Bot

    Posted 05-29-2020 08:14
    Hi,
    Any chance to have such documentation too?
    Regards

    ------------------------------
    Jorge Cornejo
    Individual Only Contact Account
    ------------------------------



  • 13.  RE: Rich Messaging using Chat Bot