maxbeckers/amazon-alexa-php

Ho can use StopDirective?

ephp opened this issue · 2 comments

ephp commented

At the end of my demo, if at question "do you want continue?" I respond "no", I would like send a last message "bye" then send a Stop directive.

my code in handleRequest method is

case 'AMAZON.NoIntent':
    $directive = new StopDirective();
    $this->responseHelper->directive($directive);
    return $this->responseHelper->respond("See you next time!");

the in othe block

    if ($request->request instanceof \MaxBeckers\AmazonAlexa\Request\Request\Standard\SessionEndedRequest) {
        return $this->responseHelper->respond("Bye");
    }

but the response is

{
    "body": {
        "version": "1.0",
        "response": {
            "directives": [
                {
                    "type": "null"
                }
            ],
            "type": "_DEFAULT_RESPONSE"
        },
        "sessionAttributes": {}
    }
}

and Alexa send a Error...

How can I solve?

Hi,
i dont understand, why you want to use the StopDirective, do you have an audioplayer skill? To end the session and close the skill you can simply set the second param of respond to true.
Is that what you want to do?

ephp commented

Sorry, I didn't understand how Directives were used. I actually have great difficulty managing the SessionEndedRequest. The test page of skill give me always an error.
I use Symfony, and I try to override the controller of your bundle, but I don't find any solutions