1. Home
  2. Actions
  3. What are Sessions and User Attributes?
  1. Home
  2. Advanced features
  3. What are Sessions and User Attributes?

What are Sessions and User Attributes?

Sessions and User attributes allow you to store & display information within the conversation.

What’s the difference between Session and User attributes?

A Session is limited in time, and is usually defined by a Story. You can also extend a Session if you jump from one Story to another through Steps.
On the contrary, User Attributes persist beyond the lifetime of a story. They are useful to retain information about your user, such as his name or his email for example.

More about Stories

During a Session, the chatbot is able to remember information — whether it is contained in an entity, or if you set it yourself.

Refer to our previous article on how to use Entities:

How to use Entities

Set Sessions to Retain Information about the Conversation

“Set Session” is an action your chatbot can take, it is in the same step menu as “message” or “image”.

This action will not send a message to the user. It will simply tell the chatbot to remember a certain piece of information or the user reached a certain point in the conversation.

In the example above, we asked in the previous step “Where do you live?”; the user answered “Paris”.
We can set the Session so the chatbot remembers the user lives in Paris.

You can also use Quick Replies (buttons) :

Set User Attribute to Retain User Information

In the same way as “Set Session”, “User attribute” is an action that: 

  • you can drag & drop into your step from the step menu. 
  • is silent: it won’t send any message to the user. 

In this example, we added a User attribute to retain the first name of the user talking to the bot. This means that, when user will come back and talk to the chatbot, the bot will remember his first name and then be able to skip this particular step. 

Display Session Values and User attributes

Basic use

This variable will be accessible in the next Step via text, email and set Session actions under the following syntax:
Session Value:

{{@session.City}}

User attribute:

{{@user.FirstName}}

These variables also can be integrated in “normal text”:

{{@user.FirstName}}, we are really glad you live in {{@session.City}}, such a great city!

Last user message 

The {{@message}} syntax allows you to get the content of the user’s last message. You can use it via text, email, set Session and User attribute. 

Support question from user {{@user.FirstName}} from {{@session.City}}:{{@message}}

Manage default value

If you are not sure if a value has been set, you can provide a default value in order to avoid an empty message.
Session value:

Hello {{@session.City || "there"}}

User attribute:

Hello {{@user.FirstName || "there"}}

You can provide several default values; the first existing one will be used.

Hello {{@user.FirstName || @session.email || "there"}}

Usage Examples

To remember if a user passed through one Step or another

For a quiz, you can set Sessions for the chatbot to remember if the user answered correctly to each question (Step: “false” or “correct”).

To retain information about the user

If your chatbot asks questions on a form, the first question could be:
“Are you a man or a woman?”.
The chatbot could remember this information and:

  • send it to you in an email at the end of the form.
  • don’t ask the question again to the user next time he will talk to the chatbot

To save messages from the user along the conversation

Using the function {{@message}}, you can set a Session to retain specific messages along the conversation. This way, you will be able to reuse the message; for example, in an email to your customer service.

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
More help