As voice commerce grows, so will customers’ expectations that they’ll be able to purchase premium content from Alexa skills. Allowing for the discovery of this premium content is a key dimension of how developers incorporate in-skill purchasing (ISP) into their skills. The ideal experience will include suggesting a relevant in-skill product (also called an “upsell”) during a moment of customer need.
For example, you can offer an in-skill product to extend a game right as the game ends, or suggest premium content once the customer is finished with the free content. There may be other moments like this in your skill, but there will also be times when customers don’t wait for you to make a suggestion. Instead, the customer takes an active role in discovering what your skill offers by asking, “what can I buy?”
This question is a gateway for customers to find out what in-skill products your skill offers. Supporting this question with a response is required for your skill to be eligible for promotion through Amazon marketing channels. Customers could be just exploring your skill, or may not remember your offers from their earlier interactions with it. Whatever the customer’s reason, your skill should have a good response ready.
The basic response to the “What can I buy?” utterance should be a suggested in-skill product the customer can buy. What and how this suggestion is made depends on the number and type of in-skill products your skill offers. For example:
This last scenario highlights that a good customer experience will not end with simply supporting, “What can I buy?” Customers will ask about specific products with utterances such as, “Tell me about product XYZ.” Your skill will need to respond, typically with an upsell response. Customers may even directly ask to buy something with, “I want to buy product XYZ.” In this case, your skill should not use the upsell response. Instead, send the customer directly into the purchase (buy) flow. If you send the upsell message first, it can frustrate some customers since they’ve made a clear indication that they want to buy it. It’s obvious that your skill should be able to help customers learn more and purchase your currently available in-skill products. However, you should also include responses regarding discontinued products. Discontinued products are those products you no longer offer for sale, but your skill should still support them for customers who already bought them. A customer might ask about one of these products and you will need to provide accurate information, whether that is to tell new customers that the product is discontinued or to tell customers who have purchased it how they can continue to access the product.
A customer may ask for more information about a product they have already purchased. This is not the right time to send an upsell request, as the customer most likely is asking for help in using the product (not for help in purchasing it). Be sure to check the entitlement status for the product before making an upsell.
To support the “What can I buy?” utterance, create a new intent, typically called “WhatCanIBuyIntent.” Here is a snippet of the interaction model for this intent:
{
"name": "WhatCanIBuyIntent",
"samples": [
"I want to purchase",
"I want to buy",
"what could i buy",
"can i buy something",
"i want to buy something",
"what is available to buy",
"what can i buy",
"what can i shop for",
"tell me what I can buy"
]
},
In addition to having a “What can I buy” utterance supported in the interaction model, you will need to add an intent handler in your skill’s back-end code. Let’s walk through the one used in the premium facts sample skill. We’ll walk through the Node.js version of the sample, but these concepts apply across all the runtime languages supported by our software development kits.
Like every intent handler, you’ll need a canHandle function:
const WhatCanIBuyHandler = {
canHandle(handlerInput) {
return handlerInput.requestEnvelope.request.type === 'IntentRequest' &&
handlerInput.requestEnvelope.request.intent.name === 'WhatCanIBuyIntent';
},
This one looks for an IntentRequest with an intent name of WhatCanIBuyIntent.
The handle function starts with setting up some variables:
handle(handlerInput) {
console.log('In WhatCanIBuy Handler');
let speakOutput;
let repromptOutput;
const locale = handlerInput.requestEnvelope.request.locale;
const ms = handlerInput.serviceClientFactory.getMonetizationServiceClient();
The monetization service client wraps the monetization service API. This API is the one you call to get details about your product catalog and to see if a customer has purchased a product or not. The locale value is required even though in-skill products are only supported in the en-US locale. Looking up the value from the request will allow your code to work when the range of supported locales is expanded.
This next part of the code requests the product catalog and then filters the products to only include the ones the customer can purchase. This skill uses one-time purchases and subscriptions (not consumables). A customer can buy a product if the product is “PURCHASABLE,” which means it is available in their locale and they have not already purchased it.
return ms.getInSkillProducts(locale).then(function fetchPurchasableProducts(result) {
const purchasableProducts = result.inSkillProducts.filter(record => record.entitled === 'NOT_ENTITLED' && record.purchasable === 'PURCHASABLE');
If there is at least one product available to purchase, the skill generates a list of purchasable products and share it with the customer. In this sample skill, there are at most four products the customer can purchase, including the subscription. This is a small enough list that it can be spoken in its entirety without overwhelming the customer. For your skill, you will need to adjust this delivery to align with how your product catalog is structured.
if (purchasableProducts.length > 0) {
speakOutput = `Products available for purchase at this time are ${getSpeakableListOfProducts(purchasableProducts)}` +
'. To learn more about a product, say \'Tell me more about\' followed by the product name. ' +
' If you are ready to buy say \'Buy\' followed by the product name. So what can I help you with?';
repromptOutput = 'I didn\'t catch that. What can I help you with?';
return handlerInput.responseBuilder
.speak(speakOutput)
.reprompt(repromptOutput)
.getResponse();
In the case that there are no products available for purchase, your skill should respond appropriately. As noted in the log message, the product list can be empty for a number of reasons. Remember, it was filtered to include only those products available and not already purchased:
// no products!
console.log('!!! ALERT !!! The product list came back as empty. This could be due to no ISPs being created and linked to the skill, the ISPs being created '
+ ' incorrectly, the locale not supporting ISPs, or the customer\'s account being from an unsupported marketplace.');
speakOutput = 'I\'ve checked high and low, however I can\'t find any products to offer to you right now. Sorry about that. '
+ 'I can\t guarantee it, but I might be able to find something later. Would you like a random fact now instead?';
repromptOutput = 'I didn\'t catch that. What can I help you with?';
return handlerInput.responseBuilder
.speak(speakOutput)
.reprompt(repromptOutput)
.getResponse();
You’ll note that the response keeps the interaction going with the customer. In your skill, the customer might ask this at any time and you should track what the customer was doing prior to asking, “What can I buy?” so that you can resume that activity.
If you want to use this sample code as the basis for your WhatCanIBuyHandler, be sure to copy the code from the sample skill and to also add the handler to the list of handlers used by your SkillBuilder. Here’s what that looks like in the premium facts sample skill:
.addRequestHandlers(
LaunchRequestHandler,
YesHandler,
NoHandler,
GetCategoryFactHandler,
BuyResponseHandler,
CancelResponseHandler,
WhatCanIBuyHandler,
ProductDetailHandler,
BuyHandler,
CancelSubscriptionHandler,
“What can I buy?” is something your customers can ask, but it’s only part of the overall in-skill purchasing experience. You’ll need to also support related utterances/intents including:
We’re excited to see what you will build with ISP. Tweet me @franklinlobb and I’d be happy to check it out!