Building an Alexa Skill with Red Hat Mobile Application Platform – Part I

June 1, 2017

Amazon’s Alexa enabled devices, such as the Echo, Dot and most recently Tap provide a hands-free voice controlled environment, to make calls, send and receive messages, provide information and more — instantly. Alexa is the cloud-based voice service that powers this category of devices. All the user has to do is ask Alexa to perform an action.

In 2015, Amazon launched the Alexa Skill SDK (ASK) to open their cloud-based voice service to the developer community.

With some lines of code, developers are now able to integrate existing web services into an Alexa skill. The end-user can voice control and interact with the skill, the speech recognition or natural language understanding is handled by Amazon.

Skills come in different flavours:

  1. Flash Briefing: These skills provide original content for users’ flash briefings.
  2. Smart Home: With these skills, users can control cloud-enabled smart-home devices like lights and thermostats.
  3. Custom: These skills can handle just about any type of request.

By implementing skills for Alexa, developers create a new channel towards their web services and the information on the internet. The ease of consumption for the user is the major benefit in environments, where hands-free interactions or mobile (meaning on-the-go) are key.

Introduction

In this article series we’ll leverage ASK to build Alexa skills providing news towards the end-user. Amazon’s voice service will interact with a web service hosted in the Red Hat Mobile Application Platform (RHMAP) to pull RSS feeds from the internet:

At the same time, the consumption of the news could also be leveraged in a mobile app or website.

Red Hat Mobile Application Platform enables you to develop and deploy mobile apps in an agile and flexible manner. Take advantage of open technologies and standard toolkits while centralizing control over security, back-end integrations, and policy management.

This article is based on the following sample projekt build with RHMAP.

Project on RHMAP
Project on RHMAP

 

In the left column, you can see the client app, which consumes the API provided by the Cloud Application (middle column). The Cloud Application enables developers to implement business logic on the server side and call out to back-end systems. Those back-ends are attached to the platform via the MBaaS Services (right column). MBaaS Services could be considered as reusable connectors, providing multiple projects / solutions on top of the platform reusable integration points towards the back-ends.

Part I: Starting with a Flash Briefing Skill

The Flash Briefing Skill API defines the words users say to invoke the flash briefing or news request and the format of the content so that Alexa can provide it to the user.

Flash Briefing Skill
Flash Briefing Skill

 

The news feeds in our sample come from a public RSS feed and were added to a mobile solution project within RHMAP via a re-usable connector.

A web service created by a developer only needs to adhere to the Flash Briefing Skill API to provide information to the user.

This can easily be done by utilising the RHMAP API Mapper Service template, which is a visual tool for transforming the response of APIs. It allows developers to:

  • Rename Fields
  • Exclude fields which are not needed
  • Transform Fields using built-in transformations, or custom transforms they have defined themselves

In order to adhere to the Flash Briefing API, we need to perform the following steps on RHMAP:

  • Create a new MBaaS Service with the API Mapper template
  • Make this service public
  • Deploy the service to RHMAP’s server side
  • Add a mapping to change the response of the above mentioned re-usable connector to look like the Flash Briefing API. This involves:
    • Changing attribute names
    • Adding two custom transformation to alter the date format from the RSS feed and removing the ‘Read more’ string in the payload.
  • Save the changes on the mapping and grab the exposed URL

A full description of the Alexa RSS Mapping Service is provided here.

Alexa RSS Mapping Service
Alexa RSS Mapping Service

 

As the mapping service is defined and deployed publicly accessible, Amazon’s voice service can directly call-out to our Alexa RSS Mapping Service to fetch news feeds.

Setting up the Skill

The last step is creating the Flash Briefing Skill in the Amazon’s developer portal.

  1. Register as an Amazon Developer and Create a Flash Briefing Skill
  2. Set a Name, Language and Error Message
  3. Add One or More Flash Briefing Feeds:
    Flash Briefing Configuration
    Flash Briefing Configuration

    The URL points to the Alexa RSS Mapping Service on RHMAP

  4. Test Your Flash Briefing Skill
  5. Optional – Prepare for publishing
  6. Optional – Submit your skill for approval

Now go ahead and ask Alexa to provide you with your Flash Briefing:

[embedyt] https://www.youtube.com/watch?v=4e0QKDLMNA0[/embedyt]

 

Continue reading on how to upgrade to a Custom Skill in Part II

One reply on “Building an Alexa Skill with Red Hat Mobile Application Platform – Part I”

Leave a Reply

close

Subscribe to our newsletter.

Please select all the ways you would like to hear from Open Sourcerers:

You can unsubscribe at any time by clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.

We use Mailchimp as our newsletter platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices here.