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).