This codelab will guide you through an example of leveraging a MuleSoft developed API as the backend for an Amazon Alexa skill. A natural-language voice experience is built to offer customers a more intuitive way to interact with the Mule application that they use everyday.

You will learn how easy it is to replace an AWS Lambda backend with an API designed and developed with MuleSoft Anypoint Platform.

Prerequisites

  1. Amazon Developer Account – for creating Alexa Skills
  1. Anypoint Studio - for developing and testing Mule application
  1. Anypoint Platform - to deploy Mule application to Cloudhub

Things to do

  1. Create an HTTPS listener with a self-signed certificate configuration.
  2. Create the Mule app to take input from the Alexa voice command and perform requested action.
  3. Deploy the Mule app to Cloudhub

Step One
Create an HTTPS connection to connect to the Alexa Skill.

Step Two

Two types of actions can be invoked using alexa skill

  1. Launch - to start the session
  2. Intent - perform specific action

Launch section coding

Launch JSON Response

After Launch Response, let's code the Intent section

JSON response of the User Intent

Step Three

  1. Enable your Skill.
  2. Now go to the test console, select ‘Development' in "Skill testing is enabled in"
  3. Either you can use the mic or type commands.
  4. First, give the launch request command "Open hello muleys". Launch request command should always start with Open. You will get the customized response from your MULE application.
  5. Now give the Intent request(userIntent) command "give me user details of {userId}". You will get the customized response from your MULE application.
  6. Now give the Intent request command(bye Intent) "goodbye alexa". You will get the customized
    response from your MULE application.
  7. If you have set any image URL in JSON response, That image too will be
    displayed on the Alexa Test Console.

In this codelab, you learned how easy it is to replace an AWS Lambda backend with an API designed and developed using Anypoint Platform. While we only created the implementation part using Anypoint studio, generally you would design it first using the Design Centre and the implementation part would be handled by Anypoint Studio . This can be further enhanced to create cool Voice over Mule connected Apps like starting and stopping Mule apps using Alexa.

Resources