[英]Alexa is giving feedback that you need to send account linking card
我正在提交Alexa技能及其提供的反馈,如果用户未链接,则需要返回帐户链接卡。 我正在使用此语法来给用户回复
context.succeed(
buildResponse({},
buildSpeechletResponse("Welcome to Deft , here you can control all your home appliances from your voice for example say turn on the bed room light and it will repsond accordingly",false)
)
)
功能是:
function buildSpeechletResponse(outputText, shouldEndSession) {
return {
outputSpeech: {
type: "PlainText",
text: outputText
},
// card: {
// type: "Simple",
// title: title,
// content: output
// },
// reprompt: {
// outputSpeech: {
// type: "PlainText",
// text: repromptText
// }
// },
shouldEndSession: shouldEndSession
};
}
function buildResponse(sessionAttributes, speechletResponse) {
return {
version: "1.0",
sessionAttributes: sessionAttributes,
response: speechletResponse
};
}
我必须将此作为输出来产生卡:
{
"version": "1.0",
"response": {
"outputSpeech": {"type":"PlainText","text":"Please go to your Alexa app and link your account."},
"card": {
"type": "LinkAccount"
}
}
}
需要帮助来创建一张卡片。
要检查用户是否具有帐户链接,可以使用event.session.user.accessToken == undefined
。 然后,您需要使用卡类型LinkAccount建立您的帐户链接响应。 您可以检查此细节。
function buildAccountLinkingResponse(outputText, shouldEndSession) {
return {
outputSpeech: {
type: "PlainText",
text: outputText
},
card: {
type: "LinkAccount",
},
reprompt: {
outputSpeech: {
type: "PlainText",
text: "TextHere"
}
},
shouldEndSession: shouldEndSession
};
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.