listMessages
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
| Param | Type | Notes | Description |
|---|---|---|---|
credentials | FlowstackCredentials | required, since 0.2.2 | The authenticated caller's credentials. |
withUserKey | string | required, since 0.2.2 | The counterpart's user key. |
options.limit | number | default 50, since 0.2.2 | Max messages to load (max 200). |
options.before | string | since 0.2.2 | Cursor: return messages created before this id/timestamp (pagination). |
config | FlowstackClientConfig | required, since 0.2.2 | Client config. Must include appScope. |
Returns
| Field | Type | Description |
|---|---|---|
| — | 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);Critical
body 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.