Breadcrumbs

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:

44554a0b-2690-49c5-a4c4-e98f0fc25ea4-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.

f276f330-ad37-4793-889a-b886ac2ac1b3-image.png


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

b90bfdeb-0218-401b-8425-cdb2f36b91b5-image.png

Now we need to add some outputs for this slot:
de59d699-a737-4097-8392-1aee2b10c441-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.

b04d9889-67de-4cc8-8c51-7894f6a983fb-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:


aed801dd-a38f-4acc-8900-c7d3f8172cef-image.png

Step 4: Test


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


say_name.gif