Skip to content

Instantly share code, notes, and snippets.

@jesuslg123
Created November 20, 2018 16:53
Show Gist options
  • Save jesuslg123/469dc20a504b2cc0f8e4c455928bc532 to your computer and use it in GitHub Desktop.
Save jesuslg123/469dc20a504b2cc0f8e4c455928bc532 to your computer and use it in GitHub Desktop.
Alexa persistance data on dynamoDB
//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