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
2
votes
4 answers

Grabbing what a user says without a carrier phrase. Is there an alternative to Amazon.SearchQuery?

For the skill I'm working on, I am able to grab what a user says. However, i need a "carrier phrase" with Amazon.SearchQuery. At a certain point in my skill, a Carrier Phrase is not exactly user friendly. It would be helpful for the user to just…
user3019802
  • 65
  • 2
  • 10
2
votes
2 answers

Problem parsing Alexa json response in python to get value name

I have the following intent passed to my handler: "request": { "type": "IntentRequest", "requestId": "amzn1.echo-api.request.3af5c8c3-1d1f-4169-8ce8-fde1a99a7c8d", "timestamp": "2019-04-03T04:08:06Z", "locale": "en-US", "intent":…
ViennaMike
  • 2,207
  • 1
  • 24
  • 38
2
votes
1 answer

Alexa skill: EXCEEDED_MAX_REPROMPTS when delegating to get an AMAZON.Date

I'm developing a skill using the node.js v2 sdk. In a certain point of the skill, I'm trying to get a date using the AMAZON.Date slot type like: return handlerInput.responseBuilder …
Ignacio Ruiz
  • 611
  • 10
  • 21
2
votes
2 answers

How to make Alexa prompt me for additional information if I missed a parameter in my utterance?

How can I make Alexa prompt me (e.g. “You want weather for which city again?”) if I missed a parameter (slot i.e. city_name) in my utterance? I am making a skill which tells me weather of a city. I have utterances and it works alright, but when I…
2
votes
2 answers

Unable to debug "There was a problem with the requested skill's response"

Background: I am working through a flashcard Skill that enables Alexa to ask basic questions about a programming language. The user can choose between Ruby, Python or JS. The progression goes: LaunchRequest welcomes the user, then asks for their…
daspianist
  • 5,336
  • 8
  • 50
  • 94
2
votes
1 answer

What kind of slot to be used to catch a random piece of text?

I am trying to build an Amazon Alexa skill. In that, one of the intents needs a text string. It can be any random word (including names). I have do some search from a database using that word. How do I go about solving this? I have followed the…
aniztar
  • 2,443
  • 4
  • 18
  • 24
2
votes
2 answers

How to use Dialog.ElicitSlot for Python as Runtime environment

I want to fill a slot not at the beginning of the invocation of the intent, but at a later part in the intent request. I want to provide user some options, and I want them to select one out of those. For that I'm trying to use Dialog.ElicitSlot, but…
Nikhil Wagh
  • 1,376
  • 1
  • 24
  • 44
2
votes
1 answer

AMAZON.SearchQuery type for Alexa skills - how to respond correctly to "stop" or "cancel"?

I'm working on an Alexa skill and have decided to declare a slot for one of the intents as AMAZON.SearchQuery type, which allows free-form speech. If the speaker leaves out that slot, my lambda code elicits the slot, so at that point I'm waiting for…
stylecramper
  • 99
  • 11
2
votes
2 answers

How do I get Dialog-Data in Alexa's HelpIntent

I have implemented a multi-stage dialog with Alexa. The skill iteratively asks the user for information to calculate the desired result. One after the other the individual slots are filled. So far so good. Now I want to implement the HelpIntent:…
Tobias Gassmann
  • 11,399
  • 15
  • 58
  • 92
2
votes
2 answers

How to clear custom slot value programmatically in Alexa?

I have an Alexa skill which requires to programmatically override the values given by the user. I have tried nullifying the value and later pass it in as the "updated Intent". this.event.request.intent.userPrompt.value = null; var updatedIntent =…
2
votes
1 answer

Alexa is not recognizing my intents

Alexa isn't recognizing my intents that have slots. Alexa recognizes all of my intents that don't have slots, but not the ones that have slots. For example, Alexa recognizes "view chores", but not "view chore {chore}". This only happens when running…
SuperStormer
  • 4,997
  • 5
  • 25
  • 35
2
votes
1 answer

Pass Alexa Skill slot name to a new intent on emit

When triggering one intent from another, such as 'LaunchRequest': function () { this.emit('MyCustomIntent') } The request object passed to MyCustomIntent is "request": { type: 'LaunchRequest', requestId: '...', timestamp: '...', …
Ben Zenker
  • 153
  • 2
  • 7
1
vote
1 answer

I try get text from hosted text file into skill handler, but when I test skill show an error "SpeechletResponse was null"

I develop Alexa Skill in Alexa developer, I begin to learn about this, my skill try get text from a promise connects to hosted text file, the request is succesfully. But skills shows an error. I need help to resolve this error on alexa skill. Share…
1
vote
1 answer

Custom handling for AMAZON.DATE slot type to find Past Dates only

The Problem I know in the docs that AMAZON.DATE slot type defaults to look for future dates. As far as I can see there's no way for me to set it to past dates by default. If that's the case, what can I do within my code to handle this? Example A…
Sam Tuson
  • 37
  • 6
1
vote
0 answers

Can an aws lambda function handle multiple aws iot objects?

I have a lambda function where the endpoint of the object, its region and its name are indicated: var config = {}; config.IOT_BROKER_ENDPOINT = "axxxxxxxxxxxxxxx.iot.us-east-1.amazonaws.com".toLowerCase(); config.IOT_BROKER_REGION =…
Plc Worker
  • 101
  • 7
1 2
3
14 15