[英]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.