KustomerCore.initAssistant()

Fetch the details of a conversational assistant so you can initialize

👍

First, initialize chat

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

Examples

// Initialize an assistant 
KustomerCore.initAssistant({
  assistant: 'SOME_ASSISTANT_ID',
}, function (initAssistantPayload, error) {
  console.log('Started assistant!');
});

Syntax

KustomerCore.initAssistant(options, function(callbackResponse, error))
ParameterTypeDescription
optionsObjectOptional

An options object allowing you to modify this method call. All possible options are listed below.
function(callbackResponse, error)FunctionOptional

A callback that is run after KustomerCore.initAssistant() 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.

callbackResponse

PropertyTypeDescription
assistantStringRequired

The assistant unique ID.
dialogStringRequired

The assistant dialog unique ID.
nodeStringRequired

The assistant node unique ID.
initialMessagesArrayRequired

An array of initial messages of the conversational assistant. See below for the structure of what one of these initial messages in the array looks like
attributesObjectRequired

An object containing information about the assistant. Example:

{avatarUrl: String, publicName: String }

initialMessages

// initialMessages

[
  {
    meta: {
      template: Object
    },
    direction: String,
    directionType: String,
    importedAt: String,
    trackingId: String,
    lang: String,
  }
]