Show Menu
Cheatography

Amazon Echo Javascript Skill Quick Ref Cheat Sheet (DRAFT) by

Quick Reference for Programming a Skill for Alexa

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Built in Slot Types

AMAZON.DATE
“today”, “tomor­row”, or “july”
“2015-­07-­00T9”
AMAZON.DU­RATION
“five minutes”
“PT5M”
AMAZON.FO­UR_­DIG­IT_­NUMBER
"­nin­eteen eighty four"
1984
AMAZON.NUMBER
“five”
"­5"
AMAZON.US­_CITY
all US cities with pop. > 100K
"­Sea­ttl­e"
AMAZON.US­_STATE
US states, territ­ories, and D.C.
"­Joh­n"
AMAZON.US­_FI­RST­_NAME
recognizes popular first names

Sample Utterances

GetHoroscope what is the horoscope for {Sign}
GetHoroscope what will the horoscope for {Sign} be on {Date}
GetHoroscope get me my horoscope
GetHoroscope {Sign}
...
GetLuckyNumbers what are my lucky numbers
GetLuckyNumbers tell me my lucky numbers
...
MatchSign do {FirstSign} and {SecondSign} get along
MatchSign what is the relationship between {FirstSign} and {SecondSign}
The name of the intent on the left.
The phrase a user might speak to signal that intent on the right.

Slots {SlotName} are arguments to intents.

Custom Slots Example

{ "intents": [
    { "intent": "GetHoroscope",
      "slots": [
        { "name": "Sign",
          "type": "LIST_OF_SIGNS" },
        { "name": "Date",
          "type": "AMAZON.DATE" }
       ] },
    { "intent": "MatchSign",
      "slots": [
        { "name": "FirstSign",
          "type": "LIST_OF_SIGNS" },
        { "name": "SecondSign",
          "type": "LIST_OF_SIGNS" }
       ] },
    { "intent": "GetLuckyNumbers" }
 ] }
 

Built-In Intents

AMAZON.Ca­nce­lIntent
"­Can­cel­," "­Never mind," "­Forget it"
AMAZON.He­lpI­ntent
"­Hel­p," "Help me," "Can you help me"
AMAZON.No­Intent
"­No,­" "No thanks
AMAZON.Re­pea­tIntent
"­Rep­eat­," "Say that again,­" "­Repeat that"
AMAZON.St­art­Ove­rIntent
"­Start over," "­Res­tar­t," "­Start again"
AMAZON.St­opI­ntent
"­Sto­p," "­Off­," "Shut up"
AMAZON.Ye­sIntent
"­Yes­," "Yes please­," "­Sur­e"

Implement Built-in Intent Schema

{
  "intents": [
    { "intent": "GetFirstEventIntent",
       "slots": [
         { "name": "day",
            "type": "AMAZON.DATE" }
        ]
    },
    { "intent": "GetNextEventIntent" },
    { "intent": "AMAZON.HelpIntent" },
    { "intent": "AMAZON.StopIntent" }
  ]
}

Implement Built-in Intent Code

@Override
public SpeechletResponse onIntent(final IntentRequest request, final Session session)
        throws SpeechletException {
    log.info("onIntent requestId={}, sessionId={}", request.getRequestId(),
            session.getSessionId());
 
    Intent intent = request.getIntent();
    String intentName = intent.getName();
 
    if ("GetFirstEventIntent".equals(intentName)) {
        return handleFirstEventRequest(intent, session);
    } else if ("GetNextEventIntent".equals(intentName)) {
        return handleNextEventRequest(session);
    } else if ("AMAZON.HelpIntent".equals(intentName)) {
        // Handling for the help intent goes here
    } else if ("AMAZON.StopIntent".equals(intentName)) {
        // Handling for the stop intent goes here.
    } else {
        throw new SpeechletException("Invalid Intent");
    }
}

Response Object

{
  version: '1.0',
  response: {
    outputSpeech: { // Always part of the response
      type: 'PlainText', // Always this value
      text: 'Example speech' // Text that will be spoken back to user
    },
    shouldEndSession: true, // Always part of the response--boolean for if session has ended (no more user input)
    reprompt: { // Optional, if you want to customize what Alexa says if user doesn't respond correctly/at all
      outputSpeech: {
        type: 'PlainText',
        text: 'Example reprompt'
      }
    },
    card: { // Optional, if you want to show a card in the Echo app
      type: 'Simple',
      title: 'Example title',
      content: 'Example card content'
    }
  },
  sessionAttributes: {} // If you need some attributes to be kept in the session
}