D.K.
D.K.

Reputation: 1375

Amazon Alexa Skills - Card in mobile app creation

I'm trying to make a Card in mobile application, which is attached to Amazon Account and current skill.

Is it enough just call EMIT function with 'tellWithCard'? Like in example:

that.emit(':tellWithCard', "Thank you for your visit", "Store Name", "Some description")

I tried all of this functions separately, but doesn't work for me:

that.emit(':tellWithCard', message, "Store Name", description)
that.emit(':tellWithLinkAccountCard', message, "Store Name", description)

that.emit(':askWithCard', message, "Store Name", description)
that.emit(':askWithLinkAccountCard', message, "Store Name", description) 

Is there any additional functions should be?

Upvotes: 1

Views: 471

Answers (1)

imTachu
imTachu

Reputation: 3809

Yes, that is all you need.

Here is an example: (Taken from the README of the original repo)

var cardTitle = 'Hello World Card';
var cardContent = 'This text will be displayed in the companion app card.';

var imageObj = {
    smallImageUrl: 'https://imgs.xkcd.com/comics/standards.png',
    largeImageUrl: 'https://imgs.xkcd.com/comics/standards.png'
};

this.emit(':tellWithCard', 'lalalala', cardTitle, cardContent, imageObj);

Do verify that from the Service Simulator you should get a response like this:

{
  "version": "1.0",
  "response": {
  "outputSpeech": {
    "type": "SSML",
    "ssml": "<speak> lalalala </speak>"
  },
  "card": {
    "text": "This text will be displayed in the companion app card.",
    "title": "Hello World Card",
    "image": {
      "smallImageUrl": "https://imgs.xkcd.com/comics/standards.png",
      "largeImageUrl": "https://imgs.xkcd.com/comics/standards.png"
    },
    "type": "Standard"
  },
  "shouldEndSession": true
  },
  "sessionAttributes": {}
}

But please keep in mind that testing from the Service Simulator won't create the actual card within the Alexa app. For this you need to use a device.

Upvotes: 1

Related Questions