Events for the Minimized Chat Window

Use the following events in eventHandlerFunction in your minimized Embedded Service Aura component.

The legacy chat product is in maintenance-only mode, and we won’t continue to build new features. You can continue to use it, but we no longer recommend that you implement new chat channels. Instead, you can modernize your customer communication with Messaging for In-App and Web. Messaging offers many of the chat features that you love plus asynchronous conversations that can be picked back up at any time.

Important

eventHandlerFunction is called with two positional arguments, eventName and eventData.

Below are the possible values for eventName and the corresponding scenario.

Some events are fired multiple times per scenario. Avoid writing logic that can’t be safely executed multiple times.

Note

eventNameScenario
chatConferenceStateFired in the following scenarios:
  • An agent joins a one-on-one chat, which becomes a chat conference.
  • An agent joins a chat conference.
  • An agent leaves a chat conference.
  • There are two agents in a chat conference. One agent leaves the conference, which becomes a one-on-one chat.
chatEndedStateFired when the chat has ended for any reason.
chatStateFired in the following scenarios:
  • The visitor’s chat request has been accepted and they’re chatting with an agent.
  • After starting a chat, the visitor navigates to another page and resumes chatting.
  • A chat transfer has completed (see chatTransferringState), and the visitor is now chatting with the new agent.
  • The visitor had previously lost connection (see reconnectingState) and has regained it.
chatTimeoutUpdateFired when the visitor idle timeout has started, and every additional second during which the visitor is still idle.
chatTransferringStateFired when the a chat transfer has been initiated.
chatUnreadMessageFired every time the visitor has received a message from the agent, but the visitor hasn’t read it yet.
offlineSupportStateFired when the offline support form has loaded.
prechatStateFired when the pre-chat form has loaded.
postchatStateFired when the post chat form has loaded.
queueUpdateThis event fires only if queue position is enabled for your Embedded Service deployment and your Embedded Service code snippet is version 5.0 or later. It’s fired in the following scenarios:
  • The visitor has requested a chat and is waiting for an agent.
  • After requesting a chat, the visitor navigates to another page, but is still waiting for an agent.
  • The visitor had previously lost connection (see reconnectingState) and has regained it.
  • The visitor has advanced in the queue, but is still waiting for an agent to accept the chat request.
  • A bot or agent has requested a chat transfer and is waiting for another agent to accept.
  • During a chat transfer, the visitor navigates to another page, but is still waiting to be transferred.
  • The visitor has advanced in the queue, but is still waiting for an agent to accept the chat transfer.
reconnectingStateFired when the visitor has lost connection.
waitingEndedStateFired when the visitor’s chat request has failed for any reason.
waitingStateThis event fires only if either queue position is disabled for your Embedded Service deployment or your Embedded Service code snippet is version is earlier than 5.0. It’s fired in the following scenarios:
  • The visitor has requested a chat and is waiting for an agent.
  • After requesting a chat, the visitor navigates to another page but is still waiting for an agent.
  • The visitor had previously lost connection (see reconnectingState) and has regained it.

The eventData is an object that contains the default localized label for the event. For some events, it contains additional values. Below are the possible additional values for eventData.

eventNamePropertyTypeDescription
chatConferenceStateagentsInChatarray of stringsA list of the agents in the chat conference.
chatConferenceStateagentNamestringThe name of the agent who is joining or leaving the chat conference.
chatConferenceStateisAgentJoiningbooleanA boolean indicating whether an agent is joining (true) or leaving (false) the chat conference.
chatEndedStatereasonstringA description of why the chat ended. Possible values include:
  • agentEndedChat– The agent ended the chat.
  • visitorConnectionError– The visitor lost connection for too long.
  • visitorEndedChat– The visitor ended the chat.
  • visitorTimeout– The visitor was idle too long and the chat timed out.
chatStateagentNamestringThe name of the agent.
chatStateagentTypestringThe type of agent handling the chat. Possible values are agent (support agent) and chatbot (Einstein Bots).
chatTimeoutUpdatetimeoutSecondsRemainingintThe number of seconds remaining until the chat times out due to the visitor being idle for too long.
chatUnreadMessageunreadMessageCountintThe number of unread messages.
chatUnreadMessageagentTypestringThe type of agent handling the chat. Possible values are agent (support agent) and chatbot (Einstein Bots).
queueUpdatequeuePositionintThe visitor’s current place in line.
waitingEndedStatereasonstringA description of why the visitor’s chat request failed. Possible values include:
  • agentsUnavailable– All agents were unavailable, or an agent declined the chat request.
  • connectionError– The chat request failed for any other reason.
  • visitorBlocked– The visitor’s IP address has been blocked.