Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alexa Skill - How to Retrieve Slot Value in Lambda Function

I am developing an Alexa Skill with one Intent that includes a Slot with several possible values.

My slot is defined with "name" : "Channel", "type" : "LIST_OF_CHANNELS", and values

  1. iqram
  2. ingrid
  3. phil
  4. clyde

How do I retrieve the uttered slot value to use in my Lambda function? It's the "retrieve value of slot from utterance part" I'm looking to have answered. Thanks so much.

 // retrieve value of slot from utterance     
 var c = intent.slots.Channel.value; 

 // append value to end of URL that references API
 fetchEnseParse("/channel/" + c, function(body) {

 // continuation of this function is below 
like image 497
Ingrid Avatar asked Jan 16 '17 21:01

Ingrid


People also ask

How do you use Alexa skill slots?

To configure the slot for multiple valuesOn the Skills tab, in the SKILL NAME column, click the name of your custom skill. From the left-hand sidebar, click Custom > Interaction Model > Intents. Click an intent to open the detail page for the intent. In the list of Intent Slots, find the slot to change.

What is slot in Alexa?

Phrases. Phrase slot types allow for input from a user with fewer constraints on format and content. Make sure that your skill uses no more than one phrase slot per intent. The following phrase slot type is supported. Slot Type.

Does Alexa use lambda?

The Alexa Skills Kit provides the APIs, tools, and documentation to create these new skills, powered by your own services running as Lambda functions. Amazon Echo users can access these new skills by asking Alexa questions or making requests. The Alexa Skills Kit is available on GitHub.


2 Answers

var c = this.event.request.intent.slots.slotname.value

This should give you what you're looking for.

like image 175
Pseuplex Avatar answered Oct 17 '22 14:10

Pseuplex


In the event that your lambda receives you can find it here...

{
  "request": {
    "type": "IntentRequest",
    "intent": {
      "name": "YourIntentName",
      "slots": {
        "slotname": {
          "name": "slotname",
          "value": "HERE!"
        }
      }
    },
    "locale": "en-US"
  },
} 

The event is passed to your lambda handler.

like image 5
Tom Avatar answered Oct 17 '22 15:10

Tom