question

asadaoui avatar image
asadaoui asked

Alexa says SmartHome scene is not responding

Hello

I have a smart home skill which always gets HTTP 400 (INVALID_REQUEST_EXCEPTION: The request was malformed) when sending an ActivationStarted response after a DeferredResponse.

Then Alexa complains after 8 seconds that the scene is not responding.

I can't find any typo or mistake in my response.
Do you have any idea what could cause it?

Here are the requests I make/receive when activating a home scene using a voice interaction.

  • Voice interaction: "Alexa Turn on...", Payload Alexa -> skill:
	
{
    "directive": {
        "header": {
            "namespace": "Alexa.SceneController",
            "name": "Activate",
            "payloadVersion": "3",
            "messageId": "4d4a5a20-57fb-4fe6-998d-1506667d20b2",
            "correlationToken": "AAAAAAAAAQ...bpnLQ=="
        },
        "endpoint": {
            "scope": {
                "type": "BearerToken",
                "token": "SAvQ6...NdVRa"
            },
            "endpointId": "a727ff14",
            "cookie": {}
        },
        "payload": {}
    }
}
  • Synchronous response skill -> Alexa:
{
    "event": {
        "header": {
            "messageId": "9764a7e8-7000-48db-b1cb-c65b475eff49",
            "namespace": "Alexa",
            "name": "DeferredResponse",
            "payloadVersion": "3",
            "correlationToken": "AAAAAAAAAQ...bpnLQ=="
        },
        "payload": {
            "estimatedDeferralInSeconds": 1
        }
    }
}
  • After about one second, Asynchronous response skill -> Alexa:
POST api.eu.amazonalexa.com/v3/events
Authorization: Bearer Atza|IwEBIMP...qWuKNg
Content-Type: application/json

{
    "event": {
        "header": {
            "messageId": "a924392f-fedb-49b4-99da-0b05aa68bd7b",
            "namespace": "Alexa.SceneController",
            "name": "ActivationStarted",
            "payloadVersion": "3",
            "correlationToken": "AAAAAAAAAQ...bpnLQ=="
        },
        "payload": {
            "cause": {
                "type": "VOICE_INTERACTION"
            },
            "timestamp": "2019-02-21T15:59:22.381232Z"
        },
        "endpoint": {
            "endpointId": "526cde62",
            "scope": {
                "type": "BearerToken",
                "token": "Atza|IwEBIMP...qWuKNg"
            }
        }
    }
}
  • Error HTTP 400 from Alexa -> skill:
{
    "header": {
        "namespace": "System",
        "name": "Exception",
        "messageId": "333a8dff-f178-48a2-b19f-51460949c52b"
    },
    "payload": {
        "code": "INVALID_REQUEST_EXCEPTION",
        "description": "The request was malformed."
    }
}
alexa smart homescenes
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

roy-1 avatar image
roy-1 answered

Hi asadaoui,


Currently, Scenes are not a device type that is currently supported by deferred response. Please keep an eye on the Alexa Developer Blog for future updates:

https://developer.amazon.com/blogs/alexa/

2 comments
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@Roy@amazon,

If deferred asynchronous responses for Scenes are not supported, the documentation for the Alexa.SceneController Interface is either wrong or misleading. At https://developer.amazon.com/docs/device-apis/alexa-scenecontroller.html#activation-started it says:

If you handle an Activate directive successfully, respond with an ActivationStarted event. You can respond synchronously or asynchronously. If you respond asynchronously, include a correlation token; otherwise it is not required.

So is there any other way to respond asynchronously besides first responding with a deferred response? If so, please let me know. Either way, please update the documentation so that it is clear and correct.

0 Likes 0 ·

Yes, you can respond asynchronously with a regular Response event. DeferredResponse <> asynchronous. DeferredResponse is for endpoints that change state slowly. DeferredResponse is always sent synchronously. DeferredResponse does not replace Response: after you send a synchronous DeferredResponse, you must also send a regular Response, and you can send that synchronously or asynchronously. I've updated the documentation for Alexa.Response to try and explain that all better. https://developer.amazon.com/docs/device-apis/alexa-response.html

0 Likes 0 ·
Nicole@amazon avatar image
Nicole@amazon answered

Thanks for these questions and feedback. As pointed out already, SceneController is not supported for DeferredResponse.


However, in the original code example, there is another problem: DeferredResponse does not replace Response. After you send a DeferredResponse, you must then send a regular Response also. I've updated the documentation here to try and make that more clear. https://developer.amazon.com/docs/device-apis/alexa-response.html

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.