aniztar
aniztar

Reputation: 2913

Alexa - Implementing CanFulfillIntentRequest in python

I have enabled the CanFulfillIntentRequest from the alexa skill developer console in English(U.S) of my skill. I have added a handler in my lambda for the CanFulfillIntentRequest. When I use the skill tester and type the intent utterance directly (without skill invocation name), it doesn't seem to hit my code. I can't find any related logs in the cloudwatch.

def lambda_handler(event, context):
    print("event.session.application.applicationId=" +
          event['session']['application']['applicationId'])

    if event['session']['new']:
        on_session_started({'requestId': event['request']['requestId']},
                           event['session'])

    if event['request']['type'] == "LaunchRequest":
        return on_launch(event['request'], event['session'])
    elif event['request']['type'] == "IntentRequest":
        return on_intent(event['request'], event['session'])
    elif event['request']['type'] == "SessionEndedRequest":
        return on_session_ended(event['request'], event['session'])
    elif event['request']['type'] == "CanFulfillIntentRequest":
        return on_canfullfill(event['request'], event['session'])

def on_canfullfill(request, session):
    print ("Yes, I can!")

I know this has to respond back with a JSON specifying if the skill can or cannot take up this request. But shouldn't there be a - 'Yes, I can!' entry in the cloud watch logs?

What am I missing here? Also, where can I find documentation/apis on forming and sending the reponse for this request?

Upvotes: 2

Views: 715

Answers (1)

johndoe
johndoe

Reputation: 4387

It looks like you can only test CanFulfillIntentRequest using Manual JSON tab from developer console and using ASK CLI.

From Alexa documentation

You cannot test CanFulfillIntentRequest with an Alexa-enabled device

More on testing CanFulfillIntentRequest here

Upvotes: 2

Related Questions