com.salesforce.android.chat.core.ChatClient |
ChatClient enables the interaction with the Chat Session. Receiving an instance of ChatClient via
the createClient(Context)
method means that the Chat Session has been created
and the calls made to your ChatClient instance will impact the session, or retrieve information
pertinent to the session.
Supported Behavior:
Events supported by AgentListener
:
Events supported by SessionStateListener
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract ChatClient |
addAgentListener(AgentListener agentListener)
Register an
AgentListener with this ChatClient to receive chat messages and
information about the agent. | ||||||||||
abstract ChatClient |
addChatBotListener(ChatBotListener chatBotListener)
Register a
ChatBotListener with this ChatClient to receive menus from a Chat Bot. | ||||||||||
abstract ChatClient |
addFileTransferRequestListener(FileTransferRequestListener fileTransferRequestListener)
Register a
FileTransferRequestListener with this ChatClient to receive File Transfer
Requests from an agent. | ||||||||||
abstract ChatClient |
addQueueListener(QueueListener queueListener)
Register a
QueueListener with this ChatClient to receive queue position updates for the
chat session. | ||||||||||
abstract ChatClient |
addSessionInfoListener(SessionInfoListener sessionInfoListener)
Register a
SessionInfoListener with this ChatClient to receive session information. | ||||||||||
abstract ChatClient |
addSessionStateListener(SessionStateListener sessionStateListener)
Register a
SessionStateListener with this ChatClient to receive state changes for the
chat session. | ||||||||||
abstract void |
endChatSession()
End the chat session.
| ||||||||||
abstract ChatSessionState |
getCurrentSessionState()
Returns the current state of the chat session.
| ||||||||||
abstract ChatClient |
removeAgentListener(AgentListener agentListener)
Unregister an
AgentListener from this ChatClient instance. | ||||||||||
abstract ChatClient |
removeChatBotListener(ChatBotListener chatBotListener)
Unregister a
ChatBotListener from this ChatClient instance. | ||||||||||
abstract ChatClient |
removeFileTransferRequestListener(FileTransferRequestListener fileTransferRequestListener)
Unregister a
FileTransferRequestListener from this ChatClient instance | ||||||||||
abstract ChatClient |
removeQueueListener(QueueListener queueListener)
Unregister a
QueueListener from this ChatClient instance. | ||||||||||
abstract ChatClient |
removeSessionInfoListener(SessionInfoListener sessionInfoListener)
Unregister a
SessionInfoListener from this ChatClient instance. | ||||||||||
abstract ChatClient |
removeSessionStateListener(SessionStateListener sessionStateListener)
Unregister a
SessionStateListener from this ChatClient instance. | ||||||||||
abstract Async<Void> |
sendButtonSelection(ChatWindowButtonMenu.Button button)
Inform the Chat Bot of a button selection by providing the button as received via
onChatButtonMenuReceived(ChatWindowButtonMenu) . | ||||||||||
abstract Async<Void> |
sendButtonSelection(int buttonIndex)
Inform the Chat Bot of a button selection by providing the button index and label as received
via
onChatButtonMenuReceived(ChatWindowButtonMenu) . | ||||||||||
abstract Async<ChatSentMessageReceipt> |
sendChatMessage(String message)
Send a message to the agent.
| ||||||||||
abstract Async<Void> |
sendFooterMenuSelection(ChatFooterMenu.MenuItem menuItem)
Inform the Chat Bot of a footer menu selection by providing the menu item as received via
onChatFooterMenuReceived(ChatFooterMenu) . | ||||||||||
abstract Async<Void> |
sendFooterMenuSelection(int itemIndex, String dialogId)
Inform the Chat Bot of a footer menu selection by providing the menu item index and dialog ID of
the selected item.
| ||||||||||
abstract Async<Void> |
sendMenuSelection(ChatWindowMenu.MenuItem menuItem)
Inform the Chat Bot of a menu selection by providing the menu item as received via
onChatMenuReceived(ChatWindowMenu) . | ||||||||||
abstract Async<Void> |
sendMenuSelection(int itemIndex)
Inform the Chat Bot of a menu selection by providing the menu item index of the selected item.
| ||||||||||
abstract Async<Void> |
sendSneakPeekMessage(String sneakPeekMessage)
Send a message preview to the agent.
| ||||||||||
abstract Async<Void> |
setIsUserTyping(boolean isUserTyping)
Inform the agent whether or not the user is currently typing.
|
Register an AgentListener
with this ChatClient to receive chat messages and
information about the agent.
agentListener | An AgentListener instance |
---|
Register a ChatBotListener
with this ChatClient to receive menus from a Chat Bot.
chatBotListener | A ChatBotListener instance |
---|
Register a FileTransferRequestListener
with this ChatClient to receive File Transfer
Requests from an agent.
fileTransferRequestListener | A FileTransferRequestListener instance |
---|
Register a QueueListener
with this ChatClient to receive queue position updates for the
chat session.
queueListener | A QueueListener instance |
---|
Register a SessionInfoListener
with this ChatClient to receive session information.
sessionInfoListener | A SessionInfoListener instance |
---|
Register a SessionStateListener
with this ChatClient to receive state changes for the
chat session.
sessionStateListener | A SessionStateListener instance |
---|
End the chat session. This will terminate the ChatService.
As a result, any SessionStateListener
instances you have registered with this ChatClient
will be notified with an ChatEndReason
of EndedByClient
.
Returns the current state of the chat session.
Unregister an AgentListener
from this ChatClient instance.
agentListener | An AgentListener instance |
---|
Unregister a ChatBotListener
from this ChatClient instance.
chatBotListener | A ChatBotListener instance |
---|
Unregister a FileTransferRequestListener
from this ChatClient instance
fileTransferRequestListener | A FileTransferRequestListener instance |
---|
Unregister a QueueListener
from this ChatClient instance.
queueListener | A QueueListener instance |
---|
Unregister a SessionInfoListener
from this ChatClient instance.
sessionInfoListener | A SessionInfoListener instance |
---|
Unregister a SessionStateListener
from this ChatClient instance.
sessionStateListener | A SessionStateListener instance |
---|
Inform the Chat Bot of a button selection by providing the button as received via
onChatButtonMenuReceived(ChatWindowButtonMenu)
.
button | The selected button. |
---|
Inform the Chat Bot of a button selection by providing the button index and label as received
via onChatButtonMenuReceived(ChatWindowButtonMenu)
.
buttonIndex | The selected button |
---|
Send a message to the agent. This will also scrub the message text of any sensitive data in accordance with your Salesforce Org's Sensitive Data Rules.
This method returns an Async
Provide a com.salesforce.android.service.common.utilities.control.Async.CompletionHandler
to the Async instance to handle successful delivery of the message. Delivery errors can be handled
by providing a com.salesforce.android.service.common.utilities.control.Async.ErrorHandler.
message | The message text to send |
---|
Inform the Chat Bot of a footer menu selection by providing the menu item as received via
onChatFooterMenuReceived(ChatFooterMenu)
.
menuItem | The selected menu item. |
---|
Inform the Chat Bot of a footer menu selection by providing the menu item index and dialog ID of
the selected item. Available footer menu items are provided via
onChatFooterMenuReceived(ChatFooterMenu)
.
itemIndex | The index of the selected footer menu item |
---|---|
dialogId | The dialog ID of the selected footer menu item from getDialogId() |
Inform the Chat Bot of a menu selection by providing the menu item as received via
onChatMenuReceived(ChatWindowMenu)
.
menuItem | The selected menu item. |
---|
Inform the Chat Bot of a menu selection by providing the menu item index of the selected item.
Menu items are provided via onChatMenuReceived(ChatWindowMenu)
.
itemIndex | The index of the selected menu item. |
---|
Send a message preview to the agent.
This API expects an entire message String to be passed in with each keystroke, and is an
alternative to notifying the agent that the user is typing; this means you do not need to
call setIsUserTyping(boolean)
if you intend to use Sneak Peek during the Chat session.
Sneak Peek is intended for use when an agent is associated with a Live agent Configuration that
has Sneak Peek enabled. You will be notified of this state via the onAgentJoined(AgentInformation)
callback, in which case isSneakPeekEnabled()
will return true.
sneakPeekMessage | A preview message intended for the agent |
---|
Inform the agent whether or not the user is currently typing. This method does not offer a timeout
feature if you pass in a value of TRUE
, so be sure to call this method again with
FALSE
when you have determined that the user has finished typing.
This method returns an Async
isUserTyping | Whether or not the user is currently typing |
---|