KustomerCore.init()

Initializes chat by fetching your chat settings and business schedules.

πŸ‘

First, initialize chat

You must initialize with KustomerCore.init() before you can execute any additional Core SDK methods

Examples

// Initialize chat
KustomerCore.init();


// Initialize chat with options and then fetch conversations
KustomerCore.init({
  brandId: 'SOME_BRAND_ID',
  scheduleId: 'SOME_SCHEDULE_ID'
}, function (chatSettings) {
  console.log(chatSettings);

  KustomerCore.getConversations();
});

Syntax

KustomerCore.init(options, function(callbackResponse, error))

Parameter

Type

Description

options

Object

Optional

These are options that you can pass in to modify how your chat initializes. All possible options are listed below.

function(callbackResponse, error)

Function

Optional

A callback that is run after Kustomer.init() completes.

callbackResponse is an object returned to the callback function. See the callbackResponse section below to see the properties of the object.

error is either undefined or a native JavaScript Error object.

options

Property

Type

Description

brandId

string

Optional

By passing in a brandId you can override the default brand setting in your Kustomer Chat Settings.

scheduleId

String

Optional

By passing in a scheduleId, you can override the default schedule setting in your Kustomer Chat Settings.

assistantId

String

Optional

By passing in an assistantId, you can override the default assistant setting in your Kustomer Chat Settings.

callbackResponse

Property

Type

Description

settings

Object

Required

This is your Kustomer instance's chat settings, containing properties like your teamName and teamIconUrl. A sample settings object is shown below.

settings

{
  activeAssistant: "SOME_ASSISTANT_ID",
  brandId: "SOME_BRAND_ID",
  closableChat: true,
  colors: {},
  embedIconColor: "#6e89a0",
  embedIconUrl: "SOME_ICON_URL",
  teamIconUrl: "SOME_URL",
  teamName: "Gap",
  greeting: "Greetings!",
  knowledgeBaseId: "SOME_KB_ID",
  noHistory: false,
  offhoursImageUrl: "SOME_URL",
  offhoursMessage: "SOME_URL",
  showBrandingIdentifier: true,
  singleSessionChat: false,
  volumeControl: {
    enabled: true,
    followUpChannels: [],
    hideWaitOption: false,
    markDoneAfterTimeout: true,
    mode: "upfront",
    promptDelay: 60,
    timeout: 300,
    upfrontWaitThreshold: 60,
    useDynamicWaitMessage: false
  },
  waitMessage: "Wait Message",
  widgetType: "chat-kb",
}

Did this page help you?