0

In the documentation, content is not enough to exactly implement TouchWrapper component. Anyone who could help?

I have referred- https://developer.amazon.com/docs/alexa-presentation-language/apl-touchwrapper.html

https://medium.com/@punkpocko/alexa-apl-touch-wrappers-75d62784b3e8

def can_handle(self, handler_input):
    return handler_input.request_envelope.request.type = 'Alexa.Presentation.APL.UserEvent' and handler_input.request_envelope.request.arguments.length>0 and (handler_input.request_envelope.request.arguments[0] == "Desi Flavors" or handler_input.request_envelope.request.arguments[0] == 'Global Flavors')

def handle(self, handler_input):
    if handler_input.request_envelope.request.arguments[0] == "Desi Flavors":
        dish ='Desi Flavors'
    elif handler_input.request_envelope.request.arguments[0] == "Global Flavors":
        dish ='Global Flavors'
    return dish

Here is JSON- { "type":"TouchWrapper", "item":{ "type":"Text", "text":"", "color":"", "fontSize":"" }, "OnPress":{ "type":"SendEvent", "arguments":[ "Desi Flavors", "Global Flavors" ] }

}

I expect the output that if one chooses Desi Flavors it should get stored in the variable(dish).

s.dhruvi
  • 43
  • 11
  • Correct Answer in Python - def can_handle(self, handler_input): return handler_input.request_envelope.request.source['type'] = ='TouchWrapper' and (handler_input.request_envelope.request.arguments[0] == "Desi Flavors" or handler_input.request_envelope.request.arguments[0] == 'Global Flavors') def handle(self, handler_input): if handler_input.request_envelope.request.arguments[0] == "Desi Flavors": dish ='Desi Flavors' elif handler_input.request_envelope.request.arguments[0] == "Global Flavors": dish ='Global Flavors' return dish – s.dhruvi May 02 '19 at 06:27
  • this entry is not written as a question. what are you asking exactly? – German Jun 20 '19 at 09:53

0 Answers0