ConversationCreateResponse
Response for creating a conversation (includes methods)
Extends¶
Properties¶
| Property | Modifier | Type | Description |
|---|---|---|---|
agentId? |
public |
number |
Identifier of the agent used for this conversation |
autogenerateLabel |
public |
boolean |
Whether the conversation label was automatically generated. |
createdTime |
public |
string |
Timestamp indicating when the conversation was created. |
exchanges |
readonly |
ConversationExchangeServiceModel |
Scoped exchange operations for this conversation |
folderId |
public |
number |
Identifier of the folder where the conversation is stored. |
id |
public |
string |
A globally unique identifier for the conversation. |
isLocalJobExecution? |
public |
boolean |
Whether the conversation's job is running locally. |
jobKey? |
public |
string |
Optional job key for conversations that are part of a larger job. |
jobStartOverrides? |
public |
ConversationJobStartOverrides |
Optional configuration options for when the service automatically starts agent job(s). |
label |
public |
string |
The human-readable label or title for the conversation. |
lastActivityTime |
public |
string |
Timestamp indicating when the conversation last had activity. |
orgId |
public |
string |
Identifier of the organization. |
spanId? |
public |
string |
Span identifier for distributed tracing. |
tenantId |
public |
string |
Identifier of the tenant within the organization. |
traceId |
public |
string |
Trace identifier for distributed tracing. |
updatedTime |
public |
string |
Timestamp indicating when any conversation field(s) are updated. |
userId |
public |
string |
Identifier of the user who owns or initiated the conversation. |
Methods¶
delete()¶
delete():
Promise<ConversationDeleteResponse>
Deletes this conversation
Returns¶
Promise<ConversationDeleteResponse>
Promise resolving to the deletion response
Inherited from¶
ConversationGetResponse.delete
endSession()¶
endSession():
void
Ends the active session for this conversation
Sends a session end event and cleans up the session resources.
Returns¶
void
Example¶
Inherited from¶
ConversationGetResponse.endSession
getSession()¶
getSession():
undefined|SessionStream
Gets the active session for this conversation
Returns¶
undefined | SessionStream
The session helper if active, undefined otherwise
Example¶
const session = conversation.getSession();
if (session) {
// Session already started — safe to send exchanges directly
const exchange = session.startExchange();
exchange.sendMessageWithContentPart({ data: 'Hello!' });
}
Inherited from¶
ConversationGetResponse.getSession
startSession()¶
startSession(
options?:ConversationSessionOptions):SessionStream
Starts a real-time chat session for this conversation
Creates a WebSocket session and returns a SessionStream for sending and receiving messages in real-time.
Parameters¶
| Parameter | Type | Description |
|---|---|---|
options? |
ConversationSessionOptions |
Optional session options |
Returns¶
SessionStream for managing the session
Example¶
const conversation = await conversationalAgent.conversations.create(agentId, folderId);
// Start a real-time session
const session = conversation.startSession();
// Listen for responses using helper methods
session.onExchangeStart((exchange) => {
exchange.onMessageStart((message) => {
// Filter for assistant messages
if (message.isAssistant) {
message.onContentPartStart((part) => {
// Handle text content
if (part.isMarkdown) {
part.onChunk((chunk) => console.log(chunk.data));
}
});
}
});
});
// Wait for session to be ready, then send a message
session.onSessionStarted(() => {
const exchange = session.startExchange();
exchange.sendMessageWithContentPart({ data: 'Hello!' });
});
Inherited from¶
ConversationGetResponse.startSession
update()¶
update(
options:ConversationUpdateOptions):Promise<ConversationUpdateResponse>
Updates this conversation
Parameters¶
| Parameter | Type | Description |
|---|---|---|
options |
ConversationUpdateOptions |
Fields to update |
Returns¶
Promise<ConversationUpdateResponse>
Promise resolving to the updated conversation
Inherited from¶
ConversationGetResponse.update
uploadAttachment()¶
uploadAttachment(
file:File):Promise<ConversationAttachmentUploadResponse>
Uploads a file attachment to this conversation
Parameters¶
| Parameter | Type | Description |
|---|---|---|
file |
File |
The file to upload |
Returns¶
Promise<ConversationAttachmentUploadResponse>
Promise resolving to attachment metadata with URI ConversationAttachmentUploadResponse
Example¶
const attachment = await conversation.uploadAttachment(file);
console.log(`Uploaded: ${attachment.uri}`);
Inherited from¶
ConversationGetResponse.uploadAttachment