我正在使用适用于 Node.js V2的AWS ASK 开发工具包来构建 Alexa 技能,我想知道是否可以以编程方式为“意图确认”生成或更新“Alexa 提示”。
挑战在于我们正在搜索价格,目标是在询问价格之前将价格注入“意图确认”消息中。
我想尝试“重新提示”用户,并在我定价后强制重新提示,但这感觉很脏:
module.exports = {
canHandle(handlerInput) {
return (
handlerInput.requestEnvelope.request.type === 'IntentRequest' &&
handlerInput.requestEnvelope.request.intent.name ===
'HelloWorldIntent'
);
},
async handle(handlerInput) {
let speechText;
let repromptText;
//perform web request to get price
//then dynamically update the intent confirmation response prompt to include price,
//before asking intent confirmation prompt?
return handlerInput.responseBuilder
.speak(speechText)
.getResponse();
}
}Run Code Online (Sandbox Code Playgroud)
至少可以说缺乏文档。
javascript amazon-web-services alexa alexa-skill alexa-skills-kit