alexa-app
alexa-app copied to clipboard
Get the entire session object
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.
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()
.
I merged #215 so that at least solves part of the problem, cc: @danielstieber. Not sure what we should do about this one.