Behaviour

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.

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

"Set Session" is an action your chatbot can take, so 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.

Display Session Values

Basic use

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

{{@session.City}}

Session variables can be integrated in "normal text":

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 and set Session.

Support question from user {{@session.name}}:
{{@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.

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

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

Hello {{@session.first_name || @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 remember the status of a 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.

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.

Did this answer your question?