VOGO Voice – Knowledge Base

find Function

Estimated reading time: 5 min

In this instructional tutorial, you will gain the necessary knowledge to write the find function besides learning how to use it to find data from a collection. Moreover, the find function iterates over the elements of the collection and returns the first element which matches with the condition. This method is therefore used to return an element that satisfies the condition. The two parameters are the collection and the key-value pair i.e. the value that needs to be matched.

The comprehensive instructions combined with highlighted screenshots will offer the required directions needed to implement the aforementioned function with ease within the custom voice skill. The following tutorial is illustrated by means of a use case that demonstrates how to obtain the information regarding the user’s choice of juice on the fruit bar menu by utilizing the find function. Herein, the find function is implemented for fetching specific data based on the users’ requests concerning the beverage of their choice.


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

Create a Custom Slot

Make a custom slot named Juice and add as slot values the names of some juices, such as, “Hardcore One”,  “Celery One”, “Red”, “Orange”, “Recovery One”, and “Creamsicle One” as shown below.

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

Create a Custom Intent

Make a suitable intent to be invoked for executing an interaction flow mapped to it.

Create an intent titled ‘Fruit Juice Info’ with suitable sample utterances linked to it. The sample utterance for this intent would be: “Can you tell me about {name}”, “{name}”, “Tell me about {name}”, and “What is {name}”. These sample utterances will serve the purpose of updating the user with the necessary info on their choice of beverage.

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

Steps to create an interaction flow

  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. Now, click on the Interactions button at the bottom right-hand corner of the screen. Select the ‘Fruit Juice Info’ intent to be directed onto the Interaction builder platform.

4. In the flow diagram area, you will be able to see the Start and Response components.

5. Unlink the Start component from the Response card by clicking the delete icon placed in the middle of the chain.

6. Now, drag and drop an Add Variables component onto the flow diagram area.

7. Now mouse over the top right corner of the Add Variables component. Click on the pencil icon that appears. This will open up its configuration window. 

8. Configure the Add Variables component by adding the key-value pairs as shown in the screenshot below. Fill in the first variable name as menu and add the array as the value in it, the format, and content of which is provided below in detail. This array contains a list of different types of juices at the fruit bar and their ingredients. If the juice is available the status will show up as available and vice versa. Then, set the datatype as Array.  To know more about data types, click here.

"id": 1,
"name": "The Hardcore One",
"type": "Fresh juice",
"status": "Available",
"ingredients": "Celery, Cucumber"
"id": 2,
"name": "The Celery One",
"type": "Fresh juice",
"status": "Available",
"ingredients": "Celery, Lemon"
"id": 3,
"name": "Red",
"type": "Cold pressed juice",
"status": "Available",
"ingredients": "Apple, Beet, Carrot, Lemon"
"id": 4,
"name": "Orange",
"type": "Cold pressed juice",
"status": "Available",
"ingredients": "Orange, Carrot, Pineapple, Turmeric"
"id": 5,
"name": "The Recovery One",
"type": "Protein smoothie",
"status": "Available",
"ingredients": "Hemp or Whey protein, Strawberries, Banana, Almond Butter, Almond Milk, Vanilla, Honey"
"id": 6,
"name": "The Creamsicle One",
"type": "Protein smoothie",
"status": "Available",
"ingredients": "Hemp or Whey protein, Orange, Banana, Almond Milk, Vanilla, Honey"

8. Now add another variable in the same Add Variables component and configure it as illustrated below. Name the newly added variable as juice. To fulfill this step, a find function needs to be added.

9. To add the find function in the value field, navigate to the Data tab adjacent to the Components on the top left-hand side of the interaction builder platform. 

10. Click on the Data part and in the search bar type ‘find’. From the drop-down that appears, click on the plus button beside the collection, and this will bring up the find function as shown below.

11. Drag and drop the find function in the value field corresponding to the juice variable name. This will automatically generate the find function in the respective field. Now continue to configure as illustrated below. Click the plus button that appears under the heading Arguments and add the first argument as var.menu which is the array that contains the list of juices in the fruit bar. Retain the data type as Path for the first argument. Set the second argument as {“name”: “{{inputs.name.value}}” } i.e.the key-value pair that needs to be found from the array. Set the data type as Object for the second argument.

🖍 Note: Here, the var.juice will have the first element which satisfies the second argument from the var.menu array.

12. Now drag and drop a Response component onto the flow canvas and connect it to the already configured Add Variables component as shown below.

13. Configure the Response component as shown right below. To proceed click on the Voice icon on the top right-hand side of the Response component. Clicking on the voice icon opens a Speak pop-up window with a field titled Say wherein you need to type the following response.

Say: {{var.juice.name}} contains {{var.juice.ingredients}} and is {{var.juice.status}} now.

👍 Note: The information regarding the user’s choice of beverage is provided by each of the following template engine .i.e. {{var.juice.name}} provides the name of the juice while {{var.juice.ingredients}} lists the ingredients of the juice, and {{var.juice.status}} updates its availability. 

🖍 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 display voice-assisted device.

  1. Click on the Computer icon, and type in the field titled Display Message of the Show pop-up window. 
  2. Populate the required fields and click the Save button

Title: Juice Info
Subtitle: {{var.juice.name}}
Display Message: Type: {{var.juice.type}}
                    Ingredients: {{var.juice.ingredients}}
 Status: {{var.juice.status}}

🖍 Note: The display will render information about the juice as in the Say part but in a condensed version.

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

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 in the Name field of the Test Response window that shows up. In the Conversation section of the Test Response, the Fruit Juice Info intent through which this interaction flow has been initiated will be auto-generated in the User invokes field as shown below.  Click Save to perform the test.

4. Fill the With slots field titled name under Conversation with “Red”; the name of one of the juices. Click Save to perform the test.

5. To validate the Test Response, click on the lightning symbol on the left-hand side of the test case as shown below.

6. The resultant Test Response window displays the output.

Congratulations! You have successfully learned how to implement the find function to find matching data in the custom voice skill to efficiently address the end-users specific requests.

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

Was this article helpful?
Dislike 0
Previous: filter Function
Next: Delete Settings in Code Block