VOGO Voice – Knowledge Base

Fibonacci

Estimated reading time: 13 min

Fibonacci series is defined as a sequence of numbers such that each number is the sum of the two preceding ones, starting from 0 and 1. The beginning point of the sequence selected for this tutorial is 1 and 1, represented as Last Value and Current Value respectively.

This user-centric tutorial which is an extension of the Tutorial on Every nth Time using MOD feature will walk you through the procedural steps on how to implement the Fibonacci series within an interaction model initiated via the Launch interaction. The purpose of executing the Fibonacci series is that it triggers the skill to prompt the curated voice response at every nth time interval as in 1,2,3,5,8,13,21th time and gradually the intervals at which the response is prompted will become less and less. The advantageous side of implementing the Fibonacci sequence is that it extends the option to tailor voice responses at defined intervals to address returning users accordingly and on the whole, the tutorial displays the ways in which a custom skill can enhance the overall experience of the user.

Prerequisites

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

Steps to create an interaction flow

Let’s walk you through the step-by-step process on how to build an interaction model that will illustrate how Every nth Time can be used by means of the MOD feature to prompt something every 5th time for example.  
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 Open button of the default Launch interaction card 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. Unlink the Start component from the Response card by clicking the delete icon placed in the middle of the chain.

6. Drag and drop the Check variable component onto the flow diagram area.
7. Connect the Start component to the Check Variable component.

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

8. Configure the Check Variable component with a test condition using the relational operator Exists to evaluate the value stored in the system through Save Settings. The flow for the existing user will proceed from Then because the values of his previous visit exist, and for the new user, it will progress from Otherwise as no values are existent in the system.
1. Populate the left-hand side of the Configuration window as in the screenshot shown below. Set the data type based on the input.

 Left-Hand side: settings.visitorCnt (choose data type as Path).

To learn about different template engines to be followed to run functions visit https://university.vogovoice.com/kb/template-engine/

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

9. Drag and drop the Save Settings component onto the flow canvas.
10. Chain the Then on the Check Variable component to the Save Settings component. The objective of configuring the Save Settings component here is to first implement the visitor counter within the skill to capture the instance of the user’s visit for the purpose of returning a numerical value upon his next visit in the form of a voice response. This function, when called to action, adds value one (+1) to the instance of the user’s previous visit represented by a numerical value within the Save Settings component.

11. To configure the Save Settings component add the key-value pair. Input visitorCnt as the key and add as its corresponding value. Set the data type as Function. There’s also another way to input the value add and its corresponding type as Function – navigate to the Data tab adjacent to the Components on the top left-hand side of the interaction builder platform. 


1. In the Data section navigate further down through to Functions. Click on its plus button to have its subsection appear. In the list that appears, click on the plus button of Math which will open up a list. From the list, select add by dragging and dropping it in the value field of the Save Settings component which will automatically generate add and Function in its respective fields.

2. Then input the first argument by clicking the plus button that appears under the  heading Arguments.

3. Input number to represent the numerical value and set the data type to Function as shown below.

4. Click on the plus button that comes within the Arguments. In this sub-section add the path to which the value is saved. Here the input being settings.visitorCnt. Choose the data type as Path.

5. Now click on the plus button as highlighted in the screenshot below that appears on the region outside of the subsection to add a second argument. The purpose here is to substantiate the first argument.

6. Populate the field that appears with the numerical value 1 and choose its data type as Number.

12. Now drag and drop another Save Settings component onto the flow canvas.  
13. Chain the anchor symbol of Otherwise on the Check Variable component to the Save Settings component.

14. Configure the Save Settings component by adding the key-value pair. 
1. To configure add an arbitrary variable name to identify the value stored and assign a corresponding value to be called to function anytime within or beyond a session. Here, the key represents the variable visitorCnt and the value assigned is 1 to capture and save the initial visit of the user. Set the data type to Number.

To know more about different data types, click here.

15. Drag and drop a Response component onto the flow canvas and link it to the Save Settings component attached to the Otherwise on the Check Variable Component.

16. Roll the mouse over the Response component to see the voice, computer and        camera icon on the top right-hand side of the component.
17. Click on the Voice icon of the Response card to open up the Speak pop-up window and type the voice message welcoming the new user to the skill in the field titled Say.
Say: Welcome to the Vocabulary Bingo game. 

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: Vocabulary Bingo
Display Message: Welcome to the Vocabulary Bingo game.

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

18. Now drag and drop another Check Variable component onto the flow canvas.
19. Connect this Check Variable component to the Save Settings component that has been attached to the Then of the previously configured Check Variable component.

20. Now configure the Check Variable component with a test condition using the relational operator is greater than to evaluate the value stored in the system through Save Settings.  Here the purpose is to curate two different voice responses based on the counter > 5 i.e. one to address a user whose visit to the skill has exceeded five times and the other one for a user who has visited the skill five times or less.
1. Populate the left-hand side and right-hand side of the Configuration window as in the screenshot shown below. Set the data type based on the input.
Left-Hand side: settings.visitorCnt (choose data type as Path).
Right-Hand side:  5 (choose data type as Number)

21. Drag and drop another Response component onto the flow canvas and link it to Otherwise on the Check Variable component.

22. Roll the mouse over the Response component to see the voice, computer and camera icon on the top right-hand side of the component.
23. Click on the Voice icon of the Response card to open up the Speak pop-up window and type the voice action intended to be spoken to the user in the field titled Say to provide a suitable response if the test condition returns false i.e. the  Check Variable component upon evaluating the values stored in the system  recognizes the number of times the user has visited the skill as 5 or less than 5.
 Say: Welcome back to the classic Vocabulary Bingo game! Glad to see you visit {{settings.visitorCnt}} times. 

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: Vocabulary Bingo
Display Message: Welcome back to the classic Vocabulary Bingo game! Glad to see you visit {{settings.visitorCnt}} times. 

24. Now drag and drop another Check Variable component and link it to the Then on the preceding Check Variable component.

25. Configure the Check Variable component with a test condition using the relational operator Exists to check if the age of the user is saved within the system through Save Settings. The flow for the existing user will proceed from Then if the age of the user is existent, and the resulting flow will proceed from Otherwise if no values are existent in the system.
1. Populate the left-hand side of the Configuration window as in the screenshot shown below. Set the data type based on the input.

Left-Hand side: settings.Age (choose data type as Path)

26. Now drag and drop a Response component and link it to Then on the Check Variable component.

27. Roll the mouse over the Response component to see the voice, computer and camera icon on the top right-hand side of the component.
28. Click on the Voice icon of the Response card to open up the Speak pop-up window and type the voice action intended to be spoken to the user in the field titled Say to provide a suitable response if the test condition returns true i.e. if the user’s age is saved in the system.
Say: Welcome back to the classic Vocabulary Bingo game! Glad to see you visit  {{settings.visitorCnt}} times. It will be more fun this time as we have more games for your age.

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: Vocabulary Bingo
Display Message: Welcome back to the classic Vocabulary Bingo game! Glad to see you visit  {{settings.visitorCnt}} times. It will be more fun this time as we have more games for your age.

29.  Now drag and drop another Check Variable component and link it to the Otherwise on the preceding Check Variable component (as the user’s age is not existent in the system).

30. Configure the Check Variable component with a test condition using the relational operator Exists to check if the variable representing the Current Value of the Fibonacci sequence is saved within the system through Save Settings. The subsequent interaction flow will proceed from Then if the Current Value is existent, and the resultant flow will proceed from Otherwise if no Current Value is existent in the system.

  1. Populate the left-hand side of the Configuration window as in the screenshot shown below. Set the data type based on the input.

 Left-Hand side: settings.currentValue (choose data type as Path)
31. Now drag and drop an Add Variables component onto the flow canvas and connect the Otherwise of the preceding Check Variable component to it.

32. Configure the Add Variables component by adding the key-value pairs (Key:currentValue, Value: 1) and (Key:lastValue, Value:1) as shown below.  Adding the two variables lastValue and currentValue enables us to programmatically implement the Fibonacci sequence whereon it sets in motion the values to be generated through the loop cycle. Set the respective data types as Number.  

🖍Note: The purpose of configuring the Add Variables component is to perform the task of calling to action the value assigned using the variable name in the subsequent card within the interaction flow.

33. Drag and drop another Check Variable component onto the flow canvas and connect it to the Then on the preceding Check Variable component. To configure the component, use the relational operator is equal to as shown below to implement the Fibonacci series.
 Left-Hand Side: number (set data type as Function).
  Arguments: settings.counter (set data type as Path).
         Right-Hand Side: var.currentValue (set data type as Path)

Based on this configuration, all those times the value in the counter and current value match, the Fibonacci series is set forth. When that happens at defined intervals a curated message will be prompted to the user.
34. Drag and drop a Save Settings component on the flow canvas and connect it to the preceding Add Variables component.
35. Configure the Save Settings component to implement the counter, the number of which will act as the value parallel to the Current Value for the purpose of comparing which when matches triggers the Fibonacci series. The objective of configuring the Save Settings component is to execute the add function by adding value one (+1) to the numerical value saved within the settings.counter path.

🖍 Note: An alternative method to input the add function is by following the substep 1 of Step 11. The further substeps of Step 11 illustrates how to populate the relevant fields.

1. Then input the first argument as number to represent the numerical value with its
data type as Function by clicking the plus button that appears under the heading Arguments.
2. Click on the plus button that comes within the Arguments. In this sub-section add the path to which the value is saved. Here the input being settings.counter. Set the data type as Path.
3. Then click on the plus button that appears on the region outside of the subsection to add a second argument. The purpose here is to substantiate the first input argument.
4. Populate the field that appears with the numerical value 1 and choose its data type as Number.

36. Attach the configured Save Settings component to the Check Variable component (the configuration of which was completed in Step 33) that is attached to the Then of the preceding Check Variable component.

37. Drag and drop two Response components and attach one to the Then and the other to the Otherwise of the Check Variable component.

38. Click on the Voice icon of the Response card attached to Then to open up the Speak pop-up window with a field titled Say wherein you need to type the voice message to be relayed to the existing user in all those instances the test condition implemented in the Check Variable componentis satisfied, i.e. all those times the value in the counter and current value match, the Fibonacci series is set forth thereby prompting the curated message to the user at defined intervals.
Say: Welcome back to the classic Vocabulary Bingo game! Glad to see you visit {{settings.visitorCnt}} times. We have many games that vary in length and complexity to suit different ages.

39. Check the checkmark box in the Expect Response and type in the suitable Prompt message to proceed with the flow.
Prompt: Can you tell me your age?
The same message will be replicated in the Reprompt field which can be edited for brevity if need be.
Reprompt: Can you tell me your age? 

40. Populate the field under Expectations by selecting the Global Intent Next from the drop-down list and then click the Save button at the bottom of the window.

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: Vocabulary Bingo
Display Message: Welcome back to the classic Vocabulary Bingo game! Glad to see you visit {{settings.visitorCnt}} times. We have many games that vary in length and complexity to suit different ages.

41. Click on the Voice icon of the Response card attached to Otherwise to open up the Speak pop-up window with a field titled Say wherein you need to type the voice message to be relayed to the existing user in all those instances the test condition implemented in the Check Variable componentis not satisfied i.e all those instances when the value in the counter and current value do not match thereby nullifying the Fibonacci sequence.
Say: Welcome back to the classic Vocabulary Bingo game! Glad to see you visit {{settings.visitorCnt}} times. It will be more fun this time.

42. Check the checkmark box in the Expect Response and populate the field under Expectations by selecting the Global Intent Next from the drop-down list. 

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: Vocabulary Bingo
Display Message: Welcome back to the classic Vocabulary Bingo game! Glad to see you visit {{settings.visitorCnt}} times. It will be more fun this time.

43. Now drag and drop an Add Variables component onto the flow canvas.
44. Connect the anchor symbol of Next on the Response component attached to the Then of the preceding Check Variable component to the Add Variables component.

45. Configure the Add Variables component by adding the key-value pair (Key:tmpCurrentValue, Value: var.currentValue) that represent the values in the Fibonacci series. Set the respective data type as Path.

46. Now drag and drop another Add Variables component onto the flow canvas and connect the previous Add Variables component to it. To configure the component input currentValue as the key and add as its corresponding value. Set the data type as Function.  The purpose here is to increment the Fibonacci series using a loop.
1. Then input the first argument by clicking the plus button that appears under the   heading Arguments.
2. Populate the field that appears with the input var.currentValue and set its data type as Path
3. Click another plus button and populate the field that appears with the input var.lastValue and set its respective data type as Path.

47. Now drag and drop another Add Variables component onto the flow canvas and connect the previous Add Variables component to it.

48. Configure the Add Variables component by adding the key-value pair (Key:lastValue, Value: var.tmpCurrentValue). The value representing the last value is stored in tmpCurrentValue. Set the respective data type as Path. 

49. Now, drag and drop the Save Settings component onto the flow canvas and connect it to the Save Settings component linked to the Add Variable component which is connected to the Otherwise on the Check Variable Component.

50. To configure the Save Settings component add the key-value pairs as shown below. To save all the values in the Fibonacci sequence input currentValue as the key and var.currentValue as its corresponding value. Next, input  tmpCurrentValue as the key and var.tmpCurrentValue as its value. Lastly, input lastValue as the key and add var.lastValue as its value. Set the data type as Path for all three inputs.

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 Launch 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. 
6. Ensure to repeat step 5 three more times to validate the two voice responses one of which is prompted when the counter and Fibonacci sequence match and the other when the value in the Fibonacci series doesn’t match with the counter value.
7. Populate the User Settings sectionfield with the variable as counter andassign a numerical value 0 to which value one (+1) will be added. Then add the variable visitorCnt to represent and assign a numerical value 10 to which value one (+1) will be added. 

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 resulting Test Response window, the blue chat bubble will present the previously input message within the Response component to address the existing user when the Fibonacci series is executed and otherwise. The response that is prompted when the Fibonacci series gets executed within the skill when the test conditions in the Check Variable component are satisfied is highlighted below in red.

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 advanced version of an interaction model wherein the nth time starts a Fibonacci series backoff.

👍 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/

To access the tutorial on Every nth Time using MOD Feature, click here.

Tags:
Was this article helpful?
Dislike 0
Previous: Using Geocoder to Lookup Information
Next: CARTO – Select