Skip to content

ChatKitEvents

type ChatKitEvents = {
chatkit.error: CustomEvent<{
error: Error;
}>;
chatkit.log: CustomEvent<{
data?: Record<string, unknown>;
name: string;
}>;
chatkit.response.end: CustomEvent<void>;
chatkit.response.start: CustomEvent<void>;
chatkit.thread.change: CustomEvent<{
threadId: string | null;
}>;
chatkit.thread.load.end: CustomEvent<{
threadId: string;
}>;
chatkit.thread.load.start: CustomEvent<{
threadId: string;
}>;
};

DOM events emitted by the openai-chatkit custom element.

chatkit.error: CustomEvent<{
error: Error;
}>;

Emitted when an error occurs. You should log these for monitoring and debugging.


chatkit.log: CustomEvent<{
data?: Record<string, unknown>;
name: string;
}>;

Diagnostic events that can be used for logging/analytics.


chatkit.response.end: CustomEvent<void>;

Emitted when the assistant finishes sending a response.


chatkit.response.start: CustomEvent<void>;

Emitted when the assistant begins sending a response.


chatkit.thread.change: CustomEvent<{
threadId: string | null;
}>;

Emitted when the active thread changes. Use this along with initialThread to persist the current thread across page loads or sessions.


chatkit.thread.load.end: CustomEvent<{
threadId: string;
}>;

Emitted when ChatKit finished loading a thread.


chatkit.thread.load.start: CustomEvent<{
threadId: string;
}>;

Emitted when ChatKit starts loading a thread (initial load or selected from history).