Memory is a general purpose container that acts more or less like an object.

Saving data to Memory

You can save to Memory:

  • literal values, eg. [1, 2, "foo"], 3, "this is a string"
  • results of an expression, eg. nlu.intent, memory.someArray[0], memory.array.length(), nlu.intent = "blockCard"

Value saved to Memory can be of any data type, including:

  • basic data types (strings, numbers, booleans, and null)
  • arrays and objects

To save data to Memory, you can use one of the following blocks:

  • Ask block
  • Custom block (in the Memory field)
  • Integration block

Accessing the Memory

You can access Memory values with dot notation memory.someVariable.

If a value stored in Memory is an object, you can use either dot notation or bracket notation (memory.someObject["someProperty"]) to access its properties.

To check the whole Memory object, you can use the debugger built into the chat tester.

Saving data and accessing memory with an ASK block

With an Ask block, you can save a variable to the memory and then access it by using the expression {memory.context_used.variable_name}.

884 1782

Saving data and accessing memory with the Memory field in a Custom block

If you are using a Custom block, you can save a variable to the memory by assigning it a name under "key" and a value in the Memory section.

680

Then, you can access the memory in any other block by using the expression {memory.variable}.

Clearing the memory

If you want to clear the memory (for example if, during an authentication process, the user says they want to start over) you can add a Custom block and assign the selected memory to a Null value.

🚧

Be careful when changing flows. The memory is always cleared when changing flows except for what you save in the "Transfer to flow" block.

What memory is useful for

The following section provides some examples of how memory can help in building bots in Automate.

Saving NLU results & user choices for later

Every time you use Request User Input option in a block, the previous NLU results are overwritten. To save them for later, use memory. You can either save all of the results using nlu.intentsList for intents and nlu.variablesList for entities, or you can save only specific information. See NLU API page to learn more.

603

Saving all NLU results to memory

As these NLU results will be stored as arrays of objects, you can later access, edit and print them using Arrays and Objects methods.

Saving API responses for later

Setting default values and mocked data

Custom flow settings (advanced steering, loops, debugging & testing)


What’s Next