Open the chat UI
Learn how to open and show the Kustomer Chat widget / UI with the Chat iOS SDK.
Open the Kustomer Chat UI to let the customer view their chat history, start a new chat, and browse the Knowledge Base. You can also configure the Chat Widget Experience from the Kustomer Chat Management: Design settings.
We've included examples of different ways to open and show the chat widget to the customer.
Open the chat UI
Opens the chat UI.
Kustomer.show()
Open the chat UI with Chat settings
Opens the chat UI with settings from the Chat Management page in Kustomer.
Kustomer.show(preferredView: .default) //Same as `Kustomer.show()`
Open the chat UI to a new conversation
Opens the chat UI to a new conversation with Chat settings from the Chat Management page in Kustomer.
Kustomer.show(preferredView: .newChat)
- 'Kustomer.show(preferredView: .newChat)' functions similarly to the "New conversation" button in the chat widget UI.
- For example, if you turn on "Restrict to single open chat" in the Kustomer Chat Management settings, and the customer has an existing open chat,
Kustomer.show(preferredView: .newChat)
opens the existing open chat.
Open the chat UI to an active chat or create a new chat
Opens to an existing active chat if the customer has an existing open chat. Otherwise, creates and opens a new conversation for the customer.
Kustomer.show(preferredView: .activeChat)
Open the chat UI to the conversation history
Opens the chat UI to display the conversation history of the customer. Uses the Chat Widget Experience settings in the Kustomer Chat Management: Design settings to determine if the chat widget will display a tab bar.
Kustomer.show(preferredView: .chatHistory)
Open the chat UI to the conversation history without tab bar
Opens the chat UI to display the conversation history of the customer and hides the bottom tab bar.
Kustomer.show(preferredView: .onlyChat)
Open the chat UI to the Knowledge Base
Opens the chat UI to the Knowledge Base. Uses the Chat Widget Experience settings in the Kustomer Chat Management: Design settings to determine if the chat widget will display a tab bar.
Kustomer.show(preferredView: .knowledgeBase)
Open the chat UI to the knowledge base without tab bar
Opens the chat UI to the Knowledge Base and hides the bottom tab bar.
Kustomer.show(preferredView: .onlyKnowledgeBase)
Open the chat UI to the knowledge base home
Opens the chat UI to the Knowledge Base. Will always open at the root Knowledge Base category. Otherwise, the Knowledge Base will open where the user had last navigated to in the Knowledge Base.
Kustomer.show(preferredView: .knowledgeBaseHome)
Open the chat UI with a conversational assistant
Opens the chat UI with a specific conversational assistant.
New chats open with your the default conversational assistant for your Kustomer organization. You can also specify the chat assistant based on the assistant id.
Kustomer.openChatAssistant(id: "123", completion: {r in
switch r {
case .success:
print("opened chat assistant")
case .failure(let error):
print(error.localizedDescription)
}
})
You can copy the conversational assistant id from the Conversational Assistants page in Kustomer (go to Settings > Kustomer IQ > Conversational Assistants).
To learn more, see Introduction to Conversational Assistants.
Passing the Presenting View Controller (v2.5.4+)
All methods to show the Kustomer Widget can take a reference to a "presentingVC". It's best practice to pass a reference to the view controller that is "showing" the Chat UI in this parameter. If no view controller is passed, the Kustomer widget will attempt to find the currently shown view controller so it can present itself.
Updated 8 months ago