Configuration
Learn how to initialize chat with or without options.
You can initialize the Chat iOS SDK with or without options. See Installation, Quick Start to learn how to configure chat during installation.
Initialize the SDK
To initialize the SDK, call Kustomer.configure
in your AppDelegate didFinishLaunchingWithOptions
method:
import KustomerChat
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
Kustomer.configure(apiKey: "api key", options: nil, launchOptions: launchOptions)
}
Initialize the SDK with options
You can also initialize the SDK to configure the SDK with options.
import KustomerChat
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let options = KustomerOptions()
options.activeAssistant = .orgDefault
options.brandId = "nonDefaultBrand"
options.hideNewConversationButtonInClosedChat = true
//see full api docs for all options
Kustomer.configure(apiKey: "api key", options: options, launchOptions: launchOptions)
}
Initialize the SDK and detect low disk space
You can use an optional completion
parameter with configure to detect if there is not enough disk space. If there isn't enough disk space the UI will display a message, and chat will not load.
Kustomer.configure(apiKey: "API KEY", options: options, launchOptions: launchOptions, completion: { error in
if case KustomerConfigurationError.notEnoughDiskSpace = error {
print("Not enough disk space")
}
})
KustomerOptions
class reference
KustomerOptions
class reference
KustomerOptions
API attributesFor additional configuration options for initialization, see the full list of all available
KustomerOptions
API attributes.
Parameter | Description |
---|---|
activeAssistant | The chat assistant ID. If available, Chat always uses this chat assistant ID as the assistant when a new conversation is created with a button in the chat. Does not affect the Kustomer Core SDK. Options: - none : Chat does not use an assistant.- orgDefault : Chat uses the default assistant set for the brand under Chat Management settings.- .withId(String) : Chat uses the provided string as the assistant ID.Format example: options.activeAssistant = .withId("1234") |
brandId | Provides a Brand ID to fetch brand-specific chat settings. |
businessScheduleId | |
enableUI | Enables the Kustomer Chat UI. Defaults to true . Set to false if you're building your own UI. |
hideHistoryNavigation | Option to hide the back button in the Conversation view. This allows customers to have multiple chats open at the same time and bypass the Conversation (chat history) view when appropriate. Defaults to false . Set to true to hide the back button in the Conversation view. |
hideNewConversationButtonInClosedChat | |
hostDomain | |
knowledgeBaseId | Overrides the Knowledge Base id. This method has been deprecated. Use brandId instead to fetch brand-specific chat settings, including a brand-specific Knowledge Base. |
language | Kustomer uses the device language as the default language. To change the default language, pass in the desired language locale. See Localization for supported language locales and instructions to change the default language or to add a new localization. |
logLevels | The type of error logs available. To learn more, see KustomerLogType. Defaults to [.debug, .info, .error, .warning] .Set to [] to disable logging.multithreadingWarning is ignored if you're using our UI. |
messageAttachmentLocalCacheMaximumSizeInBytes | Maximum space for local caching of files and images sent over chat messages. |
pushBundleId | Optional |
pushEnvironment | Optional |
showAnimationFor5StarCSATRatings | Controls the chat animation displayed to customers for 5-star CSAT ratings. Defaults to false . Set to true to turn on the CSAT animation. |
showInAppNotifications | Show notifications in-app when a new message arrives. |
hideKbArticleShare | Option to hide the share option from the UI that lets you open help articles in a browser. |
Updated 8 months ago
What’s Next