When I was building my Microsoft To-do Alexa skill I found Matteo’s series of blog posts on Alexa + Azure very useful. However I needed to go beyond the functionality described there and knew I’d need to delve deeper into the Alexa Skills Kit documentation. The first item I thought I’d blog about is the Alexa List Management API. I’m not going to open source the skill but I thought I’d share some pointers which could be useful to other developers.
What is a List Skill?
Alexa has built in lists for To-do items and Shopping List. These are quite basic (there are no due dates or reminders for example) but a third-party can extend them to synchronise them with another back-end. When you create a list skill you aren’t providing Alexa with an API into your datastore, but rather are taking responsibility to maintain synchronisation between two copies of the list. Your list items could be updated either from Alexa via the web or app or, more commonly, via a user’s voice command. To support this your skill subscribes to a number of list events which fire whenever an item is added, modified or deleted. Likewise on your backend you’ll need to handle changes and communicate them back to your Alexa skill. I’ll discuss this messaging infrastructure in a future post.
In its simplest form a List skill doesn’t have to have any speech interface of its own. It just has to handle the standard list events and require read (and likely write) permission on the Alexa household lists.
Building a List Skill
If your skill isn’t a regular custom skill you can’t edit the manifest through the Alexa Skill Kit dashboard and so you would use the Alexa Skill Kit command line tools. However rather than suffer the misery of a command prompt you can use trusty Visual Studio Code and the official Alexa Skills Kit Toolkit extension. This allows you to edit your skill metadata in Visual Studio Code’s editor and use the command palette to perform common operations like deploying the skill. The metadata for a skill is expressed in json and the editor has intellisense for the schema. A manifest for a list skill must contain an events object containing a list of standard event types:-
"events":{ "endpoint":{ "uri":"https://YourAzureFunctionAppEndpoint/api/FunctionName", "sslCertificateType": "Wildcard" }, "subscriptions":[ { "eventName": "SKILL_ENABLED" }, { "eventName": "SKILL_DISABLED" }, { "eventName": "SKILL_PERMISSION_ACCEPTED" }, { "eventName": "SKILL_PERMISSION_CHANGED" }, { "eventName": "SKILL_ACCOUNT_LINKED" }, { "eventName": "ITEMS_CREATED" }, { "eventName": "ITEMS_UPDATED" }, { "eventName": "ITEMS_DELETED" }, { "eventName": "LIST_CREATED" }, { "eventName": "LIST_UPDATED" }, { "eventName": "LIST_DELETED" } ] },
"permissions": [ { "name": "alexa::household:lists:read" }, { "name": "alexa::household:lists:write" } ]
RequestConverter.RequestConverters.Add(new ListSkillEventRequestTypeConverter());