Events for Chat

JavaScript can be executed when certain types of events occur in a console, such as when a user closes a tab. A few events are specific to Chat. These events apply to Lightning Experience only.

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. For Lightning Console JavaScript API, use Lightning Web Component Events for Enhanced Messaging or Aura Events for Enhanced Messaging.

Important

  • lightning:conversationAgentSend

    Event triggered when an agent sends a chat message through the Salesforce console. This method does not intercept the message before it’s sent to the chat visitor. This event is also triggered when using Enhanced Messaging channels.

  • lightning:conversationChatEnded

    Event triggered when an active chat ends or an agent leaves a chat conference. This event is also triggered when using Enhanced Messaging channels.

  • lightning:conversationCustomEvent

    Event triggered when a custom event occurs during a chat.

  • lightning:conversationNewMessage

    Event triggered when the customer sends a new message. This event is also triggered when using Enhanced Messaging channels. To work with Enhanced Messaging channels, the session must be active and the Enhanced Conversation Component must be visible on the page.