All Collections
Building your bot
Attributes and variations
How to set up and manage attributes in your Teams bot
How to set up and manage attributes in your Teams bot

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 a category to save data against. 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.


Saving data against an 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

Free text answers from users can also be saved against an attribute using the 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.


Managing attributes

You can now manage and delete the attributes used in your bot in the "Manage attributes" section of the platform.

Simply click the "Manage attributes" button in the left-hand grey bar (under People & Privacy) to access these details. Once you have done that, you will be able to see all the attributes used within your bot:

Each attribute will be presented beside its ID and uses, as well as an edit button.

You will be able to clearly see where each attribute is used within your bot, whether it's in a message, variation or or un-sent broadcast.

You can find out more about the attribute by clicking the blue Edit button. When you click edit, you will be taken to this page:

Here you can see a brief summary of where your attribute can be found. Each message will show the location of the attribute too, whether it's in a button, Q&A or recalled back as part of a message part. You can access the message that the attribute is used in by clicking on the message name.

The name of the attribute can also be changed. Simply edit the name at the top, then press the save button once you are happy with it.

Deleting attributes

Please note, that you will only be able to delete attributes if they are no longer being used in the bot. This will clearly be outlined in the Manage attributes section, with the red "delete" button becoming more prominent once no uses are found.

You can delete your attribute by either going to the message it's used in through the message list or by clicking the edit button in the Manage attributes section and clicking through to the messages there.

If your attribute has been used in a variation, simply go to the Manage attributes page, and delete the intended variation:

If your attribute appears in any un-sent broadcasts, you can go to the broadcast section of the platform and delete the specific broadcast in which your attribute appears. You could also wait for the specific broadcast to be sent before you delete the attribute.

Did this answer your question?