0

Alexa has released CanFulfillIntentRequest feature or Name-free Interaction for custom skills recently. I am trying to implement it in my existing skill which uses alexa-sdk. Please find my code below:

'use strict';
const Alexa = require('alexa-sdk');

var handlers = {
    'LaunchRequest': function() {
        var speechOutput = "You can ask me to read out quotes from Steve Jobs";
        var repromptText = "Sorry I didnt understand";
        this.emit(':tell', speechOutput, repromptText);
    },
    'RandomQuote': function() {
        let data = getQuoteFunction();
        const author = data[0];
        const quote = data[1];

        let cardTitle = "Quotation from author";
        let cardContent = "Actual quote";
        let speechOutput = "Actual quote";

        // Speak out the output along with card information
        this.emit(':tellWithCard', speechOutput, cardTitle, cardContent);   
    }    
}

exports.handler = function (event, context, callback) {
    const alexa = Alexa.handler(event, context, callback);
    alexa.registerHandlers(handlers);
    alexa.execute();
};

Do we need to add handler for CanFulfillIntentRequest, the way I did for other handlers ? for example:

var handlers = {
    'LaunchRequest': function() {
    },
    'RandomQuote': function() {
    },
    'CanFulfillIntentRequest': function() {
        //code to handle
    }
}

Is this feature only available in ASK SDK v2 for Node.js ? Can we implement it in skill developed using alexa-sdk. Could anyone please let me know ?

Thanks

Ashy Ashcsi
  • 1,529
  • 7
  • 22
  • 54
  • ASK SDK V2 public-beta is the only supported node.js and english(US) skills only – Chuck LaPress Sep 12 '18 at 13:22
  • 1
    Reference this repo on github for question on implementing https://github.com/PaulCutsinger/Sample-For-Can-Fulfill-Intent-Request – Chuck LaPress Sep 12 '18 at 13:28
  • The above repository is using ASK SDK V2. I want to know if I can use it in skills developed using alexa sdk. For example can I use: var canfulfillIntentRequest = Alexa.CreateStateHandler() If not then I will have to migrate the entire skill to version 2. – Ashy Ashcsi Sep 18 '18 at 07:59
  • The answer as stated above is no, canfulfillIntentRequest will only currently work utilizing ASK SDK V2 public-beta – Chuck LaPress Sep 18 '18 at 13:51
  • thanks @chucklapress for the answer. We have to either migrate the existing version 1 skill or rewrite the entire skill using ask-sdk v2 public beta. – Ashy Ashcsi Sep 20 '18 at 11:35

0 Answers0