Hi There,
I'm trying to implement CanFulfilIntentRequest in pyhton and trying to get some sample code. Is there any sample code available?
Thanks.
Hi There,
I'm trying to implement CanFulfilIntentRequest in pyhton and trying to get some sample code. Is there any sample code available?
Thanks.
I've got CanFulFIlIntentrtequestHandler as below. But I'm not sure how that will redirect to appropriate intent.
class CanFulfilIntentHandler(AbstractRequestHandler): """Handler for can fulfil handle intent.""" def can_handle(self, handler_input): # type: (HandlerInput) -> bool return is_request_type("CanFulfillIntentRequest")(handler_input) def handle(self, handler_input): fulfilintent = CanFulfillIntent(True) handler_input.response_builder.set_can_fulfill_intent(fulfilintent) return handler_input.response_builder.response
request which I'm sending(code fragment) is
"request": { "type": "CanFulfillIntentRequest", "requestId": "amzn1.echo-api.request.7bb9c640-f0fd-4c7e-xxxxxxxxxxx", "timestamp": "2019-06-08T13:52:37Z", "locale": "en-US", "intent": { "name": "WifiIntent", "confirmationStatus": "NONE" }, "dialogState": "STARTED" }
and the response I get is
'response': {'canFulfillIntent': {'canFulfill': True}}}
so my question is how can I get this request to the intent 'wifiIntent'?
Any pointers will e of great help.
Thanks heaps.
Read more here how CFIR work in more detail: docs. Overall if you mark that you can fulfil 'WifiIntent', then if Alexa decides that your CFIR is the best, she will invoke that intent. Basically, what intent you mark that you can fulfil, that intent will get invoked.
Here is the example, even though it is written in JS, but I think it can help you to get a sense how it works.
Thanks for that. I've got that going and appropriate intent is invoked when testing using Json in Developer console.
However my problem now is that it is not getting invoked from the device without invocation name.
My skill works fine with the echo device with name invocation. But it is not getting any CanFulfillI requests.
Is there more config required?
Cheers
Well, even if you have added CFIR, it doesn't mean that it will get invoked always. CFIR is used more as a fallback for alexa. If she doesn't find an exact match to the command user gave, she'll send CFIR to some skills, to see if any of them can handle it and only then, your skill might get chosen, but might not. So yeah, it could get invoked, but chances are pretty slim.
Ok, to answer my own question, I check for the intent name in the handle() method and call the appropriate handler.
intent_name = handler_input.request_envelope.request.intent.name if (intent_name == 'xxxIntent'): return xxxIntentHandler.handle(self, handler_input)
2 People are following this question.
Functional Test returning error for CanfulFillIntentRequest whereas Manual JSON tests work
CanFullfilIntentRequest Failed to Build
Canfulfillintentrequest for Alexa possible if country and postal code permissions are needed?
Question about CanFulfillIntentRequest response schemas
CanFulfillIntentRequest sending authority with "_Live" in resolutionsPerAuthority