github alexa/alexa-skills-kit-sdk-for-nodejs 1.0.18
List Management API Helper

latest releases: v2.14.0, v2.12.1, v2.12.0...
7 years ago

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');
        }
}

Don't miss a new alexa-skills-kit-sdk-for-nodejs release

NewReleases is sending notifications on new releases.