April 18, 2018Memo Doring
We are excited to announce version 2 of the Alexa Skills Kit (ASK) Software Development Kit (SDK) for Node.js. The updated SDK improves existing features and adds new ones to help you build skills faster and reduce complexity in your code. The ASK SDK v2 for Node.js provides the same core feature set and advantages as the ASK SDK v2 for Java that we announced last month.
We’ve improved the Request Handlers in the ASK SDK v2 for Node.js. In v1 of the SDK, each handler could handle only one kind of request determined by the request type. Now in v2 you can easily group request processing logic that applies to one or more request type. You can also use new Interceptors to invoke common logic that applies to multiple request types. By centralizing common logic, you can avoid duplicating code. We’ve also added Error Handlers in the SDK to allow you to gracefully respond to non-obvious errors in your code, such as missing handlers for infrequent events.
Data storage and retrieval in a skill can be useful for managing customer interactions either during a single session or across multiple sessions; for example, you store the customer’s spot in a story, their level in a game, and much more, and use the stored information to determine what happens next. The Attributes Manager provided in v1 of the SDK provided data storage and retrieval, but with limitations: you could store and retrieve data for your skill at only one scope, either for the given skill session for across sessions. If you chose to store data across sessions, you could only use Amazon DynamoDB as your backend store. We removed these limitations in the ASK SDK v2. The updated Attributes Manager allows you to store data at the level of the current request, the current skill session, and across multiple skill sessions. In addition, now you can use either DynamoDB or the external database of your choice for storing data across sessions. Finally, you now have multiple options for using the stored data – you can either use it to determine which request handler should be invoked for an incoming request, or by explicitly retrieving and processing it within your handlers or other code.
Alexa Service Clients enable you to easily make calls to Alexa services, and now we automatically inject endpoint and authentication token information for you. You can now rely on the v2 SDK to populate this information automatically rather than doing it in your code.
Improved Packaging and Tool Support
We’ve also made improvements to help optimize your development environment:
Download the ASK SDK v2 for Node.js from the alexa-skills-kit-sdk-for-nodejs repository on GitHub. You’ll find everything you need to get started, from a “Hello, world” sample to the complete technical documentation. If you want to update an existing skill built with v1 of the SDK, read the ASK-SDK-Migration-Guide on GitHub.