How can we catch touches in Python if I'm using decorator subscriptions? I'd think the following code would be the minimum, without even checking arguments, but that doesn't work.
# Doesn't work @sb.request_handler(can_handle_func=is_request_type("Alexa.Presentation.APL.UserEvent")) def touch_handler(handler_input): speak_output = "Touched!" return ( handler_input.response_builder .speak(speak_output) .response )
TouchWrappers are set to:
"onPress": [ { "type": "SendEvent", "arguments": [ "colorSwatch", "${color}" ] } ]
I've added the array because APL creator interface would complain and add warnings if I would assign the event dict directly as "onPress": {...} like in the examples I saw.
I'm trying to learn how to convert the example bellow to the @sb.request_handler decorator style:
def can_handle(handler_input): return is_intent_name("RecipeIntent")(handler_input) or \ (is_request_type('Alexa.Presentation.APL.UserEvent')(handler_input) and len(list(handler_input.request_envelope.request.arguments)) > 0 and list(handler_input.request_envelope.request.arguments)[0] == 'sauceInstructions')