question

jtmack avatar image
jtmack asked ·

How to switch context to another intent?

I believe there's something fundamental im not understanding with Alexa Dialog and the interface.


Basically, when the user invokes the skill, I need to check an endpoint to see if theyve registered. this registration is nothing more than the Lambda passing the alexa user id to an endpoint for storage. If we have the alexa user id, theyre registered. The problem is, I have to push them through a "registration" process... which means there needs to be dialog.


So the user fires the initial intent, and once it finds they need to register, i need to switch to the registration intent... how can i do that? What am I missing?


I'm hoping someone can help me.


Here's my flow...

User: Alexa, ask device skill what is my battery level?

[Starts with checkBattery Intent which checks endpoint finds user isn't linked.]

Alexa: Hello, it looks like your account is not linked. Please tell me your device ID.

[Switches to "registration" intent dialogState "STARTED" not sure how to do this part]

User: (user gets and read id from device to alexa) 986233

[dialogState "IN_PROGRESS"]

Alexa: Great thanks. Are you Steve from Detroit?

User: No.

[dialogState "IN_PROGRESS"]

Alexa: Okay lets try that again. Please tell me your device ID

User: 986223

[dialogState "IN_PROGRESS"]

Alexa: Great thanks. Are you John from Houston?

User: Yes.

[dialogState "COMPLETE"]

Alexa: Hi John, your battery level is 28%. What else can I help you with?

alexa skills kitslotsdialog modeldialog directive
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Akshita avatar image
Akshita answered ·

Hello there,

Inside the checkBattery Intent, first put conditions if user is linked. If he is, continue with the checkBattery Intent, if he is not then you can return to registration intent from checkBattery Intent by returning

return registrationIntent.handle(handlerInput);

This way you will return to registration intent from checkBattery Intent.

Hope this help you.



10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.