Define the Slots

Right information falling into a wrong slot becomes misinformation.

Slots describe the input and output fields associated with the intents, which are used for processing the intent. These might also include the inputs for the Web Api requests, if any, associated with the intent. You can define the Slots by using the slot button under the Action column. You can read more on Slots in our configuration section on Slots.

Define Slots

In our example case of applyLeave, we would need three inputs, for which we will create slots.

  • startDate

  • endDate

  • leaveReason

The startDate and endDate are of Date type. The leaveReason is a custom type, which would specify the type of leave. We will get to that in a bit. Before that, let us complete the definition of startDate and endDate.

Templates

We can use the Templates to read multiple inputs together from user utterances. For example, for the startDate, we can define the template as "leaves from ${startDate} to ${endDate}". This would ensure the startDate and endDate are filled when the user utterance is similar to any of the following.

 "I need a leave from 20th of feb till 24th "
 "I need a leave from tomorrow till 24th "

The Templates can be instructed to support multilingual functionality if the bot was designed to the multilingual. You can enable the functionality by using the Auto-translate flag.

Prompts

In addition, you can also define Prompts for each of the slots if the User fails to provide the required inputs. These are the messages which the chatbot would ask the user when there is missing information. For example, for the startDate the prompt could be defined as

From when are you planning to go on leave?

Similarly, the prompt for endDate could be

O.K. till when ?

Define Custom Type Slots

Until now we have created slots using system-defined types. We will now proceed to create a Custom Data Type to describe the type of leave and create a slot using the same data type. We will use the Entities & Other Data -> Custom Entity Types for defining the custom entity.

As seen in the image, we have created a Custom entity, leaveReason which would describe the reason for the leave applied. We will now proceed to define the slot using Custom Type.

The _Slot Type _ for the leaveReason slot is Custom. The Custom Entity Type allows you to select the custom entity you have defined in the previous step. Once again, we can use the templates to identify the leaveReason values from user utterances. For example

I'm not well ==> Medical

We could also prompt the user for specifying the reason for leave application if he doesn't specify it himself. We could use custom values for prompts. For example,

OK. Why do you want the leave ? [[EXT:BUTTON|Medical|Casual]]

This would show a prompt including the possible reasons for leave as shown in the image below.

We will now proceed to define the triggers.

Last updated