Alexa Development

with Damien Russell

What is it?

Teaching Alexa New Skills

Interaction Model

Code To Support The Interactions

Alexa Enabled Devices

Alexa Show

New Kid on the Block

Requirements

Amazon Developer Account

Alexa Enabled Device (Not Required)

Requirements

Aws Lamada

Web Service

Some server side application to handle requests from the Alexa service

Practically Free

Can use any language

More control

Node.js, Java, Python, C#

or

Aws Lamada

Practically Free

Node.js, Java, Python, C#

Skill Types

  • Smart Home Skills
  • Flash Briefing Skills
  • Video Skills
  • Custom Skills

Different Interaction Models

The Interaction Model

 Rules for inputs and outputs

Custom Skill Interaction Model
  • Intent Definition
  • List of Slots
  • Sample Utterances

Request Cycle

Request Structure

{
  "version": "string",
  "session": {
    "new": true,
    "sessionId": "string",
    "application": {
      "applicationId": "string"
    },
    "attributes": {
      "string": {}
    },
    "user": {
      "userId": "string",
        "permissions": {
          "consentToken": "string"
      },	  
      "accessToken": "string"
    }
  },
  "context": {
    "System": {
      "application": {
        "applicationId": "string"
      },
      "user": {
        "userId": "string",
        "permissions": {
          "consentToken": "string"
      },		
        "accessToken": "string"
      },
      "device": {
        "deviceId": "string",	  
        "supportedInterfaces": {
          "AudioPlayer": {}
        }
      },
      "apiEndpoint": "string"
    }
  },
  "request": {}
}

All requests contain:

  • Request
  • Context
  • Version
  • Session

Standard requests contain:

Types of Alexa Requests

  • AudioPlayer
  • Display
  • VideoApp
  • Playback Controller
  • Standard

Standard Request Types

  • Launch
  • Intent
  • SessionEnd

Launch Requests

{
  "type": "LaunchRequest",
  "requestId": "string",
  "timestamp": "string",
  "locale": "string"
}

The Request Object

{
  "version": "1.0",
  "response": {
    "outputSpeech": {
      "type": "PlainText",
      "text": "Welcome to the Lou Demo app."
    },
    "speechletResponse": {
      "outputSpeech": {
        "text": "Welcome to the Lou Demo app."
      },
      "shouldEndSession": false
    }
  },
  "sessionAttributes": {}
}

Response

{
  "session": {
    "sessionId": "SessionId.e6b0c7d5-4e36-4e57-b603-########",
    "application": {
      "applicationId": "amzn1.ask.skill.4716b9c1-8e38-4f4d-b620-#######"
    },
    "attributes": {},
    "user": {
      "userId": "amzn1.ask.account.AGG7FMMRMRWRGO24D62VS3SH...",
      "accessToken": "EAAgrmik5G0QBABtIfCOvc5XZC..."
    },
    "new": true
  },
  "request": {
    "type": "LaunchRequest",
    "requestId": "EdwRequestId.cba58496-ef65-44f4-ad19-########",
    "locale": "en-US",
    "timestamp": "2017-07-27T22:38:32Z"
  },
  "version": "1.0"
}

Request

SessionEnded Requests

{
  "type": "SessionEndedRequest",
  "requestId": "string",
  "timestamp": "string",
  "reason": "string",
  "locale": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}

The Request Object

{
  "session": {
    "sessionId": "SessionId.2c9ff56f-b8fc-4b29-bcc1-###########",
    "application": {
      "applicationId": "amzn1.ask.skill.4716b9c1-8e38-4f4d-b620-###########"
    },
    "attributes": {},
    "user": {
      "userId": "amzn1.ask.account.AGG7FMMRMRWRGO24D62VS3...",
      "accessToken": "EAAgrmik5G0QBABtIfCOvc5XZC65pLofjZA..."
    },
    "new": false
  },
  "request": {
    "type": "SessionEndedRequest",
    "requestId": "EdwRequestId.4b3f70d4-bfb6-4c15-ba23-30780220fe81",
    "locale": "en-US",
    "timestamp": "2017-07-27T23:35:15Z",
    "reason": "USER_INITIATED"
  },
  "version": "1.0"
}

Intent Requests

{
  "type": "IntentRequest",
  "requestId": "string",
  "timestamp": "string",
  "dialogState": "string",
  "locale": "string",
  "intent": {
    "name": "string",
    "confirmationStatus": "string",
    "slots": {
      "SlotName": {
        "name": "string",
        "value": "string",
        "confirmationStatus": "string",
      }
    }
  }
}

The Request Object

  • Cancel
  • Help
  • Yes
  • No
  • Stop
  • StartOver
  • Pause

...

And many more!

Built In Intents

Built in Intents

Responses

  • version
  • sessionAttributes
  • response
  • outputSpeech
  • shouldEndSession
  • directives

Responses

{
  "version": "string",
  "sessionAttributes": {
    "string": "<object>"
  },
  "response": {
    "outputSpeech": {
      "type": "string",
      "text": "string",
      "ssml": "string"
    },
    "card": {
      "type": "string",
      "title": "string",
      "content": "string",
      "text": "string",
      "image": {
        "smallImageUrl": "string",
        "largeImageUrl": "string"
      }
    },
    "reprompt": {
      "outputSpeech": {
        "type": "string",
        "text": "string",
        "ssml": "string"
      }
    },
    "directives": [],
    "shouldEndSession": boolean
  }
}

Directives

  • Audio Player
  • Video App
  • Display
  • Dialog

Specify device-level actions

Multi-turn Dialog

The Dialog Directive

Dialog.Delegate

Dialog.ElicitSlot

Dialog.ConfirmSlot

Dialog.ConfirmIntent

it's awesome, easy, and fun

Wrapping Up

it's a whole new set of challenges

Wrapping Up

That's all folks

Alexa Development

By Damien Russell

Alexa Development

Alexa Development Overview

  • 871