# Define the Slots

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.

![](https://2566128011-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUn1oKrw7P8P5qiTjWXjv%2Fuploads%2FtGWExifzRz1IyvrDqfiM%2Fcreate-intent.JPG?alt=media\&token=e21bceff-5ff0-4723-a686-e7fd61d0a37b)

## Define Slots

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

* startDate
* endDate
* leaveReason

![Slots](https://2566128011-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUn1oKrw7P8P5qiTjWXjv%2Fuploads%2FpsdnTNw8726gpXeJdgJp%2Fslots.JPG?alt=media\&token=73bb1661-ea8a-41cc-9863-af3701019ae1)

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

![Templates for startDate and endDate](https://2566128011-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUn1oKrw7P8P5qiTjWXjv%2Fuploads%2FbJzNMm01zWHV23U3Gl8t%2Fslot-templates.JPG?alt=media\&token=8ad52e00-2746-46b1-b193-2f210d582fea)

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

![Prompt for startDate](https://2566128011-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUn1oKrw7P8P5qiTjWXjv%2Fuploads%2FmQaeWPLW6gpmX23typs3%2Fslot-prompts.JPG?alt=media\&token=79a7fbc8-869c-4da8-9c6f-8a2f97a49549)

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 ?
```

![Prompt for endDate ](https://2566128011-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUn1oKrw7P8P5qiTjWXjv%2Fuploads%2FnP2xdctrL4IvepVVxJTf%2Fslot-prompts_endDate.JPG?alt=media\&token=6f8c9f4a-872d-48f9-9675-b1578784b8db)

## 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.

![Custom Entity Type](https://2566128011-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUn1oKrw7P8P5qiTjWXjv%2Fuploads%2F8nIk2OTvlsBqHk8UlsrZ%2Fentities-custom-entity-type.JPG?alt=media\&token=4148567b-7e55-43ce-8fcd-540081ef5b77)

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.

![Slot using Custom Entity Type](https://2566128011-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUn1oKrw7P8P5qiTjWXjv%2Fuploads%2FZWnc679IIQiSIa6Trn9I%2Fslots.JPG?alt=media\&token=d066683d-3ed3-44ac-b610-7b2c90081893)

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.

![Prompt using predefined values](https://2566128011-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUn1oKrw7P8P5qiTjWXjv%2Fuploads%2FDVHMk7QB7LwT99OgKY3K%2Fprompt-leave-reason.JPG?alt=media\&token=81c44fb1-2bb7-4c14-a292-3cdfda32782c)

We will now proceed to define the triggers.
