I have a Version 3 Alexa SmartHome skill and supporting Node.js Lambda that appears to respond properly to the Alexa Discovery Event based on the Version 3 documentation. Then, however, it receives a ReportState event. But the JSON is formatted differently than the documentation leads me to expect (and handle in the Lambda code).
Here is the event I'm logging:
2019-04-15T20:26:56.106Z 1ab5cdb6-7bbb-4652-9f2d-b7e6d19cce2a exports.handler event =
{ "namespace": "Alexa", "name": "ReportState", "payloadVersion": "3", "messageId": "adeeb64e-55e2-4e42-b1dc-8df0841cf936", "correlationToken": "... deleted..." }
But the documentation ( https://developer.amazon.com/docs/smarthome/state-reporting-for-a-smart-home-skill.html#report-state-when-alexa-requests-it) says it should look like:
{
"directive": {
"header": {
"messageId": "abc-123-def-456",
"correlationToken": "abcdef-123456",
"namespace": "Alexa",
"name": "ReportState",
"payloadVersion": "3"
},
"endpoint": {
"endpointId": "appliance-001",
"cookie": {},
"scope": {
"type": "BearerToken",
"token": "access-token-from-skill"
}
},
"payload": {}
}
}
Where is the directive and endpoint wrapper? Do I have to check to see if the event JSON contains "directive" and "header"?