If you want to collect customer information, you must first ask for permission. This can be done in the Alexa developer console by navigating to Build > Permissions. You will see options like Device Address, Customer Name, and Customer Email that you can select and integrate into your skill.
After a user adds your skill, they will be prompted to grant access to their email address and any other requested information.
Once you have obtained permission, you can call the Customer Profile API using these two steps:
First, retrieve the access token:
accessToken = this.event.context.System.apiAccessToken;
It's important to remember that when using the token, the syntax is:
Bearer < ACCESS_TOKEN >
Now you can utilize the token to request the desired information from the API with the following request:
Host: api.amazonalexa.com
Accept: application/json
Authorization: Bearer MQEWY...6fnLok
GET https://api.amazonalexa.com/v2/accounts/~current/settings/Profile.email
For additional details and guidance, refer to the developer documentation available here.