Instructions | Yext Hitchhikers Platform
What You’ll Learn
By the end of this unit, you will be able to:
- Add, modify, and delete an instruction within a goal
- List the seven instruction actions
- Explain the use case for adding embedded fields within an instrucion
Overview
Instructions tell your bot what it needs to do in order to complete a goal or overall task. They are formatted as step-by-step instructions that the bot will run through. For example, if a user asks a question about your brand, the bot will need to do a couple of things. First,_ it will search for the answer (from a source like Yext Content) and then it will need to reply with the information it finds.
You have the ability to control how your bot acts on a certain query using various instruction action types. There are 6 different actions to choose from:
-
Reply:
Gives a response to the user. Reply steps are unique because they terminate the goal (similar to the
return
keyword in most programming languages). Therefore, if you use any of the other types listed below, you will need to follow it up with a reply instruction! - Collect: Prompts the user for information - such as the user’s name, phone number, or order number. This collected data can then be used in later instruction steps within a goal.
- Select: Prompts the user to choose a value from a list of predefined options.
- Search: Queries a Yext Search experience for data relevant to a user’s question.
- REST API: Sends an HTTP request to a REST API endpoint, potentially using data from a collect step.
- Function: Executes a Yext Serverless function, potentially using data from a collect step.
- IF: Allows you to use conditional logic. It first evaluates if a condition is true and, if so, starts executing a series of nested steps.
Adding an Instruction
To add an instruction, click the +Add Instruction button on the Instructions tab of your goal. This will open the “Add/Edit an instruction” modal for you to fill out the following inputs:
- Instruction: This is a description of the step you want the bot to do
- Action: This corresponds to one of the instruction types. It tells the bot what type of action it will take for a specific step. Each action type has a set of configuration criteria.
Which instruction action you choose will determine the other inputs you need to complete in the modal. We will talk more about these in depth in the next module.
Embedded Fields
As you write each instruction, you have the ability to embed fields by clicking the + icon at the bottom right corner of the text box. These fields can be information gathered from:
- A collect step (
collectedData
) - Results from search or an API call (
queryResult
) - Context set within the frontend of your bot (
context
) - A search query from a previous search instruction (
searchQuery
)
If the platform detects fields from previously created instructions within the same goal, they will auto-populate in the dropdown. For example, the first step in a “Find a Doctor” goal collects the users insurance provider. If you want to use that collected insurance provider field in another instruction in the same goal, it will be readily available in the dropdown.
Otherwise, the dropdown will provide placeholders (appended with ??
) for you to manually input fields you want to use.
Editing an Instruction
To edit an existing instruction, hover over the step you want to modify. Once you click the pencil icon next to the step, the “Add/Edit an instruction” modal will open up with the settings for that step. From here, you can update any of the existing inputs.
Reordering Instructions
You can change the order of instructions by hovering over the icon on the left side of the instruction you want to move. This will then give you the option to drag that instruction to a new position in the sequence. The steps order and numbering will change automatically once an instruction is moved.
Deleting an Instruction
To delete an existing instruction, hover over the step you want to remove and click the trash icon. This will remove that step from your goal and renumber the remaining steps accordingly.