Closed anthowm closed 5 years ago
Hi @anthowm
Thanks for using our SDK. For the issue you post, I want to confrim your use case first. I see you have two intentHandler A and B, and you don't want to trigger B when A is not activated before. Then the solution depends on your expected behavior of the skill.
First, to detect whether intent A is triggered before, you can maintain a global variable or use our AttributeManager to record whether this intent handler has been triggered or not.
In your Intent B, you can add this condition check to canHandle funciton. Once intent B request comes in, and it fails the canHandle check, it may lead to no IntentHandler can handle that request. In that case, you can use errorHandler to return some alerts back to user.
Or you can add this condition check in the handle function of Intent B. Once it detected that A is not activated, you could define your behavior in your skill code such as use intent chainning feature to trigger A from B, or just simply throw error to trigger errorHandler.
However, if your use case is let service side never send Intent B request to skill until Intent A is activated. Our SDK side cannot support that.
Please let me know if it helps.
Thanks, Shen
@ShenChen-Amazon Hi thanks for ur reply, I take your first approach so I create a gameState as global var to handle it and it works but always trigger IntentReflectorHandler. How I return errorHandler can you share me the docs or an example. thanks !
Hi @anthowm,
The IntentReflectorHandler is used for interaction model testing and debugging. I don't know how you defined it, but I guess the canHandle function looks like this:
canHandle(handlerInput) {
return handlerInput.requestEnvelope.request.type === 'IntentRequest';
},
Therefore, it can means this handler can handle all IntentRequest and thus the incoming request can always find a handler to handle it. No error handler will be triggered as the request is well handled.
For your use case, I don't think its good to handle this situation in an error handler. I create a very simple sample so you can reference.
Thanks, Shen
Hi @ShenChen-Amazon Your example works for my project. Thanks, Shen !
I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release) [ ] Bug report [ ] Performance issue [ ] Feature request [ ] Documentation issue or request [X ] Other... Please describe: how to avoid my skill to trigger WaitAnswerIntentHandler if RandomLetterIntentHandler does not activate first.