Custom slots
You can define any number of slots that are unique to your scenario. Defining a slot is pretty easy. Just head over to the Slots section of BotTalk editor and add the slot name followed by possible values:
---
slots:
course_name:
- 'voice interfaces'
- 'computer science'
- 'german literature'
- 'middle ages history'
In this example the slot name is course_name
and the possible values (what you are expecting the user to say) could be one of the following:
voice interfaces
computer science
german literature
middle ages history
You can now use this slot name in your Intents section using the single curly braces like this:
---
intents:
enroll_for_course:
- 'enroll me for the course {course_name}'
- 'enrollment for {course_name}'
- '{course_name} enrollment start'
Furthermore, when the user will execute the intent - and fill the slot with either of the values, the slot name will automatically be converted into a variable.
You can further use this variable in your Scenario, for example giving a user feedback about the course she chose. To use the slot as a variable, just simply inclose the name of the slot in the double curly braces:
- name: Initial step
actions:
- sendText: 'Welcome to our Enrollment process. Which course do you want to enroll to? '
- getInput:
next:
enroll_for_course: Enroll Step
AMAZON.CancelIntent: Exit
AMAZON.StopIntent: Exit
AMAZON.HelpIntent: Help
- name: Enroll Step
actions:
- sendText: >
Great, you wish to be enrolled to the course {{ course_name }}.
In what language you prefer the course to be?'
- getInput:
next:
language_preference: Language Step