Collect Instruction Type | Yext Hitchhikers Platform

Collect steps are used to solicit information from the user. Often this collected data is used later on in another step. This can be useful for asking the user:

  • For their name, email, phone number, or other personal information
  • For their order number, confirmation ID, etc. in order to look up details
  • To choose between one of several options and later trigger conditional logic

Each collect step requires specifying the fields that the bot should collect. For each field, you must defined the following properties:

  • id - each field needs a unique ID. This ID can be referenced in later steps and used in REST API calls or serverless functions.
  • type - the data type of the field. This can be STRING, NUMBER, BOOLEAN, ENUM, EMAIL, or PHONE.
  • optional - whether the field is optional. If the field is optional, the bot will move on to the next step even if the user hasn’t provided it. A collect step needs at least one non-optional field.
  • description - the natural language description of the field. This helps the bot understand what the field is and how to ask for it. The bot also uses this description in parsing the conversation to extract data.

Given these fields, the bot will recursively prompt the user for the data until it finds that the user has given all the data the step requires.

Example:

{
  "collect": {
    "instruction": "Ask the user for their name and email address",
    "fields": [
      {
        "id": "name",
        "type": "STRING",
        "description": "The user's first name and last name",
        "optional": false
      },
      {
        "id": "email",
        "type": "EMAIL",
        "description": "The user's email address",
        "optional": false
      }
    ]
  }
}
Feedback