question

hmmmdada avatar image
hmmmdada asked

Alexa.Channelchange running in loops

a few things on documentation and the API itself:

1. The documentation is not consistent, in the Example the response for a channelchange is described as:

<code>def handleChannelControl(context, event):
         payload = {}
         header = {}
         messageId = event['directive']['header']['messageId']
         if event['directive']['header']['name'] == 'ChangeChannel':
             header = {
                 "namespace":"Alexa.ChannelController",
                 "name":"ChannelChanged",
                 "payloadVersion":"3",
               "  messageId": messageId
             }
         response = {
             'header': header,
             'payload': payload
         }
         return { 'event': response }

if you look at the API documention it is described as:

<code>{"context":{"properties":[]},"event":{"header":{"messageId":"30d2cd1a-ce4f-4542-aa5e-04bd0a6492d5","correlationToken":"dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==","namespace":"Alexa","name":"Response","payloadVersion":"3"},"endpoint":{"scope":{"type":"DirectedUserId","directedUserId":"some-Amazon-user-id"},"endpointId":"videoDevice-001"},"payload":{}}}

which one is correct????

2. there seems to be an issue with the API:

if i say "Alexa, change channel to Sky Cinema" the event is raised in the Lamba Endpoint, forwarded to my Cloud and the Response is send from the Lambda

What happens now is:

Alexa answers with "Ich schalte auf Sk" approx. 5 Times until it says "Ich schalte auf Sky Cinema" or saying "There is an issue with Skillname"

Skill ID: amzn1.ask.skill.ade205f2-aea7-4239-a359-8cabea7f799c

video skill api
10 |5000

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

tartan_guru avatar image
tartan_guru answered

You are getting multiple requests because, as you suspect, there is an issue with your response. It took me a while to get it right, but here is the JSON response that works for me:-

{
  "context": {
        "properties": []  
      },
      "event": {
        "header": {
          "messageId": createMessageId(),
          "correlationToken": correlationToken,
          "namespace": "Alexa",
          "name": "Response",
          "payloadVersion": "3"
        },
        "endpoint": {
          "scope": {
            "type": "DirectedUserId",
            "directedUserId": "some-Amazon-user-id"
           },
           "endpointId" :  "Test"
        },
        "payload": { }
      }
    }
10 |5000

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

Brian@Amazon avatar image
Brian@Amazon answered

Thanks for reporting this. Where are you seeing the conflicting documentation?

Tartan_guru is correct that that format is correct.

10 |5000

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