Is there a way to temporarily redirect from one intent to another in order to fill slots or session attributes and then return to the original intent to be responded to or fulfilled?
My use-case is for asking for an account PIN as a secondary authentication after account linking. For instance, if someone asks "What are my account details?", I want that intent to change in the session attributes if it exists and if not, temporarily redirect to an intent that will prompt them for the PIN and set it...then come back and answer their account details request. Similar to the example below:
const IntentHandler = {
canHandle(input) {
return (
input.requestEnvelope.request.type === 'IntentRequest' &&
input.requestEnvelope.request.intent.name === 'MyIntent'
},
handle(input) {
const { accessToken } = input.requestEnvelope.context.System.user
// ... do stuff with accessToken
if (!input.attributesManager.getSessionAttributes().pin) {
// redirect to other intent to set the pin session attribute
}
// ...response to intent request
}
}
I can get this working with a single intent using slot filling prompts but this is a common task for several intents and would like to separate it out so it doesn't have to be configured in the console for all that require it.
FYI: using the ask-sdk for Node.js
Is this possible with the current version of the ask-sdk?