alexa-app icon indicating copy to clipboard operation
alexa-app copied to clipboard

Get the entire session object

Open ajcrites opened this issue 7 years ago • 2 comments

VoiceLabs has some recommendations for how to use alexa-app to track usage. Currently they document using VoiceInsights.track(req.getSession(), ... but this does not work as expected because the session object you get is an instance of alexa.Session that adds additional functionality and encapsulates some parts of the session. Using req.getSession().details is also kind of ugly and still doesn't work due to #215

It is possible to get the session directly from request.data.session, but I think we want to avoid accessing raw properties as much as possible.

I propose a method, request.getRawSession() that returns a deep copy of the session object as it was passed from Alexa. I'm not in love with that name, though, so I'm open to other suggestions for that and how to handle this issue in general.

ajcrites avatar Apr 02 '17 16:04 ajcrites

Well I slightly disagree with a separate method for just getting the session object. request.data should be returning the original JSON, as noted in alexa-app/index.js at line 176, so maybe we should convert that into a method such as request.getData().

tejashah88 avatar Apr 02 '17 17:04 tejashah88

I merged #215 so that at least solves part of the problem, cc: @danielstieber. Not sure what we should do about this one.

dblock avatar Apr 15 '17 21:04 dblock