Objects are “persistent” variables, which means they are saved throughout the whole session between the user and the bot, as opposed to the variables normally used in the Dialog Manager (which lose their “state” or “value” when going from one dialog flow to another).
Furthermore, objects can hold more information than a regular variable, because you can assign multiple values to an object. Let’s clear this up with an example:
Imagine you that you are building a flow in which you would like to retrieve and store information about a user, such as the user’s name, address and email. Later on in the interaction you’d like to ask the user for permission to store his contact details, and if the user agrees, send the details to your database.
For this purpose you can create an object named (e.g.) 'Person'. In the 'Person'-object we can add 'Keys' and 'Value pairs'. We can add 'Keys' such as 'Name
', 'Address
' and 'Email
'.
Optionally, each 'Key' can be given a default 'Value'. After saving your object, you can use it in one of your dialog flows, by adding a 'Set Object' block.
Furthermore, in the Dialog Manager you can access or display values from objects by inserting the object name and key, such as:
[ObjectName][Key]
Following this example, in case a persons's address is requested: [Person][Address]
will show his or her address.