Saving State to DynamoDB Before Each Response
Deep inside the Alexa Skills Kit Node.js SDK—not mentioned in the
README or at all on the Amazon website—is a property that could significantly change how your skill behaves:
saveBeforeResponse. As I pointed out in the line-by-line explanation of the SDK, this does exactly what it’s named as, but you might not know it was there. You might want this behavior when each intent is likely to cause a state change and you don’t want to force a save yourself (you can do this by emitting
:saveState with a second argument of
true to force a save).
This only works if you also have
dynamoDBTableName set as well, but if you do and
saveBeforeResponse is set to
true, then the session will be saved to DynamoDB right before the response is sent.
Short post, but hopefully helps a few of you out.