Configuration
You can initialize the Kustomer SDK with your API key and options.
import KustomerChat from '@kustomer/chat-react-native';
import type { KustomerOptions } from '@kustomer/chat-react-native';
const KUSTOMER_API_KEY = process.env.KUSTOMER_API_KEY; // Your Kustomer API key
const kustomerOptions: KustomerOptions = {
// options for the Kustomer SDK
};
KustomerChat.configure(KUSTOMER_API_KEY, kustomerOptions);
Options
Option | Type | Default | iOS | Android | Description |
---|---|---|---|---|---|
enableUI | boolean | true | ❌ | ❌ | Enables the Kustomer UI. Changing the default value is not yet supported. |
showInAppNotifications | boolean | false | ✅ | ✅ | Show in-app notifications for new messages. |
language | boolean | device | ✅ | ✅ | The language to show volume control, automated messages, snippets, and KB for. |
activeAssistant | string | undefined | ✅ | ✅ | If supplied, always uses this chat assistant ID when pressing new conversation button in the UI. |
hideNewConversationButton | boolean | false | ✅ | ✅ | Never show the "New Conversation" button. |
hostDomain | string | undefined | ✅ | ✅ | Override the API host domain. |
businessScheduleId | string | undefined | ✅ | ✅ | The business schedule ID you want the app to use. |
brandId | string | undefined | ✅ | ✅ | The brand ID for the brand settings you'd like to present. |
logLevel | info, error, debug, warning, all | KustomerLogType.all | ✅ | ✅ | The highest KustomerLogType you want to have printed to the console. |
hideKbArticleShare | boolean | false | ✅ | ✅ | Don't show the Knowledge Base Article Share button. |
hideHistoryNavigation | boolean | false | ✅ | ✅ | Hides back button on conversation detail screen leading to chat history screen. |
iosAnimate5Star | boolean | false | ✅ | ❌ | Show animation when customer selects the highest CSAT rating. |
disablePush | boolean | false | ✅ | ❌ | See details and context in iOS Push Notifications guide. |
pushBundleId | string | app.bundleIdentifier | ✅ | ❌ | The bundle ID for your app, if you need to override the default from your Bundle. |
pushEnvironment | "production", "development" | production | ✅ | ❌ | The PubNub push environment for your app. |
Configuration errors
If for any reason the SDK fails to initialize, you will receive an error as a
Promise
rejection.
KustomerChat.configure(KUSTOMER_API_KEY, kustomerOptions)
.then(() => {
// SDK initialized successfully
})
.catch((error) => {
// SDK failed to initialize
console.error(error); // should contain information about the error
});
Updated almost 2 years ago