Select Instructions | Yext Hitchhikers Platform
What You’ll Learn
By the end of this unit, you will be able to:
- Define what a select instruction is and how users interact with it
- Explain the difference between a select and collect instruction
- List the requirements for creating a select instruction
Overview
The select instruction behavior is similar to that of the collect instruction, as the bot will read and store a response from the human, to be used in another step. The collect instruction can let users choose between one of several static predefined options (i.e., the enum field type configuration), however, the select instruction is different because it allows users to choose a value from a dynamic list of options.
Select instructions are used to solicit a selection from the user. This can be useful for:
- Asking the user which option they would like
- Confirming previously collected data
Setting up the Select Instruction
Before beginning, it is important to understand that in order to use the select instruction, you need to use it in conjunction with the REST API instruction. This is because the options for the list must be data already stored in the queryResults
of the API response. It is from this data that the select step builds its options.
Once you are in the Add/Edit an instruction modal, you have the following inputs to complete:
- Instruction: A description of what you want the bot to do.
- Enable Suggestions: When this toggle is on, the bot will generate suggested replies for the user. This will be displayed as clickable messages at the bottom of the preview.
- Field ID: An identifier for the selected option. This can be used later to inform other instructions.
- Results Path: This is the JMES Path, within “queryResults”, to a list that contains options that will be presented to the user.
Example
Below, we will walk through an example of how to use the select instruction to give users a list of doctors to choose from to make an appointment with.
First you would create the goal and name it something like “Make an Appointment” which will have collect, REST API, select, and reply steps instructions within it.
The collect instruction would be used to gather information about the kind of doctor a user wants to see (e.g., a cardiologist that accepts cigna insurance). The GET REST API instruction will then use that information to pull a list of relevant doctors via an API call.
Once Chat has the data for which doctors are relevant for the users appointment, the select step will return a list of cardiologists for the user to choose from. The select instruction could be setup as so:
- Instruction: “Have the user select one doctor based on the list of doctors from the previous step’s API response. Use the doctor’s name for the option label. Provide no more than three selection options”
- Field ID:
doctor_selection
- Results Path:
response.modules[].results[]
Lastly, the reply instruction will use the doctor_selection
field to confirm the appointment using the following instruction description: “Great. We have you scheduled to see [[collectedData.doctor_selection]]”.
If you opt to turn on the enable suggestions feature, the options provided by the select instruction will also be returned as clickable options at the bottom of the preview. User can select an option rather than having to type in an option, which could help reduce user error or entice users to continue the goal flow.