What are Attributes?

A simple guide on how attributes work and how best to use them

Melita Gandham avatar
Written by Melita Gandham
Updated over a week ago

Attributes are a great way to save user data to the bot database. You can then either save this data or recall it back in a later message to make for a richer bot experience.

What do attributes do?

In simplest terms, an attribute is something we use to save data against. It's a way to collect user data easily and effectively. So for example, if I want feedback off a user, I can build a message with a Q&A or a button in order to save the user's response against the attribute $feedback:

Whatever the user sends back or selects is now attached to this attribute, and I know that attribute is saving only user feedback.

How do you save data against a user attribute?

There's multiple ways you can do this:

Store button presses

When creating a button or a quick reply, you can set the button type to be “Save this information with a user attribute”. Select a user attribute to save the response against the user so that you can retrieve it later, perhaps you want to use the label ‘training’. You can also set a value against that attribute, just in case you want it to be different to the button text. The value will then be saved to the attribute in the bot database, not the button text. Then finally select the message you want to send the user once the response has been saved.

Store free text answers

Although buttons are useful to save most attributes, sometimes you want to ask the user an open ended question. But you still want to store the response against the user. These are done slightly differently from buttons, instead you need to choose a Q&A message part.

Add a Q&A message part, and then hit the cog to access to the settings, set the user attribute save against the user, eg "feedback":

Now when a user responds to that message, it will save their response against their user profile in the system as a 'user attribute'.

Store an invisible attribute or 'set attribute'

You can also set a value against an attribute for a user when a message is delivered to them for example, if you want to mark that a message has been sent. Read how to do this here.


Retrieving data

Once you’ve managed to store data against a bot user you can then retrieve it to use it in another message sent to a bot user.

Let’s say you used the attribute "response" when storing data. You can now use that data in another message by simply using the shortcode “{{$response}}”.

Just how you would use “{{first_name}}” to refer to the user's first name.

If you want to export it all, you can export all the saved data as a CSV.


Clearing attributes

If you are creating a bot flow that the user will go through multiple times, you may need to reset your attributes to clear whatever was saved from the last journey. You can do this by using the Clear user attribute message part.

In the Clear user attribute settings, choose the attribute you want to clear and hit save. If you want to clear multiple attributes, hit the ‘+’ icon to add another attribute to be cleared’.

You’ll then see a clear attribute part with your settings configured (the user will not see this) any values set for the user for those will clear when a user reads that message.






Did this answer your question?