Remember answers with variables

Save what a visitor says and reuse it later in the conversation.

Open this guide in the help center →

When to use this. You want the chatbot to greet people by name, score their answers, or start with details you already know.

What you’ll need. A chatbot with at least one input block.

  1. Save an answer in a variable

    In an input block, use Save the answer in a variable and pick or create a variable, for example First name.

  2. Use it in a message

    In a Text bubble, use the Insert a variable button, or type the variable name in double curly braces, such as {{First name}}. The visitor sees the value they entered.

  3. Change or calculate a value

    Use a Set variable block to store a custom value. You can write JavaScript with existing variables, for example {{Score}} + 5 to add to a score, then use the result in a condition.

  4. Format a value inside a message

    Anything inside {{= and =}} in a text bubble is evaluated as JavaScript. For example, {{={{First name}}.toUpperCase()=}} shows the name in capital letters.

  5. Prefill from the link

    Any variable can be filled from the chatbot link. Add its name and value as query parameters and replace spaces with %20, for example ?Email=sam@example.com&First%20name=Sam. In Settings, Prefill input fills matching inputs automatically, and Hide query params on bot start keeps the address tidy.

How to know it worked

A test conversation shows a value the visitor entered, or one you passed in the link, in a later message.

Features covered

Continue learning