Skip to main content

initiateNewThread

client.chat.initiateNewThread(data: InitiateNewThreadRequest): Promise<ChatThreadInfo>

Initiates a new chat thread or retrieves an existing one.

Creates a new thread if one doesn't exist for the given context, or returns the existing thread. This is the primary entry point for starting a conversation.

Parameters

ParameterTypeRequiredDescription
dataInitiateNewThreadRequestYesThe thread initiation request

Returns

Promise<ChatThreadInfo> — A promise that resolves to the ChatThreadInfo for the new or existing thread

Example

import { CodeBoltClient } from '@codebolt/clientsdk';

const client = new CodeBoltClient();

const result = await client.chat.initiateNewThread(/* InitiateNewThreadRequest */);
console.log(result);