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.
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 | Source | Scope | Lifetime | Configuration Method | Example | Persistable |
|---|---|---|---|---|---|---|---|
| Global Variables | System-level variables | Automatically generated by GPTBots | All conversations and users | Permanent | System-generated | Conversation ID, Timestamp, etc. | ✅ Yes |
| User Source Variables | Channel-level variables | Automatically retrieved based on the user's channel | Users within the specific channel | Session-scoped | System-assigned | Browser, WhatsApp, LINE, etc. | ❌ No |
| User Attributes | User-level variables, custom-defined by developers | Developer-defined | Single user, across multiple conversations | Long-term, updatable | API | User ID, Username, Email, etc. | ✅ Yes |
| Custom Variables | Conversation-level variables, custom-defined by developers | Developer-defined | Current conversation (conversation_id) | Session-scoped, updatable | API, Widget, Iframe... | Current website domain, User preferences, etc. | ❌ No |
