Newer Version Available

This content describes an older version of this product. View Latest

Events for the Minimized Snap-In

Use the following events in eventHandlerFunction in your minimized snap-in Lightning component.

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

eventName Scenario
chatEndedState Fired when the chat has ended for any reason.
chatState Fired 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.
chatTimeoutUpdate Fired when the visitor idle timeout has started, and every additional second during which the visitor is still idle.
chatTransferringState Fired when the a chat transfer has been initiated.
chatUnreadMessage Fired every time the visitor has received a message from the agent, but the visitor hasn't read it yet.
offlineSupportState Fired when the offline support form has loaded.
prechatState Fired when the pre-chat form has loaded.
postchatState Fired when the post chat form has loaded.
queueUpdate 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.

This event fires only if queue position is enabled for your Snap-ins deployment and your Snap-ins code snippet is version 5.0 or later.

Note

reconnectingState Fired when the visitor has lost connection.
waitingEndedState Fired when the visitor's chat request has failed for any reason.
waitingState 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.

This event fires only if either queue position is disabled for your Snap-ins deployment or your Snap-ins code snippet is version is earlier than 5.0.

Note

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.

eventName Property Type Description
chatEndedState reason string A 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.
chatState agentName string The name of the agent.
agentType string The type of agent handling the chat. Possible values are agent (support agent) and chatbot (Einstein Bots).
chatTimeoutUpdate timeoutSecondsRemaining int The number of seconds remaining until the chat times out due to the visitor being idle for too long.
chatUnreadMessage unreadMessageCount int The number of unread messages.
agentType string The type of agent handling the chat. Possible values are agent (support agent) and chatbot (Einstein Bots).
queueUpdate queuePosition int The visitor’s current place in line.
waitingEndedState reason string A 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.