Built-in slots

There are some slots that are used so often, that both Amazon and Google provide built-in types - so that the developers don’t need to make the long lists manually. In BotTalk we try to provide you with the multi-platform experience, supporting following built-in slot types for both platforms:

Slot Type Example Value Type
@bottalk.color red, light brown, lemon, mauve, terra cotta, dark blue String
@bottalk.country United States, Germany, Mauritius, Japan, Uruguay String
@bottalk.date today, tomorrow, this week Unix Time format
@bottalk.duration ten minutes, five hours, three days Unix Time format
@bottalk.language Spanish, Tamil, Hindi, English String
@bottalk.phone-number plus one five zero nine five five five one two one two String
@bottalk.time noon, midnight, four twenty three in the morning Unix Time format
@bottalk.number three, nine eight zero three four, five thousand two hundred and thirty Number
@bottalk.name John, Paul, George, Richard, Marry String

None: If you want to target a specific platform with your BotTalk scenario, learn more about Amazon Alexa slot types and Actions on Google system entities.


Example

Consider the following example of our fictitious enrollment proccess, where you can even choose the language of your course and the start date:

Google Home: In what language you prefer the course to be?

User: German in my native language

Google Home: Great, your course Voice Interfaces will be in German. And when do you want to start?

User: Let’s start next week.

Google Home: Perfect, your German course Voice Interfaces is starting next week.

To implement this dialog you need the following steps in the Scenario section of the BotTalk editor:

- 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

- name: Language Step
  actions:
    - sendText: >
        Great, your course {{course_name}} will be in German. And when do you want to start?
  - getInput:
  next:
    starting_date: Starting Date Step

- name: Starting Date Step
  actions:
    - sendText: >
        Perfect, your {{language}} course {{course_name}}
        is starting {{ start_date | date("m.d.Y") }}.
  next: Exit

After you have your logic all lined up, you will need to create the intents for the phrases in the Intents section of the BotTalk editor:

---
intents:

  enroll_for_course:
    - 'enroll me for the course {course_name}'
    - 'enrollment for {course_name}'
    - '{course_name} enrollment start'

  language_preference:
    - '{language} in my native language'
    - '{language}'
    - 'I speak {language}'

  starting_date:
    - "let's start {start_date}"
    - "{start_date}"
    - "I want to start {start_date}"

Then you would define the built-in type of the language and start_date slots in the Slots section of the BotTalk editor:

---
slots:

  # Custom Slots
  course_name:
    - 'voice interfaces'
    - 'computer science'
    - 'german literature'
    - 'middle ages history'

  # Built-in Slots
  language: '@bottalk.language'
  start_date: '@bottalk.date'

Now it’s a good idea to test your scenario in the Test tab:

BotTalk Audio Tester


Written by Andrey Esaulov on 12 March 2019

Updated on 05 June 2019