Bridging interface between the hosting App and the chat SDK. The ChatController provides APIs to enable hosting Apps to create and manage chats.
ChatControler is created with a builder class. The builder can be configured with providers and listeners, that will be used by the ChatController during the chat progress, to pass events and notifications to the hosting App and to trigger App’s actions in some cases.
ChatController creation also triggers the creation and start of the configured chat as was provided to the Builder.build, AccountInfo parameter. The ChatController instance may be used for multiple chats creation.
👉 First chat starts with the ChatController creation, no need to call
startChatto activate it.
After ChatController instance creation, chats can be started with
startChat, which defines a new chat, or with
restoreChat that can be used to continue a previous ongoing chat.
With the ChatController instance, the hosting App can end active chats.
endChat, to end the current active chat.
forceClose = truecan be passed, for fast chat closure. When force closing live chat, postchat form will not be activated.
terminateChat, to end all current active chats.
e.g., Bot chat was escalated to live chat. In order to close both bot and escalated chats we use
Once the ChatController has no more active chats, it passes a
StateEvent.Idle, to its attached
In order to release the ChatController’s resources, use
ChatController instance can no longer be used to create/manage chats. Any usage attempt will end with
ChatController destruction, releases resources and listeners, but does not ends the open chats. Ending active chats (
terminateChat) should be activated by the hosting App prior to ChatController destruction.