我正在实现isp,我发现我的加售消息在日志中不起作用,它显示了未定义的加售消息。 这是我尝试过的一段代码:
const HintIntentHandler = {
canHandle(handlerInput) {
return handlerInput.requestEnvelope.request.type === 'IntentRequest'
&& handlerInput.requestEnvelope.request.intent.name === 'HintIntent';
},
handle(handlerInput) {
const locale = handlerInput.requestEnvelope.request.locale;
const ms = handlerInput.serviceClientFactory.getMonetizationServiceClient();
// Determine if the customer has purchased the hint_pack
return ms.getInSkillProducts(locale).then(function(res) {
var product = res.inSkillProducts.filter(record => record.referenceName === 'hint_pack');
if (isEntitled(product)) {
return handlerInput.responseBuilder
.speak(speechText)
.reprompt(sessionAttributes.currentRiddle.question)
.withSimpleCard('Level Up Riddles', speechText)
.getResponse();
} else {
const upsellMessage = "You don't currently own the hint pack. Want to learn more about it?";
return handlerInput.responseBuilder
.addDirective({
'type': 'Connections.SendRequest',
'name': 'Upsell',
'payload': {
'InSkillProduct': {
'productId': product[0].productId
},
'upsellMessage': upsellMessage
},
'token': 'correlationToken'
})
.getResponse();
}
});
}
};
,并且我将自动委派用于其他目的。 这是错误
"name": "Upsell",
"payload": {
"purchaseResult": "ERROR",
"productId": "amzn1.adg.product.214ce17e-f466-4b08-9afa-215954c297ac",
"message": "Upsell was not presented."
},
"token": "correlationToken"