NewWacht Bench is live — AI-assisted development for Wacht

listThreadMessages()

Returns thread message history with optional pagination anchors.

Usage

The following example shows a basic usage of the backend client from @wacht/nextjs/server.

import { wachtClient } from '@wacht/nextjs/server';export async function example() {  const client = await wachtClient();  const threadId: string = 'threadid-123';  const options: { limit?: number; before_id?: string; after_id?: string } = {    limit: 50,  };  return client.ai.listThreadMessages(threadId, options);}

Signature

function listThreadMessages(  threadId: string,  options?: { limit?: number; before_id?: string; after_id?: string },): Promise<ThreadMessagesResponse>

Message query options

threadId: string;
Target actor project thread id.
options: { limit?: number; before_id?: string; after_id?: string };
Optional query/filter object used to shape list/search behavior.
limit?: number | undefined;
limit value used by this request.

Return value

result?: ThreadMessagesResponse | undefined;
Operation result payload.

Examples

AI usage pattern

import { wachtClient } from '@wacht/nextjs/server';export async function loadRecentMessages(threadId: string) {  const client = await wachtClient();  return client.ai.listThreadMessages(threadId, { limit: 50 });}

On this page