Dustin Coates in Alexa

CanFulfillIntentRequest with Alexa SDK for Node.js

The lines are blurry for many users of the difference between “first-party” skills and “third-party” skills. They just want answers. Builders meanwhile just want traffic. Features like implicit invocation on the Actions on Google platform and CanFulfillIntentRequest for Alexa answer both needs. Recently, the Alexa team added support for CanFulfillIntentRequest directly into the ASK SDK for Node.js.

You first need to understand that name-free interaction through CanFulfillIntentRequest works through a few steps:

  1. The user makes a request without providing a specific skill’s invocation name
  2. Alexa chooses “top” skills based on some magic on the platform
  3. Alexa queries the skills, collecting responses (this isn’t a real request yet, so the code shouldn’t change any state)
  4. Alexa determines the best response
  5. Alexa sends a normal IntentRequest to the skill

The skill needs to let Alexa know if the skill can fulfill the intent (as the name says). The skill can specify if it understands the slot values. This now lives on the response builder, like so:

const ability = {
  canFulfill : `YES`,
  slots : {
    color : {
      canUnderstand : `YES`,
      canFulfill : `YES`,
    }
  }
};

return responseBuilder.withCanFulfillIntent(ability).getResponse();

You can also specify MAYBE if your skill can maybe handle the request after getting more information.

Make sure you’re upgraded to version 2.3.0 of the ASK SDK to take advantage of this change.