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