Skip to content

Chat History

Players can review previous support conversations. Transcripts are retained: every session (active or ended) is discoverable and readable.

Listing sessions

getSessions() returns the player's chat sessions using the platform list convention (limit/offset, default 20, max 100) with deterministic ordering: newest first; lastMessageAt descending, then id as the stable tiebreaker.

typescript
interface ChatSession {
  id: string;
  status: 'ACTIVE' | 'ENDED';
  createdAt: string;      // ISO-8601
  lastMessageAt: string;  // ISO-8601; the sort key
}
javascript
const sessions = await sdk.support.getSessions({ limit: 20, offset: 0 });

Reading a transcript

getHistory() defaults to the active session; pass a sessionId to read any past session.

javascript
const messages = await sdk.support.getHistory();            // active session
const oldMessages = await sdk.support.getHistory('chat_abc123'); // a past session
typescript
interface ChatMessage {
  id: string;
  sender: 'PLAYER' | 'AGENT' | 'SYSTEM'; // closed union
  body: string;
  timestamp: string;                      // ISO-8601
}

Documented exception to the list convention: transcripts paginate with limit/offset (default 20, max 100) but in ascending chronological order; timestamp ascending, then id as the tiebreaker, because a chat transcript reads top-down, oldest first.

text
GIVEN a session with an existing transcript
WHEN getHistory(sessionId?) is called
THEN its messages return oldest-first, paginated per the limit/offset above.

GIVEN no active session and no sessionId
WHEN getHistory() is called
THEN the call rejects with SUPPORT_NO_ACTIVE_SESSION; initialize a chat first.

For live updates, prefer the real-time CHAT_MESSAGE_RECEIVED event; history reads are for catch-up and review, not polling loops.