VOGO Voice – Knowledge Base

Iterations using Loop function

Estimated reading time: 6 min

Loop is a response card that is often used for responding via voice, display, audio, or video within a custom skill to introduce the different iteration statements. The logical conditions input within this component in conjunction with a series of other components enhances a user’s experience throughout a conversation with a particular custom skill.

This user-centric tutorial is designed to help you gain a detailed understanding of the asynchronous function of the Loop response component and its processing of input information in relation to a specific intent on which the interaction flow is modeled. To help you get started, the comprehensive tutorial, on the whole, focuses on the process of how the Loop response card performs the task of going through a particular list of data several times within an active session of the skill to iterate over the records individually as a continuous series of responses.

Prerequisites

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

Create a custom intent

Create an appropriate intent to be invoked for executing an interaction flow mapped to it, the purpose here being to perform the core function of iterating a set of results to its end-user. This tutorial aims at illustrating a use case for relaying interesting facts about fruits to its users. 

Create an intent titled ‘Fruit Facts’ with a set of suitable sample utterances mapped to it. Let’s say the sample utterances are: “ Tell me a fruit fact”, “Give me a fruit fact”, and “Say a fruit fact”. 

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

Steps to create an interaction flow

Now that we have created a Fruit Facts intent, let’s create an interaction flow associated with the intent to be executed through the skill.
1. Navigate to Interactions on the vertical bar displayed on the left-hand side of the Dashboard.
2. Click on the Interactions button at the bottom right-hand corner of the screen and select the “Fruit Facts” intent to be directed into the Interaction builder platform. 

3. In the flow diagram area you will be able to see the Start and Response component.

4. Roll the mouse over the Response component to see the voice, computer and        camera icon on the top right-hand side of the component.
5. Click on the Voice icon of the Response card to open up the Speak pop-up window with a field titled Say, wherein you need totype the voice action intended to be spoken to the user.
Say:Welcome to fun and interesting facts about fruits.

6. Check the checkmark box in the Expect Response and type in the suitable Prompt message to proceed with the flow.

Prompt: Say next to continue.
The same message will be replicated in the Reprompt field.    
Reprompt: Say next to continue.

7. Populate the field under Expectations by selecting the Global Intent Next from the drop-down list.

🖍 Note: Ensure to click the Save button to save the interaction flow as and when edits are made.

To add a display message in a video-enabled voice-assisted device
1. Click on the Computer icon, and type in a condensed version of the voice message in the field titled Display Message of the Show pop-up window.
2. Populate the required fields and click the Save button.
Title: Fruit Facts
Display Message: Welcome to fun and interesting facts about fruits.

For further reference on how to populate the additional fields visit https://university.vogovoice.com/kb/guide-response-component/

8. Drag and drop an Add Variables component onto the flow canvas and connect the anchor symbol of Next on the Response card to the Add Variables component.

🖍 Note: To interconnect the different components click on their respective Anchor symbols so as to chain and hold them in the interaction flow.

9. Configure the Add Variables component by adding the key-value pair as shown below. Set the data type as Array for saving the variable Fruits with the valuesassigned to it [ “A banana is not a fruit, it is a herb.”, “Strawberries are the only fruit with seeds on the outside.”, “Mangoes are the most loved and the No 1 fruit in the world.”, “Apples stay afloat in water as they are 25 percent air.”, “A kiwi has two times the vitamin C present in an orange.” ]

To know more about different data types, click here.

10. Now drag and drop a Loop component onto the flow diagram area.

11. Roll the mouse over the Loop component to see the voice, and camera icon on the top right-hand side of the component.
12. Click on the Voice icon to configure the Loop component to set the loop to function in order to start the repetitive process of prompting the result to its end-user by referencing an array of results.
1. Begin by specifying in the field titled List the path that represents the array of results. Here being, var.Fruits with its respective data type set as Path.
2. In the Introduction field, type an introductory response to suit the specific intent to which the queried data is tied to, which here is given as Let’s start with interesting fruits facts.
3. The next field titled Say Item captures the item on the List that needs to be conveyed to the user. In order to reference and display the key values from the list item, reference them using the specific syntax {{context.item}}

To know more on how to reference values with or without keys/arbitrary names visit our guide on Loop. Furthermore, to learn about templates engines and how to use them visit our guide on template engine and data types.

4. In the field titled Prompt for Next type a suitable prompt which in this illustration is framed as Would you like to hear the next fruit fact?
5. Before an active session of a skill ends, it is optional to include a note of courtesy in the Conclusion field such as Thank you!, Have a nice day! etc

Note: If the session is intended to be prolonged, then the Expect Response field needs to be populated. The inclusion of an expecting response keeps the session open for further interaction. 

👍 Note: The loop function seeks a confirmation from the user in the form of a ‘Yes’ or ‘No’ so as to determine whether or not to repeat the process of presenting to the user the next item on the list. So the user will have to say “Yes” to the Prompt Would you like to hear the next fruit fact? to hear the next item on the list. The terminating condition of this cyclic process comes into effect the exact moment the user invokes “No”.

To add a display message in a video-enabled voice-assisted device
1. Click on the Computer icon of the Loop component,and specify the template to display the values from the list item in the field titled Display Message of the Show pop-up window.
2. Populate the required fields and click the Save button. 
Title: Fruit Facts
Display Message: {{context.item}}

13. Drag and drop another Response component onto the flow canvas and connect the anchor symbol of Quit on the Loop card to the Response component.
14. Click on the Voice icon of the Response card to open up the Speak pop-up window with a field titled Say, wherein you need totype the voice action intended to be spoken to the user when he invokes “No” to the curated prompting question in the custom skill.

Say: Thank you for exploring our incredible list of fun fruit facts. Please visit again to check out more interesting facts that are sure to pique your interest. 

To add a display message in a video-enabled voice-assisted device
1. Click on the Computer icon, and type in a condensed version of the voice message in the field titled Display Message of the Show pop-up window.
2. Populate the required fields and click the Save button. 
Title: Fruit Facts
Display Message: Thank you for exploring our incredible list of fun fruit facts. Please visit again to
check out more interesting facts that are sure to pique your interest.

The screenshot below captures the aforementioned interaction flow.

Testing and Validation

  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.
4. In the Conversation section of the Test Response, the Fruit Facts intent through which this interaction flow has been initiated will be auto-generated in the User invokes field.
5. Click the plus button within the Conversation section to open up an additional field titled User Invokes. Ensure to populate this field by selecting the Next intent called to action within the interaction flow to test the introductory voice response incorporated within the custom skill.
6. In order to start the repetitive process of prompting the items on the list to its end-user, click on the plus button within the Conversation section to open up two more additional fields titled User Invokes and populate both fields with “Yes”.
7. To test the voice response that is relayed when the active session of the skill draws to an end, populate another additional field against User Invokes with “No”.

8. Finally, click the Save button to save the input and perform the test.
9. To validate the Test Response, click on the lightning symbol on the left-hand side of the test case. 

10. On the resultant Test Response window, the blue chat bubbles present the input message within the Response components.

11. Click on the chat bubble to see the details of the individual response. 

To know more about testing an interaction refer https://university.vogovoice.com/kb/testings/

Congratulations! You have successfully created an interaction flow to execute the curated voice iterations to the end-user within the active session of a skill by implementing the Loop component in conjunction with a series of other purposeful components.

👍 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: None, One, Many