HomeDocsAdvanced ProgrammingVariables and Globals
Advanced Programming

Variables and Globals

Managing data is a key requirement for any industrial-grade AI. Querlo Studio handles this through a unified variable system that tracks everything from system metadata to user-provided information.

System Globals

Querlo automatically populates several global variables for every session. These are read-only values that provide context about the current interaction:

VariableTypeDescription
`chat_id`StringUnique identifier for the specific chat configuration.
`session_id`StringUnique identifier for the current user interaction session.
`user_id`StringPersistent identifier for the specific user across sessions.
`geoloc`ObjectGeometric data including country, city, and coordinates (if permitted).
`team_id`StringThe identifier of the organization owning the chat.
`null`KeywordRepresents a null or empty value for logic comparisons.

Custom Node Variables

Beyond system globals, you can capture user data at any point in the flow.

Defining Variables on the Fly

Most input-capable nodes (Open Answer, Multiple Choice, etc.) include a "Save to Variable" field.

  • You don't need to pre-define these in a settings menu.
  • Simply type a name (e.g., user_email or selected_plan) in the node's input.
  • From that moment forward, that variable is part of the session state.

Dynamic Autocomplete

To make programming faster and prevent typos, the Querlo Studio editor includes a Professional Autocomplete system.

Whenever you are writing a script in a V8 JS Node or setting up a Conditional Branch, start typing to see:

  • System Globals: Instant access to chat_id, geoloc, etc.
  • Active Variables: A list of all variables you've defined in previous nodes.
  • Syntax Highlighting: Visual cues for system keywords versus custom data points.

Using Variables in Content

You can inject variable values directly into chat bubbles using double curly braces notation:

"Hello {user_name}, thanks for choosing the {selected_plan} plan!"

This makes every interaction feel personalized and dynamic.