Releases: alexa/alexa-skills-kit-sdk-for-nodejs
Release of [email protected]
This release contains a bug fix of parsing SSML string.
Release of the ASK SDK v2 for Node.js
2.0.0 Release of ASK SDK v2 for Node.js
Enable customized dynamoDB client, fix typos and bump version to 1.0.25
This release added a dynamoDBClient property in alexaRequestHandler so that developer can use their own dynamoDB client, if the dynamDBClient is null, then it will use the default one. The example code of inserting dynamoDB client is as blow:
exports.handler = function(event, context, callback) {
const alexa = Alexa.handler(event, context);
alexa.dynamoDBClient = new aws.DynamoDB({
endpoint: "http://localhost:8000",
apiVersion: '2012-08-10'
});
...
}
Readme update and bumping version to 1.0.24
This release includes readme update to reflect the latest SDK changes.
Adding userAgent to track the SDK version and language version
This release added the userAgent to track the SDK version and language version.
Manually setting shouldEndSession, bug fix and minor code refactoring
This release added a method shouldEndSession() in responseBuilder to enable setting the shouldEndSession value manually.
This release fixed a bug in ListManagementService so that it supports list API call in Japanese skill.
This release used the ServiceError in DirectiveService, it also did minor code refactoring, eg, using const/let instead of var, using single quote instead of double quotes.
Support for BodyTemplate7
This release adds SDK support for the BodyTemplate7 for display interface
An example to add bodyTemplate7 to Display.RenderTemplate
is as follows:
const builder = new Alexa.templateBuilders.BodyTemplate7Builder();
const template = builder.setBackgroundImage(Alexa.utils.ImageUtils.makeImage('http://url/to/my/backgroundimg.png'))
.setBackButtonBehavior('HIDDEN')
.setImage(Alexa.utils.ImageUtils.makeImage('http://url/to/my/img.png'))
.build();
this.response.speak('Rendering a template!')
.renderTemplate(template);
this.emit(':responseReady');
Support for Progresive Response API
This release adds SDK support for progressive response API.
The DirectiveService
provides the following function to access the Progressive Response API:
enqueue(directive, apiEndpoint, token);
An example to send directive to the service API is as follows:
function callDirectiveService(event) {
// Call Alexa Directive Service.
const ds = new Alexa.services.DirectiveService();
const requestId = event.request.requestId;
const endpoint = event.context.System.apiEndpoint;
const token = event.context.System.apiAccessToken;
const directive = new Alexa.directives.VoicePlayerSpeakDirective(requestId, "This is a message");
ds.enqueue(directive, endpoint, token)
.catch((err) => {
console.log(err.message);
});
}
Remove unused state from HandlerContext
This release removes an unused state property from HandlerContext
.
this.state
in handlers
is never assigned value nor used in the state management logic. Developers should use this.handler.state
instead to manage state value.
List Management API Helper
This release includes a new helper class: ListManagementService
that helps developers to better utilize the Alexa List API.
The ListManagmentService
provides the following functions to access Alexa List API:
getListsMetadata(token)
createList(listObkect, token)
getList(listId, itemStatus, token)
updateList(listId, listObject, token)
deleteList(listId, token)
createListItem(listId, listItemObject, token)
getListItem(listId, itemId, token)
updateListItem(listId, itemId, listItemObject, token)
deleteListItem(listId, itemId, token)
An example to create a named list is as follows:
const Alexa = require('alexa-sdk');
'CreateListIntent': function () {
if (this.event.context.System.user.permissions) {
let token = this.event.context.System.user.permissions.consentToken;
let lms = new Alexa.services.ListManagementService();
let listObject = {
name : 'My Test List',
state : 'active',
version : 1
};
lms.createList(listObject, token)
.then((data) => {
this.response.speak('List successfully created!');
this.emit(':responseReady');
})
.catch((error) => {
console.log(error.message);
this.response.speak('Unable to create List!');
this.emit(':responseReady');
});
} else {
this.response.speak('Please grant skill permissions to access Alexa List API.');
this.emit(':responseReady');
}
}