logo
Development
Search
Variable Overview

Variable Overview

Variables refer to values that can be accessed by all agents during the entire Agent runtime. By introducing variables using the {{ method, Agents can implement dynamic logic and responses. Variables enable flexible customization and configuration of Agents, personalized responses for different users, and triggering different business logic based on variable values.
alt text
In GPTBots Agent, variables are categorized into Global Variables, User Source Variables, User Attributes, and Custom Variables.

  • Global Variables are automatically generated by the GPTBots platform, such as conversation ID, conversation count, timestamp, etc.
  • User Source Variables are provided by the GPTBots platform based on the platform type (WhatsApp, Web, LINE, etc.) from which the user initiates the conversation, such as user nickname, platform user ID, etc.
  • Custom Variables are defined by developers and are session-scoped data valid only during a single conversation, such as the current website domain, user preferences, etc.
  • User Attributes are developer-defined, user-scoped data under the Agent, used to store user-related information such as user ID, username, user email, etc.
mindmap
  root((Variable Types))
    Global Variables
      Automatically generated by GPTBots system
      Example: Conversation ID, Timestamp
      Valid in all conversations
    User Source Variables
      Retrieved by GPTBots system based on user platform
      Example: Browser, WhatsApp, LINE
      Variables differ by source channel
    User Attributes
      Defined by developers
      Example: User name, gender, age
      Relatively fixed, not frequently changed
      User-scoped data, can be stored and referenced permanently
    Custom Variables
      Defined by developers
      Example: Current website domain, user status
      Session-scoped, temporary values valid only for the current conversation
      Can be set via API, Widget, Iframe
Variable Type Definition Scope Applicable Range Lifecycle Setting Method Example Persistent
Global Variables System-level Variables automatically generated by GPTBots All conversations and users Permanently valid System generated Conversation ID, Timestamp, etc. ✅ Yes
User Source Variables Channel-level Variables automatically retrieved based on user channel Users in the corresponding channel Valid during session System assigned Browser, WhatsApp, LINE, etc. ❌ No
User Attributes User-level User-scoped variables defined by developers Individual user Long-term valid, updatable API User ID, Username, Email, etc. ✅ Yes
Custom Variables Session-level Session-scoped variables defined by developers Current session Temporary (valid only for the current conversation) API, Widget, Iframe Current website domain, user preferences, etc. ❌ No