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:

    - '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:

    - '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
        - sendText: 'Welcome to our Enrollment process. Which course do you want to enroll to? '
        - getInput:
        enroll_for_course: Enroll Step
        AMAZON.CancelIntent: Exit
        AMAZON.StopIntent: Exit
        AMAZON.HelpIntent: Help

    - name: Enroll Step
        - sendText: >
            Great, you wish to be enrolled to the course {{ course_name }}.
            In what language you prefer the course to be?'
        - getInput:
        language_preference: Language Step

Written by Andrey Esaulov on 12 March 2019

Updated on 12 March 2019