Docs / built-apps / openThread

openThread

utilitysince 0.2.2

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

ParamTypeNotesDescription
credentialsFlowstackCredentialsrequired, since 0.2.2The authenticated caller's credentials (must include userId).
withUserKeystringrequired, since 0.2.2The counterpart's user key.
configFlowstackClientConfigrequired, since 0.2.2Client config. Must include appScope.

Returns

FieldTypeDescription
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 consents
NoteThe 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.