Alexa In

In this tutorial you will learn about the Alexa-in Node, what it does and how to use and its Settings

1. What it does

Alexa-in node receives an Intent/Launch/SessionEnd requests when the user says or speaks something to your skill on their Alexa powered devices like Amazon echo, Amazon Echo Dot, Amazon echo show, etc device. All the incoming requests contains a intents as well as their corresponding slots (If used).

If not used, you won’t be able to handle request from Alexa.

In order to handle these request’ intents, you have to place the conversation’s User Says node into the editor, and put the intent name into it.

Example:
Lets say your alexa skill name is, Pokemon quest. Now when user says on alexa: Alexa, open Pokemon Quest. Then Alexa-in node will recieve the LAUNCH request and forward the incoming request to corresponding User Says Node with the help of connected Router Node

2. How to use

Alexa-in Node should be used with Router Node, with Output of Alexa-in Node should be connected to Input of Router Node.

If you use the Alexa-in Node to handle the incoming request from the user, then you must place the Alexa-out Node next to Router Node, in order to send the Response back to the user.

3. Node Setting

  • In Basic Conversation Mode:
    You don’t need to provide any Node settings.
    In this mode, NLU(Natural Language Model) model is automatically generated based upon the settings in User Says Nodes.

  • In Advanced Conversation Mode:
    When you work in Advanced Conversation Mode, you need to provide the Interaction Model which Amazon’ Alexa uses to train the NLU(Natural Language Model) Model.


    You need to provide Intent Schema and Custom Slots(If any), as described below:

    • Intents
      On the Setup tab, you need to define all the intents which your skill is going to use. The format of all the Intents definition should be same as below code sample:

      {
          "name" : (string) "<name of the intent>",
          "options" : (object) {
              "slots" : (object) {
                  "<name of slot>" : "<value of slots>",
              },
              "utterances" : (array) [
                  "<person's utterances related to this intent>"
              ]
          }
      }
            

      Intents are the verb/action of the sentences.
      There are two types of intents which you can define here:

      1. Built-in intent type
        These are pre-defined intents provided by alexa. These intents name starts with AMAZON.<name>. For these intents you don’t have to provide any slot, but you can optionally provide the utterances. Alexa’ NLU (Natural Language Understanding) engine automatically parse these intents from the user utterance. for more info. Click Here. We have already defined some required built-in intents. Please do not remove these built-in intents like AMAZON.HelpIntent, AMAZON.CancelIntent, AMAZON.YesIntent, AMAZON.NoIntent as these are required for any Alexa skill.
        Built-in intent Example:
        {
            "name" : "AMAZON.HelpIntent",       // ----> Built-in Intent
            "options" : {
                "slots" : {},
                "utterances" : [
                    "Please help me",
                    "Give me some advice",
                    "Provide me some way to use this skill"
                ]
            }
        }
          
      2. Custom intent type
        You can define your own custom intent. For these custom intents you need to provide the Slots as well as at least three user utterances. When user say something which matched your provided utterances, then this intent will be passed.
        Example:
        {
            "name" : "SchoolTimingIntent",      // ----> Custom Intent
            "options" : {
                "slots" : {
                  "SchoolDate": "AMAZON.DATE"
                },
                "utterances" : [
                    "What are school timings for {-|SchoolDate}",
                    "Give me school timings for {-|SchoolDate}",
                    "school timings for {-|SchoolDate}"
                ]
            }
        }
          
        Note - Please do not use any white space or any special character in the intent name

    • Slots or Custom Slots
      The format of all the Custom Slots should be same as below code sample:

      {
          "name" : (string) "<name of the slot>",
          "value" : (array) [
              "<Identifier for slot>"
          ]
      }
              
      –OR–
      {
          "name" : (string) "<name of the slot>",
          "options": [{
              "value": (string) "<Identifier for slot>",
              "id": (string) "<particular identifier>",
              "synonyms": (array) [
                  "<synonyms for the above identier, which user might say>"
              ]
          }]
      }
              
      Slots or entity are the important words of the sentence.
      There are two types of slots which you can define here:

      1. Built-in slot type
        These are pre-defined slots provided by alexa. Alexa’ NLU (Natural Language Understanding) engine automatically parse these slots from the user utterance. for more info. Click Here. You can give any name to your built in slot but for the slot type, you should provide the pre-define alexa built-in slot.AMAZON.DATE, AMAZON.NUMBER ,etc
        Example using above code:
        {
            "name" : "SchoolTimingIntent",
            "options" : {
                "slots" : {
                  "SchoolDate": "AMAZON.DATE"       // ----> Built-in slot
                },
                "utterances" : [
                    "What are school timings for {-|SchoolDate}",
                    "Give me school timings for {-|SchoolDate}",
                    "school timings for {-|SchoolDate}"
                ]
            }
        }
          
      2. Custom slot type
        You can define your own custom slots name and its values. These types of slots are useful to provide the lists. Everytime you define a custom slot, you also need to provide atleast three user utterances related to these slot.
        Example to use custom slot:
        [
          {
              "name": "NAMES",
              "value": [
                  "JESSICA",
                  "JOSHEF"
              ]
          },
          {
              "name": "CITIES",
              "value": [
                  "NEW YORK",
                  "Chicago",
                  "Washington"
              ]
          }
        ]
          
        Example to use custom slots in the Intent definition:
        {
            "name" : "SchoolTimingIntent",
            "options" : {
                "slots" : {
                  "SchoolDate": "AMAZON.DATE",
                  "ChildNames": "NAMES",
                  "SchoolCities": "CITIES"
                },
                "utterances" : [
                    "What are school timings for {-|SchoolDate} in {-|SchoolCities}",
                    "Give me school timings for {-|SchoolDate} in {-|SchoolCities}",
                    "What are {-|ChildNames} school timings for {-|SchoolDate}"
                ]
            }
        }
          
        Once you are done with defining the Intents and Custom Slots, you can cross-check the filled data

    • Utterances Utterances are the sentence which user might speaks to start a particular intents. We are using an advance utterance module for utterance definition, which can create large number of utterances. For more info. Click here

4. Input

Alexa-in takes no input

5. Output

Outputs/pass the msg object to the connected node (generally Router Node).
Syntax of msg object:

"msg" : {
    "payload" : {},

    // "NLU" contains the incoming request Intent name and corresponding Slots form Alexa
    "NLU" : {
        "intent" : {
            "name" : (string) "<name of the intent passed by the Channel or parsed by the NLU engine>",
            "slots" : (object) "<key value pairs for the slots/arguments related to that of intent>"
        }
    },
    "govocal" : {
        "projectId" : (string) "<projectId of project>",
        "conversationContext" : (object) "<key/value pair conversation context/state>",

        //  "sessionData" contains all the information regarding the current conversation/dialog
        "sessionData" : (object) {
            "attributes": (object) "<key/value pair of session state management attributes>",
            "chatId": (string) "<unique chat/coversation Id, generated for each new alexa session>",
            "messageId": (string) "<unique message id>",
            "userId": (string) "<unique user id provided by alexa for each new user>",
            "newSession": (boolean) "<signifies for new user session>",
            "language": (string) "<language of the user>"
        },
        //  "dataStore" contains all the variables which you define in the Project Data Store
        "dataStore": (object) "<Key/value pairs of data store objects>",
        
        // "channel" signifies from where the request has came
        "channel": (string) "alexa",

        // "in" contains the necessary information about the incoming request
        "in": (object) "<contains important data of user request>" {
            "type" : (string) "<type of user action like message, photo, etc>",

            // As of now, Alexa do not sent the Complete user utterance
            // that's why "content" remains empty for Alexa
            "content": (string) "",
            "time": (string) "<actual time of user request in UTC>",

            // "originalRequest" contains complete and original requst from Alexa
            "originalRequest": (object) "<original incoming request from Alexa>",
        },
    }
}
Note
  • Always attach the Router Node next the Alexa-in Node.
  • Never modify the msg.NLU and msg.govocal object