Created
November 20, 2018 16:53
-
-
Save jesuslg123/469dc20a504b2cc0f8e4c455928bc532 to your computer and use it in GitHub Desktop.
Alexa persistance data on dynamoDB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Change roles to allow access to DynamoDB | |
exports.handler = skillBuilder | |
.addRequestHandlers( | |
.... | |
.... | |
) | |
.withAutoCreateTable(true) | |
.withTableName('Favorites') | |
.addErrorHandlers(ErrorHandler) | |
.lambda(); | |
//Read persisted data | |
const attributes = await handlerInput.attributesManager.getPersistentAttributes() | |
//Edit data | |
attributes.favorites = { | |
name: 'Casa', | |
stopId: 354 | |
} | |
//Set data | |
handlerInput.attributesManager.setPersistentAttributes(attributes); | |
//Persist data | |
await handlerInput.attributesManager.savePersistentAttributes(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment