botman / driver-amazon-alexa

BotMan Amazon Alexa Driver
MIT License
14 stars 11 forks source link

Passing shouldEndSession:true doesn't appear to be clear #6

Closed matthewbdaly closed 6 years ago

matthewbdaly commented 6 years ago

I've used this driver to build a simple Alexa skill (https://github.com/matthewbdaly/trainbot), but it's returning shouldEndSession as false each time it gets called, so it's failing when nothing else happens. It's not clear from the documentation how I can set this to true.

matthewbdaly commented 6 years ago

Figured it out in the end. Looks like you need to retrieve the bot instance (in a conversation, you can use the getBot() method), then pass as the second argument to reply() an array containing the key-value pair 'shouldEndSession' => true, as in this example.

$this->getBot()
             ->reply("My response", [
                 'shouldEndSession' => true
             ]);