Salesforce Console Developer Guide
No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
Methods for Chat
Connect with customers or website visitors in real time through Web-based chat.
These methods in Salesforce Classic don’t work for chats routed with Omni-Channel. Chats with Omni-Channel routing use the Methods for Omni-Channel. If you’re using Lightning Experience, use the Methods for Omni-Channel in Lightning Experience.
Note
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
-
acceptChat()
Accepts a chat request. Available in API version 29.0 or later. This method isn't supported with Omni-Channel in API version 37.0 or later. -
cancelFileTransferByAgent()
Indicates that a file transfer request has been canceled by an agent. Available in API version 31.0 or later. -
declineChat()
Declines a chat request. Available in API version 29.0 or later. This method isn't supported with Omni-Channel in API version 37.0 or later. -
endChat()
Ends a chat in which an agent is currently engaged. Available in API version 29.0 or later. -
getAgentInput()
Returns the string of text which is currently in the agent’s text input area in the chat log of a chat with a specific chat key. Available in API version 29.0 or later. -
getAgentState()
Returns the agent's current Chat status, such as Online, Away, or Offline. Available in API version 29.0 or later. -
getChatLog()
Returns the chat log of a chat associated with a specific chat key. Available in API version 29.0 or later. -
getChatRequests()
Returns the chat keys of the chat requests that have been assigned to an agent. Available in API version 29.0 or later. -
getDetailsByChatKey()
Returns the details of the chat associated with a specific chat key. Available in API version 29.0 or later. -
getDetailsByPrimaryTabId()
Returns the details of the chat associated with a specific primary tab ID. Available in API version 29.0 or later. -
getEngagedChats()
Returns the chat keys of the chats in which the agent is currently engaged. Available in API version 29.0 or later. -
getMaxCapacity()
Returns the maximum chat capacity for the current agent, as specified in the agent's assigned agent configuration. Available in API version 29.0 or later. -
initFileTransfer()
Initiates the process of transferring a file from a customer to an agent. Available in API version 31.0 or later. -
onAgentSend()
Registers a function to call when an agent sends a chat message through the Salesforce console. This method intercepts the message and occurs before it is sent to the chat visitor. Available in API version 29.0 or later. -
onAgentStateChanged()
Registers a function to call when agents change their Chat status, such as from Online to Away. Available in API version 29.0 or later. -
onChatCanceled()
Registers a function to call when a chat visitor cancels a chat request. Available in API version 29.0 or later. -
onChatCriticalWaitState()
Registers a function to call when a chat becomes critical to answer or a waiting chat is answered. Available in API version 29.0 or later. -
onChatDeclined()
Registers a function to call when an agent declines a chat request. Available in API version 29.0 or later. -
onChatEnded()
Registers a function to call when an engaged chat ends. Available in API version 29.0 or later. -
onChatRequested()
Registers a function to call when an agent receives a chat request. Available in API version 29.0 or later. -
onChatStarted()
Registers a function to call when an agent starts a new chat with a customer. Available in API version 29.0 or later. -
onChatTransferredOut()
Registers a function to call when an engaged chat is transferred out to another agent. Available in API version 29.0 or later. -
onCurrentCapacityChanged()
Registers a function to call when an agent's capacity for accepting chats changes—for example, if an agent accepts a new chat, ends a currently engaged chat, or otherwise changes the number of chats to which they are assigned, or if a chat request is pushed to their chat queue. Available in API version 29.0 or later. -
onCustomEvent()
Registers a function to call when a custom event takes place during a chat. Available in API version 29.0 or later. -
onFileTransferCompleted()
Registers a function to call when a file is transferred from a customer to an agent. Available in API version 31.0 or later. -
onNewMessage()
Registers a function to call when a new message is sent from a customer, agent, or supervisor. Available in API version 29.0 or later. -
onTypingUpdate()
Registers a function to call when the customer’s text in the chat window changes. If Sneak Peek is enabled, this function is called whenever the customer edits the text in the chat window. If Sneak Peek is not enabled, this function is called whenever a customer starts or stops typing in the chat window. Available in API version 29.0 or later. -
sendCustomEvent()
Sends a custom event to the client-side chat window for a chat with a specific chat key. Available in API version 29.0 or later. -
sendMessage()
Sends a new chat message from the agent to a chat with a specific chat key. Available in API version 29.0 or later. -
setAgentInput()
Sets the string of text in the agent’s text input area in the chat log of a chat with a specific chat key.Available in API version 29.0 or later. -
setAgentState()
Sets an agent's Chat status, such as Online, Away, or Offline. Available in API version 29.0 or later. -
Methods for Chat Visitors
There are a few methods available that you can use to customize the visitor experience for Chat in a custom Visualforce chat window. These methods apply to Salesforce Classic only.