简体   繁体   中英

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 . 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 . Then you need to build your account linking response with card type 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
   };

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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