Skip to content

js-bao-wss-client


js-bao-wss-client / PromptsAPI

Interface: PromptsAPI ​

Prompts API, available as client.prompts. Executes prompts configured server-side for the app, identified by prompt key.

Deprecated ​

Call a server function instead: it runs the prompt with ctx.prompts.run (see the Server Functions guide).

Methods ​

execute() ​

execute<V, R>(promptKey, options): Promise<ExecutePromptResult<R>>

Execute a prompt by key and return the result.

The optional generics are additive. V types the variables bag and R types rawResponse. Both default to today's untyped shapes, so existing callers are unaffected.

Every prompt carries an accessRule deciding who may execute it. A refusal rejects with a JsBaoApiError whose status is 403 and whose code is "PROMPT_ACCESS_DENIED" — including when the prompt has no rule stored at all, which denies every caller who is not an app admin or owner. A prompt that is not in service rejects with a 400 whose code is "PROMPT_NOT_EXECUTABLE". Availability is a single server-owned status: only an active prompt executes here, and primitive prompts enable puts an inactive one back in service.

Type Parameters ​

V ​

V extends object = Record<string, unknown>

R ​

R = unknown

Parameters ​

promptKey ​

string

options ​

ExecutePromptOptions<V>

Returns ​

Promise<ExecutePromptResult<R>>

Deprecated ​

Call a server function instead: it runs the prompt with ctx.prompts.run (see the Server Functions guide).

Documentation validated against js-bao-wss-client 3.4.0 · js-bao 0.11.0 · primitive-admin 1.0.62 · primitive-app 3.1.0 — 2026-09-30