openThread
Client function: record the caller's consent to open a DM thread with another user.
import { openThread } from 'flowstack-sdk'Non-React client function backing useThreads().openThread. Records the caller's consent to open a thread with withUserKey. The thread becomes open (sendable) only once BOTH parties have consented; until then it is pending. Idempotent per caller. config must carry an appScope, and the caller's credentials must include a userId.
Signature
openThread(credentials, withUserKey, config?): Promise<ApiResponse<{ pair_key: string; status: string }>>Parameters
| Param | Type | Notes | Description |
|---|---|---|---|
credentials | FlowstackCredentials | required, since 0.2.2 | The authenticated caller's credentials (must include userId). |
withUserKey | string | required, since 0.2.2 | The counterpart's user key. |
config | FlowstackClientConfig | required, since 0.2.2 | Client config. Must include appScope. |
Returns
| Field | Type | Description |
|---|---|---|
| — | Promise<ApiResponse<{ pair_key: string; status: string }>> | { ok, data: { pair_key, status: 'pending' | 'open' }, error }. |
Examples
Open a thread
const res = await openThread(credentials, otherUserKey, { appScope });
if (res.ok) console.log(res.data.status); // 'pending' until the other party also consentsNoteThe thread key is derived as
dmPairKey(me, withUserKey) — deterministic and order-independent.See also
useThreads · sendMessage · dmPairKey
Source: README.md#private-messaging-dms · Also available in llms-full.txt and registry.json.