Welcome to brianmacintosh.com. I'm Brian MacIntosh, and I am a game programmer in the Orange County area of Southern California. This site serves to host and distribute some of my games and my blog, below.
I have developed games and apps for the XBox 360, Windows PC, iPad, Amazon Alexa, and Windows 7 Phone. I'm particularly interesting in procedural generation, pixel art, and emergent gameplay, and I'm looking forward to developing more games with these technologies.
Persistent data in the Alexa Skills nodejs SDK
February 05th, 2017 @ 0:59
Tags: alexa, nodejs, random
I recently started use the Alexa Skills Kit SDK for nodejs to write an Amazon Alexa skill. I ran into one rather silly roadblock, which I will now share so others can avoid.
This SDK handles persisent data (with the same session and across sessions) by providing an
attributes property on the skill handler (accessed by
this.attributes). My problem was that sometimes properties I set on this object were apparently completely ignored by the next request (even if I kept the session open with an
this.emit(":ask", ...) response). It is perhaps obvious in hindsight, but you must make all your changes to
this.attributes before calling
emit will immediately and synchronously prepare and send the response to Alexa, including the attributes you're trying to persist into the next session. But it took me quite some time to figure this out.