简体   繁体   English

Alexa提供了您需要发送帐户链接卡的反馈

[英]Alexa is giving feedback that you need to send account linking card

I am submitting a Alexa Skill and its giving feedback that you need to return a account linking card in case user is not linked . 我正在提交Alexa技能及其提供的反馈,如果用户未链接,则需要返回帐户链接卡。 I am using this Syntax to give the user response 我正在使用此语法来给用户回复

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)
                                              )
                                            )

Functions are : 功能是:

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
    };


}

I have to give this as output to produce a card: 我必须将此作为输出来产生卡:

{
  "version": "1.0",
  "response": {
    "outputSpeech": {"type":"PlainText","text":"Please go to your Alexa app and link your account."},
    "card": {
      "type": "LinkAccount"
    }
  }
}

Want help to create a card out of this . 需要帮助来创建一张卡片。

To check user whether has account linking you may use event.session.user.accessToken == undefined . 要检查用户是否具有帐户链接,可以使用event.session.user.accessToken == undefined Then you need to build your account linking response with card type LinkAccount. 然后,您需要使用卡类型LinkAccount建立您的帐户链接响应。 You can check this for detail. 您可以检查细节。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM