Docs / built-apps / listMessages

listMessages

utilitysince 0.2.2

Client function: list messages in the caller's thread with a counterpart. ACL'd server-side.

import { listMessages } from 'flowstack-sdk'

Non-React client function backing useMessages. Lists messages in the caller's thread with withUserKey. Reads are ACL'd to thread participants. config must carry an appScope.

Signature

listMessages(credentials, withUserKey, options?, config?): Promise<ApiResponse<{ messages: DmMessage[]; count: number }>>

Parameters

ParamTypeNotesDescription
credentialsFlowstackCredentialsrequired, since 0.2.2The authenticated caller's credentials.
withUserKeystringrequired, since 0.2.2The counterpart's user key.
options.limitnumberdefault 50, since 0.2.2Max messages to load (max 200).
options.beforestringsince 0.2.2Cursor: return messages created before this id/timestamp (pagination).
configFlowstackClientConfigrequired, since 0.2.2Client config. Must include appScope.

Returns

FieldTypeDescription
Promise<ApiResponse<{ messages: DmMessage[]; count: number }>>{ ok, data: { messages, count }, error }.

Examples

List messages
const res = await listMessages(credentials, counterpartKey, { limit: 50 }, { appScope });
if (res.ok) console.log(res.data.messages);
Criticalbody on each DmMessage is UNTRUSTED user input. Render as text / sanitized markdown, never raw HTML.

See also

useMessages · sendMessage · DmMessage

Source: README.md#private-messaging-dms · Also available in llms-full.txt and registry.json.