Mauricio Cárdenas
Mauricio Cárdenas

Reputation: 484

How to avoid double slot input in Alexa skill

I'm working in a somehow-chained intent skill. These 4 intents are able to be called just after the user says "I want information about a career".

There are 4 intents that can be either the first one called, or called after another one. The thing is: The 4 of them require a career name slot, such as "engineering", "politics", "biology", and so on.

Is there any way to get the career on the first intent and then call the other 3 without needing to validate the user's input? If so, I'd really apretiate an example on how to achieve that.

Upvotes: 0

Views: 198

Answers (1)

Mike Liddell
Mike Liddell

Reputation: 2041

To implement conditionally-required slots and contextual carryover you will need to use custom skill code and directly manage the logic and issue slot-elicitation directives. So if you have been using a 'dialog model' and use the delegate-directive this may be a substantial change.

In your intent handlers: use session attributes to maintain a map of your slot types and values. When you see that an intent has an unfilled slot you can decide whether to take a value from the map or to elicit one. The logic will be custom to your scenarios.

To elicit a slot value manually, see https://developer.amazon.com/docs/custom-skills/dialog-interface-reference.html. Remember to set the intent and all the known slot values so that they are preserved through to the next Request.

Upvotes: 1

Related Questions