phlexa
phlexa copied to clipboard
Better support for Alexa requests
The requests that are sent by the Alexa Voice Service have been grown a lot in the last months. There is plenty of new stuff sent by the AVS that is not represented in the Phlexa\Request\AlexaRequest class hierarchy. So we need to identify these blocks and add them to the class hierarchy by adding new classes and properties to these new classes.
The first step is to pick all missing information from normal requests.
Launch request
{
"version": "1.0",
"session": {
"new": true,
"sessionId": "amzn1.echo-api.session.sessionId",
"application": {
"applicationId": "amzn1.ask.skill.applicationId"
},
"user": {
"userId": "amzn1.ask.account.userId"
}
},
"context": {
"Display": {},
"System": {
"application": {
"applicationId": "amzn1.ask.skill.applicationId"
},
"user": {
"userId": "amzn1.ask.account.userId"
},
"device": {
"deviceId": "amzn1.ask.device.deviceId",
"supportedInterfaces": {
"Display": {
"templateVersion": "1.0",
"markupVersion": "1.0"
},
"Alexa.Presentation.APL": {
"runtime": {
"maxVersion": "1.1"
}
}
}
},
"apiEndpoint": "https://api.eu.amazonalexa.com",
"apiAccessToken": "apiAccessToken"
},
"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": "LaunchRequest",
"requestId": "amzn1.echo-api.request.requestId",
"timestamp": "2019-10-26T17:43:17Z",
"locale": "de-DE",
"shouldLinkResultBeReturned": false
}
}
Intent Request
{
"version": "1.0",
"session": {
"new": false,
"sessionId": "amzn1.echo-api.session.sessionId",
"application": {
"applicationId": "amzn1.ask.skill.applicationId"
},
"attributes": {
"names": [
"Ralf",
"Horst"
],
"count": 2
},
"user": {
"userId": "amzn1.ask.account.userId"
}
},
"context": {
"Display": {},
"Alexa.Presentation.APL": {
"token": "handle-known",
"version": "APL_WEB_RENDERER_GANDALF",
"componentsVisibleOnScreen": [
{
"uid": ":1024",
"position": "1024x600+0+0:0",
"type": "mixed",
"tags": {
"viewport": {}
},
"entities": []
}
]
},
"System": {
"application": {
"applicationId": "amzn1.ask.skill.applicationId"
},
"user": {
"userId": "amzn1.ask.account.userId"
},
"device": {
"deviceId": "amzn1.ask.device.deviceId",
"supportedInterfaces": {
"Display": {
"templateVersion": "1.0",
"markupVersion": "1.0"
},
"Alexa.Presentation.APL": {
"runtime": {
"maxVersion": "1.1"
}
}
}
},
"apiEndpoint": "https://api.eu.amazonalexa.com",
"apiAccessToken": "apiAccessToken"
},
"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.requestId",
"timestamp": "2019-10-26T17:49:26Z",
"locale": "de-DE",
"intent": {
"name": "GreetIntent",
"confirmationStatus": "NONE",
"slots": {
"first_name": {
"name": "first_name",
"value": "horst",
"resolutions": {
"resolutionsPerAuthority": [
{
"authority": "amzn1.er-authority.echo-sdk.amzn1.ask.skill.authority.AMAZON.DE_FIRST_NAME",
"status": {
"code": "ER_SUCCESS_MATCH"
},
"values": [
{
"value": {
"name": "Horst",
"id": "d8716f14eb40a0764407ff1ca2eea315"
}
}
]
}
]
},
"confirmationStatus": "NONE",
"source": "USER"
}
}
}
}
}