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'.

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 Set Attribute message part. In the Set Attribute settings, choose the attribute you want to clear, and then press the spacebar under "User Attribute Value". This will essentially save the space as the data, so that the cells or recalled attributes come up as blank.

You can add a multiple Set Attribute parts to a message so, for example, if you wanted to clear a quiz of three questions, you could do so like this in the first message of your bot flow:

Further reading

Here is a selection of help docs to help you use Attributes in your bot:

Did this answer your question?