User Attributes

1. Introduction

User Attributes are data points associated with a user or relevant for the conversation. These attributes are persistent in nature unless they are cleared or overridden explicitly.

User attributes can also be used as variables for storing data related to a path execution. For example – email or username of a chatbot user, items ordered, quantity and delivery address for a pizza ordering bot and so on.

2 Mechanisms for setting attributes

User attributes can be associated or managed via various means. Listing down the various ways how the attribute values can be added, updated or reset –

– Set Attribute Node can be used to set an attribute value for a user. While setting the value, it even allows selecting from one of the three types as listed below:
– Text
– Number
– Date

These types, further allow appropriate search options for the attributes in the Users workflow.

Send Message with Options Node can be set up to store the option selected as an attribute value for the user. To be able to do that – specify the attribute against which you want selected value to be saved in.

Request User Data Node can be used to request information from the user and store it as an attribute

JSON API Node – The response fields from an API call can be fetched and stored as an attribute which can be utilised later. This can be a really helpful way to load more contextual and relevant information about a user or an activity via an API call. To store a response from an API as an attribute:

  1. Click on the key from the response whose value you want to use in the flow
  2. The attribute is created right below the response box
  3. You can change the name of these attributes as per your desire

Note: This is only available for the customers on the professional plan & higher

Script Node – The output of a script node execution can also be returned to add or update a user attribute value.
You can set up an attribute by using the attributes field which takes in an array of attribute objects. Each attribute object is a very simple object with name and value fields. This field can be used in conjunction with the other sections as well.

Note: the script node is only available in the Business plan and higher

During website bot initialisation – For both the widget mode and the standalone mode, attributes can be set up for a user to initialise the bot. This can be helpful for cases where contextual information is available for the user during the chat initiation.

Standalone Mode: While launching the bot using the direct URL, you can specify a Path/flow to be launched as well as specify the values for a set of attributes.

– These have to be added to the bot’s direct URL

Website Widget: You can add an additional parameter for user_attributes as is highlighted in an example of the initialisation script below:

Identity Node – The identity node can also be used as a simple form to collect data from the user and persist them as attributes

Other means for example Google Calendar node utilizes attributes to store the date and time values selected for the appointment/event.

3. System-defined attributes

Outside of the explicitly set up user attributes, there are some system defined attributes which are provided based on the details available in the system about the user. These are namely –

This image has an empty alt attribute; its file name is image-18.png

Note: System attributes available to a user are based on Subscription Plan 

4. Viewing Attribute Values

All the attributes which are associated with a user are displayed in the User Details section. Here is an example of the same –

Attributes associated with a user can also be seen on the right in the live chat window 

5. Using Attribute Values

All user attributes including the system provided ones can be accessed in the relevant nodes by using the double curly braces notation {{attribute}}. For example – To access the value stored in email_address attribute, use {{email_address}} in the node. An autocomplete list will start showing up to ease the access to the user attributes. The double curly braces notation is to be only used while accessing the variables. While defining them there is no need to specify braces.

5.1 Using System Attributes 

System attributes derive their value from system-defined procedures. No value is requested from bot users in the bot flow. 

A standard system Attribute has a structure {{user.<attribute name>}}

Example: Attribute for First Name would be {{user.first_name}}

Note: System Attributes can not be overridden (modified) in the bot flow. Their names can not be changed. 

5.2 Using Custom Attributes 

Custom attributes are created by bot builders to capture user information during the bot flow. The type and name of the attribute is defined while creation. Their value can be changed multiple times during the bot flow.

A standard custom attribute has a structure {{<attributename>}}.

Example: Attribute collecting Phone number {{ph_no}}

Note: You can not keep the name of a custom attribute the same as that of a system Attribute.

6. Standard Attribute Length

The attributes are limited in size by design. The constraint is due to performance factors.

Here are the standard limits:
1. Up to 25K characters for in flow usage
2. Up to 1000 characters for also persisting this information in DB for reporting and segmentation.
Note : For double byte characters, these limits may be halved.

In order to deal with larger data, it is a standard practice for any development to split the data or use paginated responses.

Was this article helpful?

Related Articles

Leave A Comment?