Multiple Authorities in resolutionsPerAuthority on an Alexa skill request
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 my skill's request JSON. These authorities have different status code for match of slot values. Hence my code is finding difficulties because resolutionsPerAuthority is supposed to have only one object.
I am using the code provided in official docs of amazon to get slot values and it it failing due to this very scenario.
Anyone else facing the similar issue ? Any solutions?
Here is my request JSON:
{
"version": "1.0",
"session": {
"new": false,
"sessionId": "amzn1.echo-api.session.f4bf3a11-f882-4732-9275-6e494e0bca4d",
"application": {
"applicationId": "app id"
},
"attributes": {
"launchCount": 0,
"jokeCount": 0,
"indexes": [
34
],
"lastSpeechOutput": {
"outputSpeech": "response",
"reprompt": "reprompt"
},
"history": [
{
"IntentRequest": "LaunchRequest"
}
],
"currentJokeIndex": 34,
"lastUseTimestamp": 0
},
"user": {
"userId": "amzn1.ask.account.ncsdkncsdlcnskY"
}
},
"context": {
"Display": {
"token": "string"
},
"System": {
"application": {
"applicationId": "id"
},
"user": {
"userId": ""
},
"device": {
"deviceId": "",
"supportedInterfaces": {
"Display": {
"templateVersion": "1.0",
"markupVersion": "1.0"
}
}
},
"apiEndpoint": "https://api.eu.amazonalexa.com",
"apiAccessToken": ""
}
},
"request": {
"type": "IntentRequest",
"requestId": "amzn1.echo-api.request.824ef2fe-5a6b-45c8-96d2-a5aa0063e9b5",
"timestamp": "2018-07-26T13:47:56Z",
"locale": "en-IN",
"intent": {
"name": "TellJokeIntent",
"confirmationStatus": "NONE",
"slots": {
"joke": {
"name": "joke",
"value": "joke",
"resolutions": {
"resolutionsPerAuthority": [
{
"authority": "amzn1.er-authority.echo-sdk.amzn1.ask.skill.a4bb9873-04fa-486f-8e1e-e30cb3c3d669.joke",
"status": {
"code": "ER_SUCCESS_MATCH"
},
"values": [
{
"value": {
"name": "joke",
"id": "e2ff3cfd4b43876adaa5767ce93bf7d3"
}
}
]
},
{
"authority": "amzn1.er-authority.dynamic.amzn1.ask.skill.a4bb9873-04fa-486f-8e1e-e30cb3c3d669.joke",
"status": {
"code": "ER_SUCCESS_NO_MATCH"
}
}
]
},
"confirmationStatus": "NONE"
}
}
}
}
}
2 Answers
2
I just got the same issue today. Never had this problem before. I'm guessing Amazon changed something.
I think the best thing to do is sort through the resolutions per authority and select the one that has an er_success_match instead of just grabbing the first item in the resolutionsPerAuthority list. However, I'm not sure if it will be possible to have multiple er_success_matchs in one resolutionsPerAuthority list.
https://forums.developer.amazon.com/questions/171318/when-would-you-have-multiple-resolution-authoritie.html
Problem: We are unable to retrieve id and various data related to resolution.
Reason: Earlier we had only one resolution array element which we referenced as resolutionsPerAuthority[0]
. However now there are more than one.
resolutionsPerAuthority[0]
Bug: One of the resolution items shows Match
and other shows No Match
. We are not able to retrieve information just by directly extracting it from resolutionsPerAuthority[0]
Match
No Match
resolutionsPerAuthority[0]
Anubhav’s Solution: Understand that it is not necessary that only the 1st element of resolution array can show Match
code. Try if else or iterate over that array to locate which element could capture your request.
Match
//Check Status Code (Match/NoMatch) in 1st Element
console.log("Zero Code===>" +request.intent.slots.SlotName.resolutions.resolutionsPerAuthority[0].status.code);
//Check Status Code (Match/NoMatch) in 2nd Element
console.log("One Code===>" +request.intent.slots.SlotName.resolutions.resolutionsPerAuthority[1].status.code);
//Iterate and if Match condition is satisfied update the ID variable
if((request.intent.slots.SlotName.resolutions.resolutionsPerAuthority[0].status.code) === “ER_SUCCESS_MATCH")
{
console.log("in If");
try
{
var SlotID = request.intent.slots.SlotName.resolutions.resolutionsPerAuthority[0].values[0].value.id; console.log("SlotTwoID Collected");
}
catch(Error)
{
console.log("In Catch”);
}
}
else
{
console.log("in else");
try
{
var SlotID = request.intent.slots.SlotName.resolutions.resolutionsPerAuthority[1].values[0].value.id; console.log("SlotID Collected");
}
catch(Error)
{
console.log("In Catch");
}
}
Due to a similar Issue I was unable to retrieve slot ID
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.