> For the complete documentation index, see [llms.txt](https://docs.botdistrikt.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.botdistrikt.com/features/rules/conditions/user-attribute.md).

# User Attribute

We have the capability to assign attributes to a user as they chat with a bot. This is useful to store information about the user. For example, if we want to store the user's email, or if we want to store the user's favourite flavor of ice cream.

Let's go to the "you just said hello" story change the first text response to

```
text: What is your favorite flavor of ice cream?
```

then let's add a memory response

```
ACTION
type: memory
property: asked-fav-icecream
function: set to
value: true
```

Now let's add a NEW rule with a NEW condition

```
CONDITION
type: memory
property: asked-fav-icecream
function: equals
value: true
```

Now the chat flows as follows:

```
CHAT
User: hello there
Bot: hey!
Bot: (secretly, without telling the user, sets *said-hey* to true in the session)
User: how are you?
Bot: (saw that the property said-hey equals true in the user's chat session)
Bot: What is your favorite flavor of ice cream?
```

and let's assign this to a new story called "entered fav ice cream"

Go to the "entered fav ice cream" story and add a new `action` response

```
type: user attribute
property: fav_ice_cream
function: set to
value: {{message.text}}
```

then add yet another `text` response

```
message: I love {{user.fav_ice_cream}} too! It's amazing.
```

We just used a **merge tag** called `fav_ice_cream` to refer to the new user attribute. Now the chat flows as follows:

```
User: hello there
Bot: hey!
Bot: (secretly, without telling the user, sets *said-hey* to true in the session)
User: how are you?
Bot: (saw that the property said-hey equals true in the user's chat session)
Bot: What is your favorite flavor of ice cream?
Bot: (secretly, without telling the user, sets *asked-fav-icecream* to true in the session)
User: chocolate
Bot: (saw that the property asked-fav-icecream equals true in the session)
Bot: (store's the user's last message to an attribute called fav_ice_cream)
Bot: I love chocolate too! It's amazing.
```

Now, refer to the user's favorite ice cream with the merge tag `{{user.fav_ice_cream}}` in any of our responses or cards REGARDLESS of the chat session.&#x20;

The user will start chatting with the bot again tomorrow (their`fav_ice_cream` will still be `chocolate).`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.botdistrikt.com/features/rules/conditions/user-attribute.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
