question

Fabián Romo avatar image
Fabián Romo asked

sessionId in a Lambda function can be the ID of an Alexa skill?

Hi.

I have a skill developed in Alexa which is linked with a lambda function in AWS.

In the lambda function when I start the session I have the following function:

[code]
function onSessionStarted(sessionStartedRequest, session)

{

console.log("Session starts");

console.log(`onSessionStarted requestId = ${sessionStartedRequest.requestId}, sessionId = ${session.sessionId}`);

}

[/code]

Can sessionID be linked to the alexa account ID of who ran the skill?

lambdaalexa skillsaws iot
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Andy Whitworth avatar image
Andy Whitworth answered

A sessionID is allocated by Amazon for each skill session and is not directly releated to the user who invokes the skill.

There is a userID also allocated by Amazon when a user enables a skill. That userID will be constant for all sessions for that skill by the user. If the user disables and re-enables the skill then a new userID is generated for all subsequent skill sessions.

What are you trying to do ?

5 comments
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Fabián Romo avatar image Fabián Romo commented ·

Thanks for answering.


I have a hardware based on a microcontroller and the Shadows demo example to activate and deactivate outputs based on voice commands from an alexa skill. This works very well.


What I want is to have a single skill for different hardware. This is to somehow identify in the lambda function the user id of the Alexa account that is using the skill and send this id to the SHadow document.


In this way, said ID number would reach the hardware. The Alexa user ID would also be stored in the hardware. This way it could compare the ID it has stored with the ID that arrived and decide if it should activate or deactivate the outputs.


I know there is a way that something is saved in the dynamoDB database, the hardware consults that database, etc. A more complex and secure pairing process, but for now I want to do something simpler, for testing purposes, then I would think to try to learn how to pair it in a more professional way

0 Likes 0 ·
Andy Whitworth avatar image Andy Whitworth Fabián Romo commented ·

You can request the EMail account of the Alexa account owner:

https://developer.amazon.com/en-US/docs/alexa/custom-skills/request-customer-contact-information-for-use-in-your-skill.html

Perhaps that's good enough ?

1 Like 1 ·
Fabián Romo avatar image Fabián Romo Fabián Romo commented ·

Thanks for the suggestion.


I have read about the permissions card. In the lambda function, where can I get these parameters (email, name, etc)?

0 Likes 0 ·
Andy Whitworth avatar image Andy Whitworth Fabián Romo commented ·
1 Like 1 ·
Show more comments