get dynamic data from the slot ? not added resolutionsPerAuthority's dynamic element in the list - alexa

I am trying to get dynamic data from the slot
As per documentation and my basic test I am sending directive from launch request as like :
{'version': '1.0', 'response': {'outputSpeech': {'type': 'SSML', 'ssml': '<speak> Hi, welcome to developement dynamic slot. <break time="800ms"/>Please tell me the product name you would be interested in</speak>'}, 'card': {'type': 'Simple', 'title': 'Choose a Medicine.', 'content': 'Pick a Medicine.'}, 'reprompt': {'outputSpeech': {'type': 'SSML', 'ssml': '<speak><break time="5s"/>I am HERE to help You, Please tell me the product and country names you would be interested in.</speak>'}}, 'shouldEndSession': False}, 'directives': [{'type': 'Dialog.UpdateDynamicEntities', 'updateBehavior': 'REPLACE', 'types': [{'name': 'products', 'values': [{'id': 'grnTea', 'name': {'value': 'green tea', 'synonyms': ['matcha']}}, {'id': 'oolTea', 'name': {'value': 'oolong', 'synonyms': ['chinese tea', 'black dragon tea']}}]}]}]}
and when I'm trying to get data which is not statically store in a slot but added in directive slot value.
returns following output :
{ "version": "1.0", "session": { "new": false, "sessionId": "amzn1.echo-api.session.671181ed-1e50-4e4c-b70e-4d854fe7cb78", "application": { "applicationId": "amzn1.ask.skill.c35cd12c-6845-473e-be58-9b1139ee0adb" }, "user": { "userId": "amzn1.ask.account.sadasdsa", "permissions": { "consentToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjEifQ..XyWgyUIjDzzlZ12CR0lbZid6GxwZZYBgarlV-9difbkFjOTxrcvS9lJYWo-Db3wo-fIdXb_jZkCAJBtYPggqnJhLyyC-EDa0_u9aARKthF1_nkbLh5zDOHDb8MyyOYro4BJlqm4XBNd1qyeQUV2M4fdca1YSEnbEun_6kWOKeFRS-14zcwMj5E-MHcBbeDX799A_kay82kS8VGeMhSUsXPTZFrwOKHcFweJTqXFNOkBxME8kAFfS1JB5MNbA3TujVIsIgTBSNQaJeHRksConKt0u06ATrjffzFkcmbxDT5HoJH4NqDgS0y_GdtaeXQM3LJ-MN0-_DMX2QVEaL6kUUw" } } }, "context": { "System": { "application": { "applicationId": "amzn1.ask.skill.c35cd12c-6845-473e-be58-9b1139ee0adb" }, "user": { "userId": "amzn1.ask.account.aasdasdasdasdas", "permissions": { "consentToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjEifQ.asdjaskdhas.XyWgyUIjDzzlZ12CR0lbZid6GxwZZYBgarlV-9difbkFjOTxrcvS9lJYWo-Db3wo-fIdXb_jZkCAJBtYPggqnJhLyyC-EDa0_u9aARKthF1_nkbLh5zDOHDb8MyyOYro4BJlqm4XBNd1qyeQUV2M4fdca1YSEnbEun_6kWOKeFRS-14zcwMj5E-MHcBbeDX799A_kay82kS8VGeMhSUsXPTZFrwOKHcFweJTqXFNOkBxME8kAFfS1JB5MNbA3TujVIsIgTBSNQaJeHRksConKt0u06ATrjffzFkcmbxDT5HoJH4NqDgS0y_GdtaeXQM3LJ-MN0-_DMX2QVEaL6kUUw" } }, "device": { "deviceId": "amzn1.ask.device.ajshdjkhasjkhdkjsahkasdhjasd", "supportedInterfaces": {} }, "apiEndpoint": "https://api.eu.amazonalexa.com", "apiAccessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjEifQ.asdhjashjdhajsd.RQhzWmnhN9K_dCbsFXBPPoLVzuwe5BWjAruwJNF1pVr11PiygVgQ64W3CNng2sK1thT2tl6r3GuRtG-1133Aw1KPWtMuHElu7CTrFfgAqW8blpK37PJIvPMOUGBw1rbrgCTMdy8Ua7qSFV_Y_wlOJaV3-apDGBqhQKE_-dE-ntWYZuIySlY3l8hBs_66eELS-LiL5DEDJk1hfvC2C6ZFB7A7P8mx4Hb71km-lYaElJS0-FDP0C-LdSp6dCbzV23W4JehtTGL4kJ1JEQgWyuNAAkt_HmPcEYlPp8T5RFceDuVuz-ZZBFyiVKuAN8VmxyFsmnC3SXi4yb3RKm1SCcorg" }, "Viewport": { "experiences": [ { "arcMinuteWidth": 246, "arcMinuteHeight": 144, "canRotate": false, "canResize": false } ], "shape": "RECTANGLE", "pixelWidth": 1024, "pixelHeight": 600, "dpi": 160, "currentPixelWidth": 1024, "currentPixelHeight": 600, "touch": [ "SINGLE" ], "video": { "codecs": [ "H_264_42", "H_264_41" ] } }, "Viewports": [ { "type": "APL", "id": "main", "shape": "RECTANGLE", "dpi": 160, "presentationType": "STANDARD", "canRotate": false, "configuration": { "current": { "video": { "codecs": [ "H_264_42", "H_264_41" ] }, "size": { "type": "DISCRETE", "pixelWidth": 1024, "pixelHeight": 600 } } } } ] }, "request": { "type": "IntentRequest", "requestId": "amzn1.echo-api.request.0f3b51f1-880b-483f-8410-3210e81e5b59", "timestamp": "2020-01-01T11:48:09Z", "locale": "en-IN", "intent": { "name": "productcheck", "confirmationStatus": "NONE", "slots": { "products": { "name": "products", "value": "green tea", "resolutions": { "resolutionsPerAuthority": [ { "authority": "amzn1.er-authority.echo-sdk.amzn1.ask.skill.c35cd12c-6845-473e-be58-9b1139ee0adb.products", "status": { "code": "ER_SUCCESS_NO_MATCH" } } ] }, "confirmationStatus": "NONE", "source": "USER" } } } } }
It's not added resolutions resolutionsPerAuthority's second(dynamic) element in the list.
anybody can help me out from this problem?

I tested your added directive exactly as pasted and the dynamic entity resolved as expected:
"slots": {
"products": {
"name": "products",
"value": "matcha",
"resolutions": {
"resolutionsPerAuthority": [
{
"authority": "amzn1.er-authority.echo-sdk.amzn1.ask.skill.****.products",
"status": {
"code": "ER_SUCCESS_NO_MATCH"
}
},
{
"authority": "amzn1.er-authority.echo-sdk.dynamic.amzn1.ask.skill.****.products",
"status": {
"code": "ER_SUCCESS_MATCH"
},
"values": [
{
"value": {
"name": "green tea",
"id": "grnTea"
}
}
]
}
]
},
"confirmationStatus": "NONE",
"source": "USER"
}
}
Could you share your skill's interaction model to investigate further?

Related

Removing and printing name/value pair from json using jolt

I want to remove a name/value pair from inside a json array and print it outside. I started by trying this and then expanding the whole request to be a json array. The solution mentioned above does not seem to be working.
Input :
[
{
"createdBy": "Admin",
"createdDate": "2022-09-08",
"modifiedBy": "Admin",
"attrs": [
{
"name": "Type",
"value": "Postpaid"
},
{
"name": "subscriber",
"value": "Paid"
},
{
"name": "Details",
"value": {
"createdDate": "today",
"description": "offer",
"id": null
}
}
],
"relatedInfo": [
{
"type": "Number",
"name": "000000"
},
{
"type": "Type",
"name": "Post"
}
]
},
{
"createdBy": "Admin",
"createdDate": "2022-09-08",
"modifiedBy": "Admin",
"attrs": [
{
"name": "Type",
"value": "Postpaid"
},
{
"name": "subscriber",
"value": "Paid"
},
{
"name": "Details",
"value": {
"createdDate": "today",
"description": "offer",
"id": null
}
}
],
"relatedInfo": [
{
"type": "Number",
"name": "000000"
},
{
"type": "Type",
"name": "Post"
}
]
}
]
Desired Output :
[
{
"createdBy": "Admin",
"createdDate": "2022-09-08",
"modifiedBy": "Admin",
"attrs": [
{
"name": "Type",
"value": "Postpaid"
},
{
"name": "subscriber",
"value": "Paid"
}
],
"Details": {
"createdDate": "today",
"description": "offer",
"id": null
},
"relatedInfo": [
{
"type": "Number",
"name": "000000"
},
{
"type": "Type",
"name": "Post"
}
]
},
{
"createdBy": "Admin",
"createdDate": "2022-09-08",
"modifiedBy": "Admin",
"attrs": [
{
"name": "Type",
"value": "Postpaid"
},
{
"name": "subscriber",
"value": "Paid"
}
],
"Details": {
"createdDate": "today",
"description": "offer",
"id": null
},
"relatedInfo": [
{
"type": "Number",
"name": "000000"
},
{
"type": "Type",
"name": "Post"
}
]
}
]
Current Jolt spec:
[
{
"operation": "shift",
"spec": {
"*": "[&]",
"attrs": {
"*": {
"name": {
"*": { "#2": "&4" },
"Details": {
"#(2,value)": "&1"
}
}
}
}
}
}
]
I can't seem to figure out how the jolt spec would change in case of the array
So far so good, just need to combine the attributes at a common node. To do this, I've used the identifiers [&1] and [&5] in order to reach the level of the outermost index within the tree such as
[
{
"operation": "shift",
"spec": {
"*": {
"*": "[&1].&",
"attrs": {
"*": {
"name": {
"*": {
"#2": "[&5].&4"
},
"Details": {
"#(2,value)": "[&5].&1"
}
}
}
}
}
}
}
]

Alexa custom skill: getting FallbackIntent instead of validation prompt

I have an interaction model with a GetMenuIntent which I can invoke with "what's for {meal}". meal is a MealType custom slot with allowed values of "breakfast" and "lunch". I added validation on the meal slot in my GetMenuIntent to only allow those values defined in the slot type and it works great for those configured values.
However, after saving and building my model, when I put "what's for dinner" into the Utterance Profiler or the interactive tester, It ended up calling my FallbackIntent instead of reprompting for a correct value.
I feel like what I'm trying to do isn't really much different than Amazon's own example here.
Here's "whats for lunch" working correctly:
And here's "whats for dinner" ignoring my GetMenuIntent and calling FallbackIntent instead:
Here's my interaction model:
{
"interactionModel": {
"languageModel": {
"invocationName": "school menus",
"intents": [
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{
"name": "AMAZON.HelpIntent",
"samples": []
},
{
"name": "AMAZON.StopIntent",
"samples": []
},
{
"name": "AMAZON.NavigateHomeIntent",
"samples": []
},
{
"name": "GetMenuIntent",
"slots": [
{
"name": "meal",
"type": "Meal"
},
{
"name": "date",
"type": "AMAZON.DATE"
}
],
"samples": [
"whats for {meal} {date}",
"what will you have for {meal} {date}",
"what is on the menu for {meal} {date}",
"what are we having for {meal} {date}",
"what we're having for {meal} {date}"
]
},
{
"name": "AMAZON.FallbackIntent",
"samples": []
}
],
"types": [
{
"values": [
{
"name": {
"value": "lunch"
}
},
{
"name": {
"value": "breakfast"
}
}
],
"name": "Meal"
}
]
},
"dialog": {
"intents": [
{
"name": "GetMenuIntent",
"confirmationRequired": false,
"prompts": {},
"slots": [
{
"name": "meal",
"type": "Meal",
"elicitationRequired": false,
"confirmationRequired": false,
"prompts": {},
"validations": [
{
"type": "hasEntityResolutionMatch",
"prompt": "Slot.Validation.806855880612.19281662909.602239253259"
}
]
},
{
"name": "date",
"type": "AMAZON.DATE",
"elicitationRequired": false,
"confirmationRequired": false,
"prompts": {}
}
]
}
],
"delegationStrategy": "ALWAYS"
},
"prompts": [
{
"id": "Slot.Validation.806855880612.19281662909.602239253259",
"variations": [
{
"type": "PlainText",
"value": "Hmm, I don't know about that menu type. Please try again."
}
]
}
]
},
"version": "48"
}
Since this is 6 months old I assume you figured out by now that your interaction model only includes Lunch and Breakfast.

400 Bad Request on Alexa AddOrUpdateReport using JSON from documentation

My issue is basically described in title but I'll add a little bit more details here.
I'm trying to proactively send an update report to Alexa's Event Hub for Smart Home skills, however this fails with a 400 Bad Request error, and this is what the server responds:
{
"header": {
"namespace": "System",
"name": "Exception",
"messageId": "a154410c-2364-4c5b-9028-accde5048e1e"
},
"payload": {
"code": "INVALID_REQUEST_EXCEPTION",
"description": "Event or endpoint is missing in the request."
}
}
I decided then to check if my request was wrong by sending the one that can be found on their documentation, and I'm getting the very same error.
This is the JSON copied from Amazon's documentation (I just replaced device metadata and the token):
{
"event": {
"header": {
"namespace": "Alexa.Discovery",
"name": "AddOrUpdateReport",
"payloadVersion": "3",
"messageId": "5f8a426e-01e4-4cc9-8b79-65f8bd0fd8a4"
},
"payload": {
"endpoints": [
{
"endpointId": "<unique ID of the endpoint>",
"manufacturerName": "Sample Manufacturer",
"description": "Smart Light by Sample Manufacturer",
"friendlyName": "Kitchen Light",
"additionalAttributes": {
"manufacturer" : "Sample Manufacturer",
"model" : "Sample Model",
"serialNumber": "<the serial number of the device>",
"firmwareVersion" : "<the firmware version of the device>",
"softwareVersion": "<the software version of the device>",
"customIdentifier": "<your custom identifier for the device>"
},
"displayCategories": [
"LIGHT"
],
"capabilities": [
{
"type": "AlexaInterface",
"interface": "Alexa.PowerController",
"version": "3",
"properties": {
"supported": [
{
"name": "powerState"
}
],
"proactivelyReported": true,
"retrievable": true
}
},
{
"type": "AlexaInterface",
"interface": "Alexa.BrightnessController",
"version": "3",
"properties": {
"supported": [
{
"name": "brightness"
}
],
"proactivelyReported": true,
"retrievable": true
}
}
],
"connections": [
],
"cookie": {
}
}
],
"scope": {
"type": "BearerToken",
"token": "access-token-from-Amazon"
}
}
}
}
What I don't understand is why it reports that event or endpoints are missing if they're clearly there and if this JSON is the one that they provide in their documentation.
Does anyone have this issue too?
EDIT: pasting my payload as requested.
{
"event": {
"header": {
"namespace": "Alexa.Discovery",
"name": "AddOrUpdateReport",
"payloadVersion": "3",
"messageId": "132137185729061389"
},
"payload": {
"endpoints": [
{
"endpointId": "Rmxvb2RTZW5zb3JfMDE=",
"friendlyName": "Flood sensor",
"description": "Flood sensor",
"manufacturerName": "MyCompany",
"displayCategories": [
"ACTIVITY_TRIGGER"
],
"cookie": {
"DeviceType": "FloodSensor"
},
"capabilities": [{
"interface": "Alexa",
"type": "AlexaInterface",
"version": "3"
},
{
"interface": "Alexa.EndpointHealth",
"type": "AlexaInterface",
"version": "3",
"properties": {
"supported": [{
"name": "connectivity"
}],
"proactivelyReported": true,
"retrievable": true
}
}
]
}
],
"scope": {
"type": "BearerToken",
"token": "<redacted>"
}
}
}
}

Alexa Skill Not Calling Endpoint Under Certain Conditions

I am developing an Alexa skill and testing it in the Alexa Developer Console. I am having issues with certain questions I ask will trigger no response. On these occasions, my endpoint is not getting called, or the DefaultFallback intent being fired.
I can re-produce the error and it only happens on certain questions. The debug log shows the entries below. I have deployed the skill to a device and get the same response (i.e. nothing). The skill remains open as I can continue to ask other questions and get a response.
If I substitute the word 'sausage' for certain words it gives no response, but using a word such as 'free' will return a response.
Run out of ideas about what is going on...
Event: Text.TextMessage
{
"event": {
"header": {
"namespace": "Text",
"name": "TextMessage",
"messageId": "messageId",
"dialogRequestId": "ba1efffc-b29e-4cef-bcc0-3ceb418b89ec"
},
"payload": {
"textMessage": "do you have any sausage samples"
}
},
"context": [
{
"header": {
"namespace": "System",
"name": "SettingsState",
"payloadVersion": "1"
},
"payload": {
"settings": [
{
"key": "com.amazon.alexa.characteristics.viewport.experiences",
"value": "[{\"arcMinuteWidth\":\"246\",\"arcMinuteHeight\":\"144\",\"canRotate\":\"false\",\"canResize\":\"false\"}]"
},
{
"key": "com.amazon.alexa.characteristics.viewport.shape",
"value": "RECTANGLE"
},
{
"key": "com.amazon.alexa.characteristics.viewport.pixelWidth",
"value": "1024"
},
{
"key": "com.amazon.alexa.characteristics.viewport.pixelHeight",
"value": "600"
},
{
"key": "com.amazon.alexa.characteristics.viewport.dpi",
"value": "160"
},
{
"key": "com.amazon.alexa.characteristics.viewport.currentPixelWidth",
"value": "1024"
},
{
"key": "com.amazon.alexa.characteristics.viewport.currentPixelHeight",
"value": "600"
},
{
"key": "com.amazon.alexa.characteristics.viewport.touch",
"value": "[\"SINGLE\"]"
}
]
}
},
{
"header": {
"namespace": "SpeechSynthesizer",
"name": "SpeechState"
},
"payload": {
"token": "amzn1.as-ct.v1.ThirdPartySdkSpeechlet#ACRI#ValidatedSpeakDirective_amzn1.ask.skill.8f0abe6c-a5e8-4585-912f-4e21df999811_6bf05e00-bc3a-4b1e-8b40-9664b36c0378",
"offsetInMilliseconds": 1000,
"playerActivity": "FINISHED"
}
},
{
"header": {
"namespace": "AudioPlayer",
"name": "PlaybackState"
},
"payload": {
"token": "",
"offsetInMilliseconds": 0,
"playerActivity": "IDLE"
}
},
{
"header": {
"namespace": "Alerts",
"name": "AlertsState"
},
"payload": {
"activeAlerts": [],
"allAlerts": []
}
},
{
"header": {
"namespace": "VisualFocusManager",
"name": "VisualFocusState"
},
"payload": {
"inFocus": {
"component": "ListRenderer",
"idleTimeInMilliseconds": 0
}
}
},
{
"header": {
"namespace": "AudioFocusManager",
"name": "AudioFocusState"
},
"payload": {
"dialog": {
"component": "SpeechSynthesizer",
"idleTimeInMilliseconds": 0
}
}
},
{
"header": {
"namespace": "ListRenderer",
"name": "RenderedListState"
},
"payload": {
"listToken": "amzn1.as-lt.v1.ThirdPartySdkSpeechlet#LRID#amzn1.ask.skill.8f0abe6c-a5e8-4585-912f-4e21df999811::JTEXd",
"itemsVisibleOnScreen": [],
"selectedItems": [],
"focusedItem": {},
"renderedItemDetail": {
"listItemIdentifier": "amzn1.as-lt.v1.ThirdPartySdkSpeechlet#LRID#amzn1.ask.skill.8f0abe6c-a5e8-4585-912f-4e21df999811::JTEXd",
"ordinalNumber": 1
},
"highestOrdinalSeen": 1,
"lastItemOrdinal": 1
}
}
]
}
Directive: SpeechRecognizer.RequestProcessingCompleted
{
"header": {
"namespace": "SpeechRecognizer",
"name": "RequestProcessingCompleted",
"messageId": "77057f6b-8f91-4fb4-aab0-c86efc934adc",
"dialogRequestId": "ba1efffc-b29e-4cef-bcc0-3ceb418b89ec"
},
"payload": {}
}
Directive: SkillDebugger.CaptureDebuggingInfo
{
"header": {
"namespace": "SkillDebugger",
"name": "CaptureDebuggingInfo",
"messageId": "c3175e0f-3c0a-450c-8ef4-5246ce2e1a31"
},
"payload": {
"skillId": null,
"timestamp": "2019-01-21T10:25:31.211Z",
"dialogRequestId": "ba1efffc-b29e-4cef-bcc0-3ceb418b89ec",
"skillRequestId": null,
"type": "ConsideredIntents",
"content": {
"intents": [
{
"name": "General_MobileApp",
"confirmationStatus": "NONE",
"slots": {
"Deliverables": {
"name": "Deliverables",
"value": "samples",
"resolutions": {
"resolutionsPerAuthority": [
{
"authority": "amzn1.er-authority.echo-sdk.amzn1.ask.skill.8f0abe6c-a5e8-4585-912f-4e21df999811.MARSHALLS_Deliverables",
"status": {
"code": "ER_SUCCESS_MATCH"
},
"values": [
{
"value": {
"name": "samples",
"id": "6ef9161b900632671022358216c7dfe7"
}
}
]
}
]
},
"confirmationStatus": "NONE"
},
"Company": {
"name": "Company",
"value": "you",
"resolutions": {
"resolutionsPerAuthority": [
{
"authority": "amzn1.er-authority.echo-sdk.amzn1.ask.skill.8f0abe6c-a5e8-4585-912f-4e21df999811.MARSHALLS_Company",
"status": {
"code": "ER_SUCCESS_MATCH"
},
"values": [
{
"value": {
"name": "Marshalls",
"id": "abfd923a6acfc93e81ba94b0310b47b2"
}
}
]
}
]
},
"confirmationStatus": "NONE"
},
"Media": {
"name": "Media",
"value": null,
"confirmationStatus": "NONE"
},
"Contact": {
"name": "Contact",
"value": null,
"confirmationStatus": "NONE"
}
}
}
]
}
}
}
Edit:
I now think a certain confidence score is not being met causing the intent not to fire (but not then calling the default fallback intent). If I ask 'flag laying patterns' the intent fires correctly and I get a full debug trace:-
If I ask 'flag laying sausages' then I get a small debug trace together with the same considered intent, but no answer and no endpoint call:-

DataTables - Load data from pre-defined JSON

I have a problem pointing dataTable to the right spot in the JSON. I receive a nested array:
{
"status": "ok",
"count": "7",
"msg ": "Operation Successful",
"data": [{
"contactHasServiceArea": true,
"issueCategories": [{
"id": "8",
"description": "Finance"
},
{
"id": "9",
"description": "Housing"
},
{
"id": "10",
"description": "International"
}
],
"cases": [{
"id": 31645,
"client_name": "Matthew",
"issue": "Assessment Completion",
"referral": null,
"opened_date": "10\/07\/2017",
"case_status": "Open"
}, {
"id": 31668,
"client_name": "Fanky ",
"issue": "Complex",
"referral": null,
"opened_date": "01\/07\/2017",
"case_status": "Open"
}]
}]
}
How do I point to the "cases" object? I'm sure this is simply, but I'm confused by the many options in the dataTables config.
I tried variations of data, dataSrc as well as data.cases or just cases, etc.
Thanks
$('#cases_table').DataTable( {
"ajax": "ajax/getCases",
"dataSrc" : "data.cases",
"data" : "cases",
"columns": [
{ "data": "client_name" },
{ "data": "issue" },
{ "data": "referral" },
{ "data": "opened_date" },
{ "data": "case_status" }
]
} );
You can configure like this:
$('#cases_table').DataTable( {
"ajax": {
"url": "ajax/getCases",
"dataSrc" : "data.cases"
},
"columns": [
{ "data": "client_name" },
{ "data": "issue" },
{ "data": "referral" },
{ "data": "opened_date" },
{ "data": "case_status" }
]
} );
datasrc points into the returns json. Remove the data option.

Resources