Step 1: Create the name variable

A variable is a placeholder that you can use to customise part of a chatbot message without creating extra passages.

Variables are designed to keep a value for a user so it can be re-used in multiple passages. Each variable is created to hold one piece of information, like a name or option selection, and the value is specific to each user's conversation.

The variable's value is assigned by actions that are triggered by the user's interaction with your chatbot. If the chatbot tries to use the variable before a value has been assigned, it will use a default value, or a blank value if there's no default.

In this guide, we're use the variable to address our user by name, and a blank value in the message would look strange. To prevent that, we'll set a default value when we create the variable.

Let's create a variable for our user's name:

  1. Open the Create section of the left-hand navigation.
  2. Click Variables.
  3. Click + Variable.
  4. Type Username as the name for your variable.
    You'll use this name to add the variable to your chatbot content. Variable names should be short but descriptive, and can use letters, numbers, spaces, and punctuation.
    You can change a variable's name later if you need to.
  5. Click Create.
  6. In the Description field, type Chatbot user's name.
  7. Select This variable requires a default value.
  8. In the Value field type friend.
    If the variable value hasn't been assigned when we use the variable, the chatbot will use 'friend' instead.
  9. Click Save.

We've created a variable to capture our user's name and added a default value to use. Now, let's create the passage where we'll assign a value to it.

Was this article helpful?
0 out of 0 found this helpful



Article is closed for comments.