Accept raw text for Alexa skill

33 Views Asked by At

I am trying to create custom alexa skill and want to accept user input in raw text but unable to find the proper slot type for same. Can some one please help?

EX: What I am having for {mealperiod} at {locationName} {day}

eg. What I am having for lunch at xyz today

Thank you for help in advance.

Regards, Vishwesh

1

There are 1 best solutions below

0
Dave Curley On

The meal period should be a custom slot type with an exhaustive list of possible values e.g [ breakfast, brunch, lunch, dinner, supper ]

The day slot depends on what you want to capture. If you need a date, so that you can look it up or store it, you can use the AMAZON.DATE slot type. It understands "today" as well as many other ways of inputting dates, and resolves them all to a date, which you can then parse in your handler.

For your locationName slot if you can predict the range of possible values, either up front or dynamically, then you can use a custom (possibly dynamic) slot type with that range of values. If you need to accept unpredictable values like "school", “Joe’s Diner” or "the pizza place" then you will have to use a slot type like AMAZON.SearchQuery to get the raw input, then parse the value in your code. You might have to experiment and restructure your intent, because SQ slots can be tricky to work with. You may get better results if you make it the last slot rather than 2nd of 3.