Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  Web Messaging Guest API - End-user Disconnect

    Posted 2 days ago

    Hello,

    We are using Web Messaging channel. A widget has been developed using the Web Messaging Guest API. We are not using the out of the box Genesys widget for Web Messaging.

    The problem is that when end-user closes the custom developed chat widget (there are buttons within the widget that he/she can select), conversation is not terminated and remains active. As a result, it is finally routed to an agent, agent sends messages that are delivered.

    The same issue is not observed when using the out of the box widget, as if the end-user selects to end the conversation (by choosing the garbage icon in the upper side of the widget window), this actually terminates the conversation immediately.


    Is there a way to modify the custom developed widget in order to terminate the conversation properly?


    Thank you,
    Orestis.


    #PlatformAPI
    #PlatformSDK
    #WebMessaging

    ------------------------------
    Orestis Dimitropoulos
    ------------------------------


  • 2.  RE: Web Messaging Guest API - End-user Disconnect

    Posted 2 days ago

    Hi Orestis,

    From my understanding, closing a custom widget (or WebSocket) doesn't terminate the conversation, as web messaging is designed to be persistent.

    When the user clicks your "End Chat" button, you'd need to trigger a clear/disconnect action behind the scenes to properly end the conversation.

    If needed, this could also be handled via the Platform API (e.g., PATCH /api/v2/conversations/messages/{conversationId} to set the state to disconnected), but typically this logic should sit behind that button in your custom widget.

    Hope this helps and someone might add more to this.



    ------------------------------
    Phaneendra
    Technical Solutions Consultant
    ------------------------------



  • 3.  RE: Web Messaging Guest API - End-user Disconnect

    Posted 2 days ago

    Hello Phaneendra,

    Thank you for the prompt response.

    That can be a problem. Ideally, we would like to do that without using the Platform API. We were hoping that Web Message Guest API offers such a capability. Reviewing the relevant documentation and considering your update as well, it seems that this is not something we can accomplish.



    ------------------------------
    Orestis Dimitropoulos
    ------------------------------



  • 4.  RE: Web Messaging Guest API - End-user Disconnect

    Posted 2 days ago

    Hi Orestis,

    From my understanding, closing a custom widget (or WebSocket) doesn't terminate the conversation, as web messaging is designed to be persistent.

    When the user clicks your "End Chat" button, you'd need to trigger a clear/disconnect action behind the scenes to properly end the conversation.

    You might find these helpful:

    These don't cover custom widget implementation directly, but they do explain the behaviour you'll need to replicate.

    Hope someone from community has done this or might have a different approach to this.



    ------------------------------
    Phaneendra
    Technical Solutions Consultant
    ------------------------------



  • 5.  RE: Web Messaging Guest API - End-user Disconnect

    Posted yesterday

    I believe this can be interesting. As far as i understand, the custom widget should send something like this in order to terminate the conversation? Can someone verify that? If that is so, we do not need to invoke Platform API.

    {
      "action": "onMessage",
      "message": {
        "type": "Event",
        "events": [
          {
            "eventType": "Presence",
            "presence": {
              "type": "Clear"
            }
          }
        ]
      },
      "tracingId": "11111111-1111-1111-1111-111111111111",
      "token": "0000000-0000-0000-0000-0000000000"
    }



    ------------------------------
    Orestis Dimitropoulos
    ------------------------------



  • 6.  RE: Web Messaging Guest API - End-user Disconnect

    Posted yesterday

    You are correct, this is the event used by the out of the box messenger 



    ------------------------------
    Laurent Rustuel
    Lead Software Engineer
    ------------------------------



  • 7.  RE: Web Messaging Guest API - End-user Disconnect

    Posted yesterday

    @Laurent Rustuel thank you for confirming and hopefully this will work for you Orestis Dimitropoulos



    ------------------------------
    Phaneendra
    Technical Solutions Consultant
    ------------------------------