From Bright Pattern Documentation

Revision as of 20:10, 2 April 2026 by Laura.donovan (talk | contribs) (Updated via BpClonePage extension. Source page: draft:AgentDesktop-client-side-javascript-api-specification/getVariables)

< Previous | Next >
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

getVariables

Requests values for the provided set of variables from the BPCC server's scenario. If no interactionId value is specified, the system will request variables for the active interaction.

Request

Syntax

getVariables(keys: string[], interactionId?: string): Promise<OperationResult<Record<string, string>>>

Parameters

Parameters Parameter Values Data Type Optional/Required Description
keys string[] Required A list of scenario variable names for which you want the corresponding values.
interactionId String Optional The ID of the interaction for which you want to get the values of certain variables. If no ID is provided, the currently active interaction will be used.

Example Request

 adApi.getVariables(["service.name", "service.version", "service.EWT"]).then(result => {

        if (result.status === "success") {

            const serviceName = result.data["service.name"]

            const serviceVersion = result.data["service.version"]

            const serviceEWT = result.data["service.EWT"]

        } else {

            console.error("Something went wrong:", result.error.message)

        }

    })

Return Value

Object Object Values Data Type Optional?

(Y/N)

Value Description
Result Variables names Record<string, string> Y Object containing key-value pairs for the requested scenario variables.
< Previous | Next >