Function Instructions | Yext Hitchhikers Platform
What You’ll Learn
By the end of this unit, you will be able to:
- Explain how to set up a function instruction
- Understand where functions are stored in the Yext platform
- List multiple use cases for the function instruction
Overview
Function steps leverage the Yext Functions framework to give Yext Chat access to user-defined serverless Typescript functions. This allows the bot to perform complex tasks like:
- Transforming, reading, and writing data to external APIs
- Using open-source libraries to manipulate or analyze data
- Performing complex business logic
The function has access to the full history of the conversation, including any collected data, as well as any additional context data you’ve provided.
Learn more about this instruction action type, in the Function Instruction reference doc .
Setting up a Function Instruction
To set up this instruction, you will need to, first, make sure you have a plugin created ahead of time. This is where you will reference the functions that your bot will utilize. Read more in this guide .
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.
- Plugin: A Plugin is a resource that contains at least one Function. Plugins can be configured on an account using the Yext CLI.
- Function: Select the function you want to use from your Plugin.
Example
The function instruction can be used for things like sending data that was collected in a previous Collect instruction to a third party.
Going back to the “Get a Demo” goal example from previous units, we can use the personal data gathered from the bot and send it to Marketo so they can be contacted via email by a marketing or sales team.
First, there needs to be a collect instruction to gather data like the user’s email address, name, and any other relevant information. Then you can set up a function instruction to send the field values to Marketo using a plugin configured in your account.