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))
Parameter | Type | Description |
---|---|---|
options | Object | Optional An options object allowing you to modify this method call. All possible options are listed below. |
function(callbackResponse, error) | Function | Optional 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
callbackResponse
Property | Type | Description |
---|---|---|
assistant | String | Required The assistant unique ID. |
dialog | String | Required The assistant dialog unique ID. |
node | String | Required The assistant node unique ID. |
initialMessages | Array | Required 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 |
attributes | Object | Required An object containing information about the assistant. Example: {avatarUrl: String, publicName: String } |
initialMessages
initialMessages
// initialMessages
[
{
meta: {
template: Object
},
direction: String,
directionType: String,
importedAt: String,
trackingId: String,
lang: String,
}
]
Updated almost 4 years ago