The Alexa Skills Kit now allows developers to build skills that play long-form audio content on Alexa devices. This blog demonstrates how to create and configure audio playback skill on Amazon Developer Console.

If you have done this before, these steps will be fairly painless. If it is your first time, no worries. We will guide you through it.

Signing In

First you have to Sign in to Amazon Alexa developer console. Go to the Amazon Developer Console.

If you have not already signed up for Amazon Developer account, do it now. We’ll wait here for you 🙂

Once you are set, select the Alexa tab and then click on Get Started with Alexa Skills kit.

It should look like this:

Click Add A New Skill on the top-right.

Skill Information

Enter the Skill Information:

Skill Type : Custom Interaction Model

Name : Audio Player

Invocation Name : Audio

Audio Player under Global Fields is set to Yes

It should look like this when all filled out:

 

Save it and Go Next to Interaction Model.

Skill Interaction Model

Next, we need to define our skill’s Interaction Model. Let’s begin with the intent schema. In the context of Alexa, an intent represents an action that fulfills a user’s spoken request. Intents can optionally have arguments called slots.

You will need to define both custom slot type values and sample utterances in language that matches current language tab.

The intent schema is written in JSON and provides the information needed to map the intents we want to handle programmatically.

{
  "intents": [
    {
      "intent": "Play"
    },
    {
      "intent": "AMAZON.PauseIntent"
    },
    {
      "intent": "AMAZON.ResumeIntent"
    }
  ]
}

 

Copy and Paste the above contents into the Intent Schema section:

 

Copy and Paste the below contents into the Sample Utterances field:

Play play
Play start
Play start playing
Play play now

 

 

Click Next again. It may take a minute to save, as it parses the intents and utterances.

Skill Configuration

First, copy the contents of index.js into your index.js file and make a zip file which contains index.js file and node modules(node_modules) folder which is made when we install npm.

Then make a new function on Amazon Lambda and upload the zip on it.

 

Now Copy the above highlighted ARN and Paste it into default after checking the ARN radio button. It should look like this:

 

 

Then hit Next again.

Skill Testing

On the Skill Testing page, make sure to toggle the button at the top to Enable. This allows you to test your skill with real Alexa devices, such as Echo, Dot or Tap.

Then go to the Service Simulator section at the bottom and type Play. Then click the Ask Audio Player button. It should return output like below:

 

Hurayyy!!! You’ve done it.

Now you are ready to do awesome stuff with the AudioPlayer 🙂

Want to work with us? We're hiring!