VOGO Voice – Knowledge Base

Conditions

Estimated reading time: 5 min

Conditional statements determine the logical flow of execution of an interaction depending on whether the specified condition evaluates to true or false. The VOGO Voice platform allows to define conditional constructs by means of a twofold method. Firstly via the Check Variable component to execute the decision-making process facilitated by ‘Then’ and ‘Otherwise’. Secondly, there’s the option to embed within the text field of the components {{#if ….}} {{else}} template condition to attain the desired result.

This instructional tutorial comprehensively demonstrates how these methods when employed in an interaction flow produces the same result.  It enables the users to select the suitable conditional construct to attain the intended outcome in one of the two different ways made available. To give you a guided walkthrough, we have built two sample interaction flows each incorporating one of the two methods to update the users on their Pass/Fail status depending on their score input. 

Prerequisites

  •  VOGO Voice account: https://www.vogovoice.com/
  • Access rights to the Intents section under Settings.
  • Access rights to Interaction builder platform.

Steps to create a custom intent titled ‘Scores’

When prompted on behalf of the skill to capture the user input value on ‘Scores’ an intent has to be created for it to be called to action in both the methods while configuring the Check Variable and Response component.

Create an intent titled ‘Scores’ with a set of suitable sample utterances mapped to it. Let’s say the sample utterances are: “My score is {score}” and “I have scored {score}” where ‘score’ is the slot name. Assign the slot type to ENVIRONMENT_Number, which is a global slot with predefined values. 

To learn how to create custom intents refer the guide: https://university.vogovoice.com/kb/creating-intents/

Method 1 – Using Check Variable component (Then/Otherwise)

Here’s taking a detailed look at the steps to create an interaction flow by configuring the Check Variable component to specify a condition using Then/Otherwise in order to serve the purpose of providing a Pass/Fail assessment status depending on the user input score. Integrating the component will aid in creating a bifurcated pathing, i.e. the resultant pathing of the tested condition will be chained to ‘Then’ if the specified condition affirms ‘true’ and to ‘Otherwise’ if it returns ‘false’.
To emulate this process, choose an intent you have created to be directed to the interaction builder platform which in this case is Check Result. Now let’s create an interaction flow associated with the intent to be executed through the skill.

  1. Log into your VOGO Voice account to be directed to VOGO Voice Management Console (https://account.vogovoice.com)
  2. Navigate to Interactions on the vertical bar displayed on the left-hand side of the Dashboard.
    Dashboard > Interactions
  3. Click on the Interaction button at the bottom right-hand corner of the screen and select the intent to be directed into the Interaction builder platform.

4. In the flow diagram area, you will be able to see the Start and Response component.
5. Roll the mouse over the Response component to see the voice, computer and camera icon
on the top right-hand side of the component.
6. Clicking on the Voice icon opens a Speak pop-up window with a field titled Say wherein you
need to type the voice action intended to be spoken to the user in regard to Check Result
intent. 
Say: Welcome to Check my Result. To know about your grade please say your score.
7. Check the checkmark box in the Expect Response and type in the suitable Prompt message
seeking the user-input value on scores.
Prompt: What is your score?
The same message will be replicated in the Reprompt field.
8. Populate the field under Expectations by selecting the Scores intent from the drop-down list.
🖍 Note: Leave the field titled ‘score’ blank.

9. Drag and drop the Check Variable component onto the flow diagram area and connect the
anchor symbol of Scores on the Response card to the Check Variable component.
10. Configure the Check Variable component with a test condition to evaluate using the
relational operator greater than or equal to assess the grade based on the user-input value.
1. Populate the left and right-hand side of the Configuration window as in the
screenshot shown below. Set the data types accordingly based on the inputs.
Left-Hand side: inputs.score.value (where ‘score’ is the slot name). 
Right-Hand side: 40 (where 40 is the cut-off score).

2. If the test condition returns True (i.e. the input score is greater than or equal to 40),
the subsequent pathing will be linked to Then, and if False (i.e. if the input score is less than
40) chain the resultant Response card to Otherwise.

11. In the Say field of the Response card linked to Then add a suitable voice response to inform
the user that he has passed the exam. 
Say: Great! You have passed the exam.
12. In the Say field of the Response card linked to Otherwise add a suitable voice response to
gracefully let the user know that he has failed the exam.
Say: Sorry, you have not made it this time. Better luck next time.

The screenshot below captures the aforementioned interaction flow to test a condition by employing the Check Variable component.

Testing and Validation – Method 1

Conduct 2 separate tests: one for Pass and the other for Fail

Test 1 for Pass

  1. Click on the Test button next to the Flow Editor button on the interaction builder platform. 

2. In the Tests pop-up window that appears click the + button on its top right-hand corner. 

3. Fill the Name field of the Test Response window that shows up, then populate the field titled
User invokes by selecting the Scores intent called to action within the interaction flow. 
1. Fill the ‘With slots’ field under Conversation with the user-input score that is 40 or
above and click the Save button.

4. To validate the Test Response, click on the lightning symbol on the left-hand side of the test
case. 

5. On the resultant Test Response window, the second blue chat bubble will cumulatively
present the previously input message within the Response component chained to Then of
the Check Variable component

Test 2 for Fail

Now perform a separate test to validate the response concerning the grade status ‘Fail’. Proceed by following all of the five steps in Test1 for Pass in the chronological order to complete the process. The only field that requires a change of input is the ‘With slots’ under Conversation that needs to be filled with the user-input score less than 40 and then click the Save button

Congratulations! You have successfully created an interaction integrating Check Variable component to assess the Pass/Fail status based on the user-input score.

Method 2 – Using {{#if ….}} {{else}} template condition

Now let’s go through the steps to create an interaction flow by configuring the relevant Response cards to implement the  {{#if ….}} {{else}} template condition to inform the users of their Pass/Fail grades based on the input scores.

Create another intent to develop an interaction flow to test the aforementioned condition which in this case is Check Result 2. Select the newly created intent to be directed to the interaction builder platform in the same way as mentioned in Method 1.

  1. In the flow diagram area you will be able to see the Start and Response component.
  2. Roll the mouse over the Response component to see the voice, computer and camera icon on the top right-hand side of the component.
  3. Clicking on the on the Voice icon opens a Speak pop-up window with a field titled Say wherein you need to type the voice action intended to be spoken to the user in regardto Check Result2 intent.
    1.Configure the Response card by populating the fields in the same way as you had done in Method  🖍🖍 Note: For reference, see the screenshot used in Method 1.  
  4.  Drag and drop another Response card onto the flow canvas. Chain this Response card to the anchor symbol of Scores on the first Response card.  
    1. Use {{#if ….}} {{else}} template condition in the Say field of the Response card to generate appropriate voice responses to address the Pass/Fail status accordingly. 

Say: {{#if inputs.score.value ‘>’ ‘39’}}
 Great! You have passed the exam.
{{else}}
Sorry, you have not made it this time.
Better luck next time. 
{{/if}}

The screenshot below captures the aforementioned interaction flow to test a condition by employing {{#if ….}} {{else}} template. 

Testing and Validation – Method 2

Perform the two separate tests as outlined in Method 1 to validate the Pass/Fail status attained through {{#if ….}} {{else}} template condition. 

Congratulations! You have successfully created an interaction employing {{#if ….}} {{else}} template condition to assess the Pass/Fail status based on the user-input score.

👍 Note: To test the functioning of the interactions on your device you have to deploy the custom skill to facilitate the skill with the new edits. To accomplish this, click on the Deploy button seen at the bottom of the Skill Settings pop-up window.

To know how to deploy a custom skill visit https://university.vogovoice.com/kb/deploying-a-skill/

Tags:
Was this article helpful?
Dislike 0
Previous: How to use Replace Regex function
Next: Custom Loop