Lightning Web Components for Embedded Service
Pre-Chat UI
Events for the Minimized Chat Window
Minimized Component Code Samples
Get Settings from the Embedded Service Code Snippet
Multiple Components with Lightning Out
Code Snippet Versions
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
| eventName | Scenario |
|---|---|
chatConferenceState | Fired in the following scenarios:
|
chatEndedState | Fired when the chat has ended for any reason. |
chatState | Fired in the following scenarios:
|
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 | This 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:
|
reconnectingState | Fired when the visitor has lost connection. |
waitingEndedState | Fired when the visitor’s chat request has failed for any reason. |
waitingState | This 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 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 |
|---|---|---|---|
chatConferenceState | agentsInChat | array of strings | A list of the agents in the chat conference. |
chatConferenceState | agentName | string | The name of the agent who is joining or leaving the chat conference. |
chatConferenceState | isAgentJoining | boolean | A boolean indicating whether an agent is joining (true) or leaving (false) the chat conference. |
chatEndedState | reason | string | A description of why the chat ended. Possible values include:
|
chatState | agentName | string | The name of the agent. |
chatState | 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. |
chatUnreadMessage | 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:
|