I'm a complete beginner on the Alexa development console. I use Python SDK to create an app which matches food and wine. My code is working but I still have to launch the app (with a LaunchRequest) and then ask the question about a match between food and wine.
I would like to give the possibility to the user to directly ask its question: "Alexa, ask Winy Bot which wine match with a ....".
However I don't know how to do that. I don't know if I have to create a new LaunchRequest or if it's possible to launch an IntentRequest directly.
Here is my code, do you think you could help me ?
class LaunchRequestHandler(AbstractRequestHandler):
def can_handle(self, handler_input):
# type: (HandlerInput) -> bool
return ask_utils.is_request_type("LaunchRequest")(handler_input)
def handle(self, handler_input):
# type: (HandlerInput) -> Response
speak_output = "Bonjour, je suis là pour vous aider. Demandez-moi des informations sur un vin ou sur une association plat / vin. Vous pouvez simplement me donner le nom d'un plat ou d'un vin et je m'occupe du reste.";
reprompt_text = "Vous pouvez par exemple essayer de me demander des informations sur le Chablis.";
return (
handler_input.response_builder
.speak(speak_output)
.ask(reprompt_text)
.response
)
class CapturePlatIntentHandler(AbstractRequestHandler):
def can_handle(self, handler_input):
# type: (HandlerInput) -> bool
return ask_utils.is_intent_name("CapturePlatIntent")(handler_input)
def handle(self, handler_input):
# type: (HandlerInput) -> Response
slots = handler_input.request_envelope.request.intent.slots
plat = slots["plat"].value
attributes_manager = handler_input.attributes_manager
plat_attributes = {
"plat": plat
}
attributes_manager.persistent_attributes = plat_attributes
attributes_manager.save_persistent_attributes()
speak_output = correspondance(plat);
reprompt = "Si vous le souhaitez, vous pouvez me demander des informations sur un de ces vins en disant simplement son nom."
return (
handler_input.response_builder
.speak(speak_output)
.ask(reprompt)
.response
)