Knowledge Center next icon Use a Conversation Variable to Repeat a Value
Feb 27, 2023
4 minutes read

Use a Conversation Variable to Repeat a Value

Goal

Repeat a value in your answers, such as your end user's name to personalize a conversation.

Who can it help?

Conversational AI Cloud Content Engineers

  • This is an advanced level use case which shows a simple way to repeat a conversation variable in an answer.

  • User roles needed: Content Engineer + External JavaScript Developer to access the configuration screen.

Repeat a Value with Conversation Variables

To repeat a value such as an end user’s name in a conversation, you’ll need to combine a few Conversational AI Cloud elements.

For this guide, we will be using the following:

  • A conversation variable - to store the value that the end user enters into the t-dialog slot

  • A simple t-dialog - to capture a value from the end user

  • Two articles - one to trigger the t-dialog, and another to show the conversation variable that was stored from the t-dialog slot which will repeat the stored value.

Step 1: Build a Conversation Variable

Next, we'll need a conversation variable. This will be used to store the value that the end user enters into the t-dialog slot, and repeat that value throughout the conversation when used in an answer.

Create a conversation variable in the Configuration screen:

image.png

Step 2: Use the Conversation Variable in a T-dialog

We're now going to use the conversation variable in a simple t-dialog to capture the end user's name. The conversation variable will store the value that the end user enters to use later in the conversation.

image.png

In the Name slot, select the conversation variable that you created. This will store the value that the end user entered:

image.png

Now we need to add some outputs for this slot:
image.png

What do the different color outputs do?

  • The grey bubble asks the end user what information we need from them.

  • The red bubble output will show when the slot doesn't get validated by the webhook (if you're using one).

  • The green bubble shows as a response to the end users input.

For the end slot, we simply need an output that will guide the user to continue the conversation. You can do this with a simple output such as shown here, or if you need then end user to continue with a dialog, you can use a transaction end event.

image.png

Save the t-dialog and go on to the next step.

Step 3: Repeat the Conversation Variable Value in an Answer

To get this working, we will need to create 2 articles.

The first article we're going to build will trigger the t-dialog that we just built.

The second article we're going to build is going to contain the conversation variable in the answer:

image.png

Step 4: Test

We're finally ready to test! Let's see how the above scenario works.

say_name.gif

Related Articles

group icon
Get support

Can’t find the answer you are looking for?
Ask for the help of our chatbot, or get in touch with our support team.

Contact Support
Is this region a better fit for you?
Go
close icon