Genesys Cloud WebSocket notifications offer event data that we need for logging into communication history.

Basic procedure

We just need to implement in backend the 5 steps described in https://developer.genesys.cloud/notificationsalerts/notifications/ after endpoint /customers/supportInteraction is called from BOFE (I think it is done by VL guys). Following are some additional points.

  1. Reference https://developer.genesys.cloud/authorization/platform-auth/use-saml2-bearer for details for step 1, in which we can get the access token, which we need in other steps. We already have the client id and client secret, which are needed in step 1.

  2. In step 4, we only subscribe topic v2.detail.events.conversation.{id}.acw, more details at https://developer.genesys.cloud/notificationsalerts/notifications/available-topics#v2-detail-events-conversation--id--acw

  3. After receiving the notification events, we summit the data to CommunicationHistory-manager by calling its endpoint. Similar function has been implemented in /customers/supportResult of Backoffice-manager. We need to move the functionality to Genesys-gateway as it is no more useful in Backoffice-manager. At last we unsubscribe the topic.

Things to take care of or pay attention to

  1. There is a limit of 20 channels per user/app combination. Creating a 21st channel will remove the channel with oldest last used date. Channels without an active connection will be removed first.
    Solution: Don’t worry about this. Given that 1 channel can subscribe to 1000 topics, it is highly unlikely we will have 20,000 conversation going on at the same time.

  2. Channels remain active for 24 hours. To maintain a channel for longer than 24 hours, resubscribe to topics.
    Solution: Recreate a new channel and subscribe to the topics that the closing one has subscribed to , once receiving the closing message

  3. Each WebSocket connection is limited to 1,000 topics.
    Solution: Keep the the number of subscribed topics, create another channel once the number becomes bigger than 1000. And close the channel once the number becomes 0.

  4. Each channel can only be used by one WebSocket at a time. If you connect a second WebSocket with the same channel ID, the first WebSocket disconnects.

  5. We can subscribe and unsubscribe topics over WebSockets besides over APIs, that could be helpful for the implementation.

    • {"message":"subscribe","topics":["v2.detail.events.conversation.4fce4357-7abc-44b9-81e5-64e1e9e0ccf1.acw"],"correlationId":"12"}

    • {"correlationId":"12","topics":["v2.detail.events.conversation.4fce4357-7abc-44b9-81e5-64e1e9e0ccf1.acw"],"result":"200","status":"subscribed","message":"Successfully subscribed to topic(s)."}

    • {"message":"unsubscribe","topics":["v2.analytics.conversations.details.jobs.availability"],"correlationId":"12"}

    • {"correlationId":"12","topics":["v2.analytics.conversations.details.jobs.availability"],"result":"200","status":"unsubscribed","message":"Successfully unsubscribed from topic(s)."}

  6. WebSockets can be closed occasionally for maintenance.
    Solution: Recreate a new channel and subscribe to the topics that the closing one has subscribed to , once receiving this closing message

  7. WebSocket constantly gives heartbeat messages.

{"topicName": "channel.metadata", "eventBody": {"message": "WebSocket Heartbeat"}}