Requisites

Requisites are the main way to collect information from the user through Q&A.

They can be added to any text or event trigger and your virtual assistant can ask for a single or multiple pieces of information from the user within a single trigger.

You can be explicit when asking for information, by making a requisite required. Optional requisites can be skipped.

Fields

Requisites consist of the following fields:

  • CHECK FOR (Optional):

    Checks if an entity or context variable is present. If this field is not empty, the user's answer must match the specific requested value. Some requested values examples can be emails, payment methods or dates.

    info
    • Entities start with @ and context variables start with $.
    • You can check for nested context variables such as $user.email.
    • Entity values are used only for the specific dialog, while context variables are saved for the whole session.
  • SAVE AS:

    Saves the user's answer inside a context variable. You can also save variables into a nested object. For example, you can save a variable as $user.phone to fill the user's phone number.

    note

    In the cases where you fill the CHECK FOR field with an entity, the brain creates two variables in the context. The first one has the name you specify in the SAVE AS field and its value is what the user types. The second one has the suffix _value on what you have specified and its value is the entity corresponding to the user's response.

  • IF NOT PRESENT, ASK (Optional): If the value is not present in the dialog (entity), or the session (variable), you can set up a question to ask the user to get the answer you need. This automatically makes the requisite required.

  • TYPE: Checks that the user's answer is of one of the following types:

    Any Number Text Email Phone URL Integer

    This field only shows up when the IF NOT PRESENT, ASK question is filled and the CHECK FOR field does not contain an entity.

  • ASK AGAIN QUESTION (Optional): If the first question, the one in the IF NOT PRESENT, ASK field does not satisfy the validation, which is either the entity of the CHECK FOR field or the TYPE otherwise, you can ask the user again.

It is important to note that the requisites of a trigger always take place before any of the responses. You can also see this in the simple input extraction example below.

Add a new requisite

  1. Create a text or event trigger.
  2. Click on the trigger.
  3. Select the Requisites tab on the right-hand side.
  4. Click + Add requisite.

You can also fill the IF NO REQUISITES field, which sends a message to the user if all requisites are optional and not filled.

Cases

Below, you can find some examples of cases you might find useful.

Simple input extraction

In the example below, you can find a case of simple user input extraction. More specifically, the first and last name of the user are extracted with the use of requisites. When the user writes a message that the brain recognizes as #greetings, it will begin the process of learning the user's first and last name. For both requisites, the Check for field is empty, because the user's answer doesn't have to contain any entities or context variables. The virtual assistant saves the user's answer in new context variables called $firstname and $lastname respectively, by asking the corresponding question given by the If not present, ask field. As you can see in the Chat image below, the assistant asks for the requisites before any of the responses.

Requisite in entity

In this example, you can see the use of a mandatory requisite with a Check for field. More specifically, the virtual assistant is able to extract an answer from the user, which must be constrained with regards to a predefined entity. As we can see from the example, when the trigger for booking a flight is activated, the virtual assistant asks the user to fill an airline requisite. In this case the airline is an entity and can only take two values: Delta or American Airlines. Thus, any answer from the user must belong in the @airlines entity. If not, then the requisite question (given by the If not present, ask field) will be asked again. You can also see this from the Chat image below. It is worth noting that the type field is set to text in this case, as the expected answer is an airline.

Last updated on