bespoken / virtual-alexa

:robot: Easily test and debug Alexa skills programmatically
https://bespoken.io
Apache License 2.0
112 stars 35 forks source link

request builder - confirm intent requires named dialog to exist #110

Open xcobbler opened 5 years ago

xcobbler commented 5 years ago

Description:

When using the request builder, sending confirmed intents is requiring dialogs with the same name to exist in interactionModel/dialog/intents. For skills that don't want to always confirm to the user every time, a programmatic confirmation will be used. it's my understanding that when the model is made is the developer console, the interactionModel/dialog/intents part will only be present if the intent requires confirmation. the model can be updated explicitly state that the intent doesn't require confirmation...but that causes issues with upsells in the intent.

Environment:

Steps To Reproduce

Steps to reproduce the behavior:

  1. create an intent with no required intent confirmation (the interationModel/dialog/intents for the intent should be missing)
  2. programmatically have the intent return an intent confirmation
  3. write a test to hit the piece of code that is after the intent confirmation is sent

Expected behavior

Since it is not required to have the interationModel/dialog/intents present in the model, the automated test framework shouldn't crash complaining that there is no dialog for the intent. from a manual testing framework using the developer console, everything works with the model part missing.

Actual behavior

Error: No match for dialog name: SomeIntent

Code example

result = await alexa.request()
.intent("SomeIntent")
.intentStatus("CONFIRMED")
.send();

model change that shouldn't be required

{
    "name": "SomeIntent",
    "confirmationRequired": false,
    "prompts": {},
    "slots": []
},

Additional context

The 2 reasons that I feel that this manual model change shouldn't be required is because:

  1. the developer console doesn't produce this part of code
  2. this piece of code appears to cause issues with upsells (https://forums.developer.amazon.com/questions/207372/upsell-not-responding.html)

The overall process of what i'm trying to do is:

  1. user requests an action which requires in-game currency to perform.
  2. if the user doesn't have the required currency, an upsell to buy more is suggested (confirming the buy implicitly confirms the action).
  3. if the user does have enough in-game currency, an intent confirmation is returned to the user asking the user if they want to spend x amount of in-game currency.

As mentioned in the link above, adding these model changes actually causes issues during runtime with upsells. So the workaround I have is to change the model locally but don't push it which is kind of annoying.