amazon-connect / amazon-connect-chatjs

Amazon Connect ChatJS - a browser-based contact center integration API for Chat on the Agent and Customer side.
https://docs.aws.amazon.com/connect/latest/adminguide/what-is-amazon-connect.html
Apache License 2.0
91 stars 53 forks source link

Support for `chatSession.onParticipantLeft()` #223

Closed yen-tt closed 2 weeks ago

yen-tt commented 2 weeks ago

Hi team,

I would like to request support for an event handler function for application/vnd.amazonaws.connect.event.participant.left event, similar to the current provided functions for the idle and returned state (onParticipantIdle() and onParticipantReturned).

I'm building a custom UI for the chat session and currently relying on onEnded to handle when the session is no longer active. However that only trigger when the connection closes 15 minutes after the agent left. It would very useful to be able to subscribe to the event when the agent first left the chat session (end chat / close contact).

Thank you

mhiaror commented 2 weeks ago

onMessage callback should expose this event today.

Please take a look at the sample app for reference on how to use participant.left event. https://github.com/amazon-connect/amazon-connect-chat-interface/blob/fadafdf9b43d56dbf96bc5bfd888c6240c5c76a5/src/components/Chat/ChatTranscriptor/ChatMessages/SystemMessage.js#L30