Skip to main content Skip to Footer

BLOG


August 22, 2017
Delivering Alexa skills with Jenkins
By: Robert Glenn

If you've ever built a custom skill for Alexa, Amazon’s virtual personal assistant, you know how cumbersome it can be to make updates in the developer portal. It's not straightforward to source control or test skill configuration, which complicates collaboration.

One way to mitigate this: Keep the skill itself very “thin.”


Building custom skills for #Alexa can be accomplished in a simple, straightforward fashion - Accenture’s Robert Glenn:
 
 

You can leverage Alexa's speech parsing capabilities and send your voice commands to a custom, back-end application server. This allows you to author application code using the best DevOps practices, such as source control, unit testing, linting and continuous delivery. Additionally, you enable other common software practices, such as response caching, circuit-breaker code, blue/green deployments and test-driven development.

Our experience with the Accenture Open Web Platform (AOWP) team illustrates how constructing these skills can be as simple as configuring call-backs for each feature. We recently built and open-sourced the Alexia library for NodeJS to facilitate the building of such custom back-ends for Alexa skills through a few key steps:

  • Simply install the Alexia framework using: npm install—save alexia

  • From the command line, require it into your project: const alexia = require('alexia');

  • Create an application with which to associate intents:
    const app = alexia.createApp('MyAlexaSkill');

  • Add intent handlers in the form:
    app.intent(IntentName, Invocation_or_ListOfInvocation, Handler); such as app.intent('SayHello', ['Hi', 'Hello'], () => 'Hello, friend!');

You can also use Amazon's concept of “Slots” to create intents with variable input. For example:

app.intent('GreetMe', 'Hi, my name is {name:US_FIRST_NAME}', (slots) => {return `Hi, ${slots.name}! It's nice to meet you.`;});

You can even create custom cards to display in the Alexa portal, by expanding the return value of the intent, like so:

app.intent('GreetMe', 'Hi, my name is {name:US_FIRST_NAME}', (slots) => {return {text: `Hi, ${slots.name}! It's nice to meet you.`, card: {title: 'Greeting', content: `Welcome to my custom app, ${slots.name}. Check out our website: www.myawesomesite.com!` } }; });

Because of NodeJS' popularity, there are many third-party and community developed libraries. For example, you could leverage location-based services to enable more context-aware responses.

Similarly, you could incorporate the Alexia library into an existing application, as an additional user interface or as a voice-controlled proxy for a REST API.

Finally, because the application is written in JavaScript, you can use familiar testing and logging frameworks, such as Mocha and Winston, so there's no need for a specialized skill set and little risk of being pigeonholed into a niche technology.

You can even package the application in a Docker container, improving portability and ability to launch the application on any cloud provider. You also enable sophisticated scaling features, enabling first-class reliability.

With an Alexia library, creating a new, high-quality Alexa skill is as simple as building a NodeJS application. You can perform continuous integration and delivery in the very same way you would deliver a web application. You can use the same source control, infrastructure and artifact repositories you would for any NodeJS application, requiring no additional learning curve or licensing consideration.

Check out the Alexia library, and get started building custom Alexa skills immediately. I look forward to discussing this with other DevOps aficionados at Jenkins World 2017. A colleague and I will be speaking on this same subject on Thursday, August 31 at 3:45pm.

Popular Tags

    More blogs on this topic

      Archive