create

Creates a new thread -if permitted by the configuration- and returns a handler for it. threads should return this new instance even if it's not created on the server yet.

Whenever the configuration doesn't permit creating new threads, this method throws CXOneException in response. In cases where the configuration permits only a single thread, the method requires the client to first call threads with a listener. This is to ensure proper validation of creating threads. Please note that you have to perform this action on every new ChatThreadsHandler as it exclusively remembers its own state.

The ChatThreadsHandler instance remembers at most one thread that contains no messages (i.e. is not created on the server).

Return

A new instance of ChatThreadsHandler.

See also

Throws

when configuration doesn't permit creation of additional threads. This exception is never thrown for multi thread configurations.

when the configuration permits only a singular thread and threads method wasn't called before call of this method, or the thread list fetch didn't yet complete. This exception is never thrown for multi thread configurations.

when the configuration requires answers for items in preChatSurvey.

in case of internal SDK error.

in case of internal SDK error.


open fun create(customFields: Map<String, String>): ChatThreadHandler

Creates a new thread -if permitted by configuration- and returns a handler for it. threads should return this new instance even if it's not created on the server yet.

Whenever configuration doesn't permit creating new threads, this method throws CXOneException in response. In cases where configuration permits only singular thread, the method requires the client to first call threads with a listener. This is to ensure proper validation of creating threads. Please note that you have to perform this action on every new ChatThreadsHandler as it exclusively remembers its own state.

The ChatThreadsHandler instance remembers at most one thread that contains no messages (i.e. is not created on the server).

Return

A new instance of ChatThreadsHandler.

Parameters

customFields

An initial map of custom-field key-values specific to this new thread. These custom-fields can be used for personalization during thread creation (e.g.: for a welcome message) and will be sent with a first outbound message. Possible source is from a pre-chat static survey.

See also

Throws

when configuration doesn't permit creation of additional threads. This exception is never thrown for multi thread configurations.

when the configuration permits only singular thread and threads method wasn't called before call of this method, or the thread list fetch didn't yet complete. This exception is never thrown for multi thread configurations.

when the configuration requires answers for items in preChatSurvey.

if a value in customFields is invalid for any reason.

if a key in customFields is not defined by the channel configuration.


open fun create(preChatSurveyResponse: Sequence<PreChatSurveyResponse<out FieldDefinition, out Any>>): ChatThreadHandler

Creates a new thread -if permitted by configuration- and returns a handler for it. threads should return this new instance even if it's not created on the server yet.

Whenever configuration doesn't permit creating new threads, this method throws CXOneException in response. In cases where configuration permits only singular thread, the method requires the client to first call threads with a listener. This is to ensure proper validation of creating threads. Please note that you have to perform this action on every new ChatThreadsHandler as it exclusively remembers its own state.

The ChatThreadsHandler instance remembers at most one thread that contains no messages (i.e. is not created on the server).

Return

A new instance of ChatThreadsHandler.

Parameters

preChatSurveyResponse

Iterable sequence of responses to items in preChatSurvey. The sequence has to contain responses to all items in PreChatSurvey which have the flag FieldDefinition.isRequired set to true.

See also

Throws

when configuration doesn't permit creation of additional threads. This exception is never thrown for multi thread configurations.

when the configuration permits only singular thread and threads method wasn't called before call of this method, or the thread list fetch didn't yet complete. This exception is never thrown for multi thread configurations.

when the configuration requires answers for items in preChatSurvey and those were not supplied, or supplied answer is not valid (non-leaf com.nice.cxonechat.state.HierarchyNode for FieldDefinition.Hierarchy).

in case of internal SDK error.

in case of internal SDK error.


abstract fun create(customFields: Map<String, String>, preChatSurveyResponse: Sequence<PreChatSurveyResponse<out FieldDefinition, out Any>>): ChatThreadHandler

Creates a new thread -if permitted by configuration- and returns a handler for it. threads should return this new instance even if it's not created on the server yet.

Whenever configuration doesn't permit creating new threads, this method throws CXOneException in response. In cases where configuration permits only singular thread, the method requires the client to first call threads with a listener. This is to ensure proper validation of creating threads. Please note that you have to perform this action on every new ChatThreadsHandler as it exclusively remembers its own state.

The ChatThreadsHandler instance remembers at most one thread that contains no messages (i.e. is not created on the server).

Return

A new instance of ChatThreadsHandler.

Parameters

customFields

An initial map of custom-field key-values specific to this new thread. These custom-fields can be used for personalization during thread creation (e.g.: for a welcome message) and will be sent with a first outbound message. Possible source is from a pre-chat static survey.

preChatSurveyResponse

Iterable sequence of responses to items in preChatSurvey. The sequence has to contain responses to all items in PreChatSurvey which have the flag FieldDefinition.isRequired set to true.

See also

Throws

when configuration doesn't permit creation of additional threads. This exception is never thrown for multi thread configurations.

when the configuration permits only singular thread and threads method wasn't called before call of this method, or the thread list fetch didn't yet complete. This exception is never thrown for multi thread configurations.

when the configuration requires answers for items in preChatSurvey and those were not supplied, or supplied answer is not valid. (non-leaf com.nice.cxonechat.state.HierarchyNode for FieldDefinition.Hierarchy).

if a value in customFields or preChatSurveyResponse is invalid for any reason.

if a key in customFields is not defined by the channel configuration.