Chat Controller
The primary entry point for integrating the Genesys Cloud chat experience into a host application.
ChatController manages the lifecycle of a chat session, including starting, ending, reconnecting, and presenting the chat UI. The host application creates an instance from a configured MessengerAccount using Builder, and registers a ChatEventListener to receive lifecycle callbacks.
Prerequisites:
A valid MessengerAccount configured with a deployment ID and domain.
A ChatEventListener passed to Builder.chatEventListener before calling Builder.build.
Usage:
val account = MessengerAccount(
deploymentId = "your-deployment-id",
domain = "your-domain.com"
).apply {
logging = true
sessionExpirationNoticeInterval = 300
}
val chatController = ChatController.Builder(context)
.chatEventListener(this)
.build(account, chatLoadedListener)Important: Builder.build initiates the chat session and the chat UI Fragment is delivered via ChatLoadedListener.onComplete. Ensure the account is fully configured before calling it.
Types
Builder for creating and configuring a ChatController instance.
Properties
Functions
Clears the current conversation history from the session.
Destroys this controller and releases all associated resources.
Returns true if ChatController has open chats
Logs out from the current authenticated session.
Reauthorizes the implicit authentication flow with a new token after expiration.
Attempts to reconnect a disconnected chat session.
Start new chat or Continue an open chat. Chat fragment can be provided by the app - as in case of restoring activity
Starts new chat with provided account. Configured as restorable, won't end on UI removal.
Terminates the active chat session and releases the underlying chat handler immediately.
Updates the custom attributes associated with the current chat session.