Storage

Optimizing Data Handling with Storage Variables

Storage variables are integral to the functionality of conversational AI, serving as repositories for storing and retrieving data throughout interactions. These variables can encapsulate a wide array of information, ranging from slot values obtained from user input to complex data derived through system processing or user utterances. Utilizing JavaScript, storage variables can manage simple text, platform information, or any other form of derived values.

Due to the transient nature of slot or intent variables, which can be readily overwritten during a conversation, it's critical to secure this information by saving it into uniquely named storage variables. For example, if a bot inquires and receives a 'Yes' response within the first State block, the intent.name at that moment is 'Yes'. Yet, a subsequent question may prompt a 'No' response, thereby overwriting the intent.name to 'No'. Without saving these responses in storage, the initial affirmative response would be irretrievably lost.

Best Practice

The most effective method to preserve the integrity of user responses is to save them into clearly named storage variables, such as responseToQuestion1 or responseToQuestion2. By assigning distinctive names, these variables can be referenced independently, eliminating any ambiguity in subsequent processing.

Examples of Storage Variable Use:

  • User Information: Retaining the caller's telephone number.

  • Direct User Input: Storing the exact text of a user's utterance, like 'I want to speak to an agent', or a recognized slot value (e.g., {{slots.HouseNumber=26}}).

  • Processed User Input: Transforming a date like 'May 1st' into a standardized format within a storage variable, such as 'May-01'.

  • Platform Settings: Differentiating between platform variables like 'ChatV2' versus 'Phone2'.

These variables allow the bot to complete tasks more efficiently and guide users through tailored call flows.

GroupPrefixKeyTypeDescription

Storage

storage.

storage.<variableName>

string

References previously set dynamic values.

Adjusting Variable Lifetime

To modify the longevity of a storage variable, navigate to the Variables tab and select the appropriate variable. You will then have the option to set the variable's lifetime to suit the needs of your interaction.

  • If you select the Sessions option, the value of the variable will be maintained throughout the current conversation but will be reset when a new conversation starts.

  • If you select the Custom option, the duration for which the value is stored can be indefinite or set for a duration of X number of hours, days, or weeks.

Last updated