Questions tagged [alexa-slot]

A container used by Alexa, capable of holding useful piece of information provided by user like Date, Time, City, Country, Fictional Character, Author, Movies, etc.

Source : https://developer.amazon.com/docs/custom-skills/slot-type-reference.html#list-slot-types

Alexa Skills kit supports slot, which are basically containers which are helpful in obtaining specific data which the user has provided in any format to the skill. This input data is useful for the developer to return the necessary response.

For example : Consider you're making a skill which tells you the day of a particular date. More precisely, you give Alexa a date and it returns you the day of the week.

Slots would be useful to obtain the input data Date which the user has specified, and using some logic we can figure out the day for that date.

Consider this conversation:

User: "Alexa launch days of our life"

Alexa: "Welcome to the days of our life". // "days of our life" is the invocation name of this hypothetical skill.

User: "What was the day on {1st May, 1996}" // {1st May, 1996} is the value received by slot {Date}

Alexa: "It was a Wednesday".

Slots Type

The Alexa Skills Kit supports several slot types that define how data in the slot is recognized and handled. There are built-in slot (list of slot types), as well as the developer can specify their own custom slot. When creating their custom slots they are required to give some slot values, in the Alexa skill builder's build section. When the Alexa skill comes across such values, it would know these are the slot values of the custom build slot.

Since the skill can be published in several languages (see languages supported by Alexa), the build-in slots are also supported in several languages.

Defining slots

Slots may be defined in the Build section of new Alexa skill builder or using the JSON Editor to edit the Intent Schema.

This is how the slots Query and CityList are defined in the intent schema.

{
  "intents": [
    {
      "name": "SearchIntent",
      "slots": [
        {
          "name": "Query",
          "type": "AMAZON.SearchQuery"
        },
        {
          "name": "CityList",
          "type": "AMAZON.US_CITY"
        }
      ],
      "samples": [
        "search for {Query} near me",
        "find out {Query}",
        "search for {Query}",
        "give me details about {CityList}"
      ]
    }
  ]
}

Synonyms for slot values

The slot values defined in Alexa skill builder can have synonyms too. For example, if you're working with a skill which asks for the city in which the user lives, then places like Mumbai and Banglore could have synonyms Bombay and Bengaluru, respectively.

Custom Slot Example

Slot Filling

For filling slots there are two cases which the developer must understand.

  1. Slot value is always required.
  2. Slot value is sometimes required, i.e. the skill will still work if this slot is missing.

If the slot value is always required, then the Directive Dialog.Delegate may be used. To use this directive, prompts (i.e. what Alexa will say to ask for the value of this slot) and utterances (i.e. what user will speak in response to those prompts) should be defined in the Alexa skill builder.

Like this : Here the prompts and utterances are given for the custom slot CITY which is required by Intent GetMoviesNowShowing. (It is a built-in slot of type AMAZON.City)

Prompts and Utterances for custom slot - CITY

And if the slot is not always required, then the Directive Dialog.ElicitSlot may be used. For this directive no prompts and utterances are required, the developer has to provide explicit outputSpeech, which is used by Alexa as a prompt for the slot filling.

Accessing slot values

The slot values may be accessed in the lambda function. When an intent is invoked, a JSON input is given to the lambda function. Developer can access this JSON input to retrieve the slot value input given by the user. It looks something like this:

"intent": {
    "name": "GetAntonymsIntent",
    "confirmationStatus": "NONE",
    "slots": {
        "LANGUAGE": {
            "name": "LANGUAGE",
            "confirmationStatus": "NONE",
            "value" : "english"
        },
        "WORD": {
            "name": "WORD",
            "value": "ace",
            "resolutions": {
                "resolutionsPerAuthority": [
                    {
                        "authority": "amzn1.er-authority.echo-sdk.amzn1.ask.skill.c4a5d570-8455-4496-825b-07864b4acfec.WORD",
                        "status": {
                            "code": "ER_SUCCESS_MATCH"
                        },
                        "values": [
                            {
                                "value": {
                                    "name": "ace",
                                    "id": "360e2ece07507675dced80ba867d6dcd"
                                }
                            }
                        ]
                    }
                ]
            },
            "confirmationStatus": "NONE"
        }
    }
}

This is just a concerned part of JSON input. This is not the complete input. The complete input / event looks something like this.

Here the slots LANGUAGE and WORD have values "english" and "ace", respectively.

There can be as many slots as the developer desire, but having a lot of them increases the complexity of the skill.

Questions related to any topic discussed above should have this tag, along with tags like Alexa and Alexa-skills-kit.

224 questions
4
votes
1 answer

Alexa AMAZON.DATE slot default to past dates

I am using the AMAZON.DATE slot and I would like it to default to past dates. For example, if a user says Monday I would like it to automatically select last Monday rather than next Monday. In the documentation it confirms that it defaults to 'on…
C-Bertram
  • 79
  • 6
4
votes
3 answers

Multiple Authorities in resolutionsPerAuthority on an Alexa skill request

I have been working on an Alexa skill and till date it worked fine but today i have encountered a strange issue. The similar issue can be seen in other skills as well. The issue is that i am getting multiple authorities in resolutionsPerAuthority of…
Akhilesh Awasthi
  • 2,688
  • 4
  • 21
  • 30
4
votes
3 answers

Unable to activate test stimulator for alexa skill

I have been into alexa development and recently I have encountered a never before situation. While trying to enable testing on a new skill, I am getting the following error on the test tab : There was a failure enabling your skill, please try…
4
votes
1 answer

Audio Streaming on Alexa

How to write intents for streaming audio from url in Alexa ? What changes or functions do I need to write in lambda function for streaming audio url in alexa. I have gone through AWS blogs but not able to implement this.
3
votes
1 answer

Alexa Skill: is it possible to have Alexa play a .mp3 from Alexa Developer Console - Alexa Hosted?

I'm trying to create a skill for Alexa that reproduces .mp3 files based on the category of the tg I choose. I state that I never used node.js and that I looked at a course on how to create alexa skill. Until now I have created the skeleton of the…
3
votes
2 answers

How to expand custom slot types for Alexa Skill?

I want to ask for a flight number. Flight numbers are composed of a short code like EZY, AFR, DLH or CCA and a 3 to 5 digit flight number. Because I have these limited set of codes combined with a large set of potential numbers, I don't know how to…
Ipsider
  • 553
  • 1
  • 7
  • 20
3
votes
1 answer

Alexa custom slot that takes any word or phrase

What samples can one add to a custom slot to make it accept any word or phrase?
Jonathan
  • 10,792
  • 5
  • 65
  • 85
3
votes
2 answers

Using apostrophes for Alexa slots

I am developing an Alexa skill, where I have a stop for names of fruits. However, if I speak something like "What is apple's cost" where the slot value has an apostrophe, Alexa does not seem to recognize the apostrophe. Workaround is to say…
3
votes
3 answers

How to add slot values dynamically to alexa skill

I am new in Alexa development. I have successfully create an Alexa skill with AWS lambda function and Node.js code. This is my intent schema. { "intents": [ { "slots": [ { "name": "locationName", "type":…
Abdul Manaf
  • 4,933
  • 8
  • 51
  • 95
3
votes
1 answer

Alexa not recognizing some slot values dependent on the sample utterances

I created an Amazon Alexa skill that has one intent (MyIntent) and two custom slot types (SlotA and SlotB). The intent schema looks like that: { "intents": [ { "intent": "Foo", "slots": [ { "name": "CustomA", …
unnu
  • 744
  • 1
  • 5
  • 13
3
votes
1 answer

Maximum number of slot values in Alexa skill setup

What are the maximum number of values that can be added per slot when creating a skill in Alexa? It looks like the AMAZON.LITERAL was deprecated due to concerns around skills recording raw user conversations as an input. I've got a large number of…
Beaux
  • 139
  • 1
  • 9
3
votes
2 answers

giving a string slot in Amazon alexa

I'm new to alexa. I learnt and started to build a weather app. right now I'm able to get weather data, but on the below condition, I've craeated a custom slot(LIST_OF_CITIES) to hold Cities as below. { "intents": [ { "intent":…
user3872094
  • 3,269
  • 8
  • 33
  • 71
3
votes
1 answer

AMAZON.FIVE_DIGIT_NUMBER does not exist to capture zipcode in Amazon Alexa

Alexa certification feedback says to use slot type "AMAZON.FIVE_DIGIT_NUMBER" for zipcodes. That would make sense, but it doesn't actually exist! When I include this slot type, I am unable to save the intent json It gives the error: "Unknown slot…
pythonjsgeo
  • 5,122
  • 2
  • 34
  • 47
2
votes
2 answers

How to create Alexa Catalog for URL Reference for slots

I've found this example that is using the Catalog URL Reference for populating custom slots in Alexa Skill. The problem is that I don't know how to populate this catalog. I was able to create the model catalog using ask cli like this: ask api…
rivamarco
  • 719
  • 8
  • 23
2
votes
1 answer

How to support pronouns within Alexa skill

I'm creating an Alexa skill with intents that supports, amongst others, the following utterances: What lessons does {Mabel} have tomorrow? Does {Mabel} have any homework? where "Mabel" is a slot of type AMAZON.GB_FIRST_NAME. In order to make the…
skedly
  • 21
  • 1
1
2
3
14 15