Allows you to retrieve a chat session by its unique identifier within Scoopika. This can be useful for accessing specific session info like its ID and user ID.

This method does not return the actual session history (runs or messages), But it returns a StoreSession object, to get the session’s runs, refer to getSessionRuns.

Arguments

id
string
required

The session ID to retreive.

allow_new
boolean
default: true

This optional argument controls the behavior when the specified session ID is not found. When set to true the method will create a new session with the provided ID if it doesn’t already exist. However, it’s generally recommended to set allow_new to false to ensure retrieval of existing sessions only. This helps prevent unintended session creation in cases where you specifically want to access an existing one.

Return Value

response
Promise<StoreSession>

Returns a Promise that resolves to a StoreSession object containing information about the retrieved session, including its ID, user ID (if available), user name (if available), and saved prompts (if any).

Reference to StoreSession