The data object is a powerful tool for managing and accessing information throughout a conversation. It allows you to store and retrieve data as well as access conversation and customer information, providing flexibility and customization for your chatbot. This documentation will guide you through the structure of the data object and its various components.
The data object consists of the following key components:
id: Unique identifier for the current state in the conversation.
name: Name of the current state.
parameters: An object to pass data into custom components, not persisted across states.
db: An object to store and retrieve data throughout the conversation.
conversation: An object containing information about the conversation.
customer_info: An object containing information about the customer.
chatId: Unique identifier for the chat.
The data object has the following structure:
"user_last_input": "Hello there 😀",
"os": "Mac OS",
parametersobject is empty by default but can be used to pass data into custom components. The data stored in the
parametersobject will not be persisted during the conversation and is only valid for the triggered component.
dbobject allows you to store and retrieve data during the conversation. For example, you can store user inputs, variable button presses, and information about uploaded files.
conversationobject contains information about the ongoing conversation, such as the user's last input, the browser used, the operating system, and the platform.
customer_infoobject contains information about the customer, such as their unique ID, first and last name, and any additional information you'd like to store.
You can access and manipulate the data object throughout the conversation to provide a personalized and dynamic user experience. Store data in the
dbobject, pass temporary data through the
parametersobject, and access conversation and customer information to customize the chatbot's responses.
When a user uploads a file using a File Upload Card, the information about the uploaded file is stored in the
dbobject. Here is an example of how the
dbobject would look like after a file has been uploaded:
"filename": "logo (1).png",
"label": "logo (1).png",
In this example, a user has uploaded a file named "logo (1).png". The file information is stored under the
customer_uploaded_filekey in the
dbobject. You can access this information throughout the conversation to perform actions such as displaying the file, sending it to another API, or storing it in a database.
To access the uploaded file's URL, you can use the following syntax:
file_url = data['db']['customer_uploaded_file']['files']['url']
This will retrieve the URL of the uploaded file, which can be used for further processing or displaying to the user. For more information and examples on working with Multi File Input, please refer to our GitBook page.