Reputation: 29
I am using custom slot in Alexa skill. I have created one slot with pName as slot name and slot type is ProductName. When I call my intent after open my skill it always goes to unhandled input. I have followed document for create custom slot but still not getting success. e.g.// my sample utterance is below : i have one intent name OnHandQuantityIntent with sample utterance on hand stock for item {pName}
User input : on hand stock for item xyz234 Alexa response : inside unhandled intent.
Model :
{
"interactionModel": {
"languageModel": {
"invocationName": "ebs demo",
"intents": [
{
"name": "AMAZON.FallbackIntent",
"samples": []
},
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{
"name": "AMAZON.HelpIntent",
"samples": []
},
{
"name": "AMAZON.StopIntent",
"samples": []
},
{
"name": "OnHandQuantityDemoIntent",
"slots": [
{
"name": "PName",
"type": "Product_Type"
}
],
"samples": [
"Onhand quantity {PName}",
"get onhand quantity for item {PName}",
"provide me onhand quantity for {PName}"
]
}
],
"types": [
{
"name": "Product_Type",
"values": [
{
"id": "AT23808",
"name": {
"value": "AT23808",
"synonyms": [
"at23808",
"AT23808"
]
}
}
]
}
]
}
}
}
Here is my alexa.js function
'use strict';
const Alexa = require('alexa-sdk');
const APP_ID = undefined;
const SKILL_NAME = 'DemoForDirectCall';
const GET_ITEM_MESSAGE = "ITEM DETAIL: ";
const HELP_MESSAGE = 'WE can get real time on hand quantity for Product';
const HELP_REPROMPT = 'What can I help you with?';
const STOP_MESSAGE = 'Goodbye!';
const handlers = {
'LaunchRequest': function () {
this.response.speak("Welcome to Demo for direct call");
this.response.shouldEndSession(false);
this.emit(':responseReady');
},
'OnHandQuantityDemoIntent': function () {
console.log(JSON.stringify(this.event.request));
var productName = "NONE";
var intent = this.event.request.intent;
if(!intent.slots.PName)
productName = intent.slots.PName.value;
const speechOutput = "You have entered "+productName;
this.response.speak(speechOutput);
this.emit(':responseReady');
},
'AMAZON.HelpIntent': function () {
const speechOutput = HELP_MESSAGE;
const reprompt = HELP_REPROMPT;
this.response.speak(speechOutput).listen(reprompt);
this.emit(':responseReady');
},
'AMAZON.CancelIntent': function () {
this.response.speak(STOP_MESSAGE);
this.emit(':responseReady');
},
'AMAZON.StopIntent': function () {
this.response.speak(STOP_MESSAGE);
this.emit(':responseReady');
},
'Unhandled': function () {
console.log("Inside unhandled Intent");
this.response.speak("Inside Unhandled Intent");
this.emit(':responseReady');
},
};
exports.handler = function (event, context, callback) {
const alexa = Alexa.handler(event, context, callback);
alexa.APP_ID = APP_ID;
alexa.registerHandlers(handlers);
alexa.execute();
};
User input : Open ebs demo Alexa Response with welcome message User Input : onhand quantity for item AT23808 Alexa Response : Inside Unhandled Intnet.
Upvotes: 1
Views: 1349
Reputation: 4387
Its going into Unhandled
because there is no intent handler for AMAZON.FallbackIntent
. And the user input mentioned is triggering this intent which ultimately comes as "Unhandled".
Abbreviations and numbers in Slot values
When you are dealing with abbreviations like AT or ATZ or XYZ you have to give slot values like this. (try to give more variations)
x. y. z. two four seven nine
A. T. Z. one two three four
A. T. two three eight zero eight
When testing it in Test Simulator use utterances like
ask ebs demo on stock for item x. y. z. five three seven
With your interaction model and the changes I mentioned, I got a request generated like this for the above utterance
"intent": {
"name": "OnHandQuantityDemoIntent",
"confirmationStatus": "NONE",
"slots": {
"PName": {
"name": "PName",
"value": "XYZ537",
...
Also, it will be a good idea to change your invocation name from ebs
to e. b. s.
Upvotes: 1
Reputation: 618
Lets assume i have to input product from the user. So product is my slot and productType will be my slot Type.
Slot Types: productType
Values: washing machine.
product is of type: ProductType
Sample Utterance: My {product} is not working.
User input: My washing machine is not working.
This should work.
In Your case i guess you need to add sample values for your ProductName which is alpha numeric. Then it will surely work. All the best.
Upvotes: 0