Start a new conversation for a customer.

Use Kustomer.createConversation() to open the chat widget and take the customer to a new conversation. You can optionally start the conversation with an initial message.

This method is useful when you need to hand off a response from a web form to the chat widget.


First, initialize chat fully

Kustomer Chat must finish initializing fully with Kustomer.start() before you can execute any additional Web SDK methods.

Tip: Call other methods inside the callback of Kustomer.start() to ensure Kustomer Chat always completes initialization before the code tries to run other methods.

To learn more, see Troubleshooting: Kustomer method calls won't execute.


When using a Conversational Assistant

The message value will be used in response to the first question in your Conversational Assistant. If you have set the first question as a Button Question or Data Attribute Question for an attribute that is a Tree type, users will be required to select an option before the Conversational Assistant continues.


We're provided some examples of how you can call Kustomer.createConversation():


Pass a message parameter to create a conversation

You must pass in a value for the message parameter in options with Kustomer.createConversation() to create a conversation in Kustomer.

// Create a conversation. This takes the user to the conversation thread but does not create the conversation in Kustomer.


// Create a conversation with a callback to run after a conversation has successfully been created in Kustomer.

  assistantId: "SOME_ASSISTANT_ID",  
  message: "I need some help"
  customAttributes: {
    some_custom_attribute: 'some_custom_value'
function (response, error) => {
  if (error) {
    console.log("handle the error")
  } else { 
    console.log("handle the response")


Kustomer.createConversation(options, function(response, error))

An object containing an initial message, assistantId and/or custom attributes for the conversation.

This object can be empty if an initial message, an assistantId, or custom attributes are not needed.
function(callbackResponse, error)FunctionOptional

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



This message will be passed into the conversation when it starts. It will either be the initial message or in response to a conversational assistant.

By passing in an assistantId, you can override the assistant to be used when starting the new conversation.

An object containing the custom attributes of the conversation.


custom options attribute

Before you can update a custom attribute with Kustomer.createConversation(), the custom attribute must first exist on the Customer Klass in your Kustomer organization.

You can learn more about Klasses and custom attributes in the Kustomer Help Center.

  message: 'A message value',
  assistantId: 'some_assistant_id',
  customAttributes: {
    some_custom_attribute: 'some_custom_value',
    some_custom_attribute2: 'some_custom_value2'


conversationIdstringUnique id of the newly created conversation
createdAtstringtimestamp representing the date and time the conversation was created
endedbooleanDetermines whether or not the conversation has been ended
isInAssistantModebooleanIndicates if the conversation is currently in assistant mode and the customer is interacting with a conversational assistant.