Learn more about how to build Alexa Skills with visual output using the Jovo Framework.
Visual output is used to describe or enhance the voice interaction. This ranges from simple cards, Echo Show and Echo Spot Display Templates to displaying a video.
Cards are used for the most basic cases of visual output. They can be used to display plain text and images or to ask for certain permissions (Account Linking, to-do/shopping lists, etc.) in addition to the speech output.
this.$alexaSkill.showStandardCard('Hello World', 'This is a standard card');
this.tell('I added a card to the response!');
The simple card can only contain plain text, which is split up into a title and content.
this.$alexaSkill.showSimpleCard('Title', 'Content');
// or
this.$alexaSkill.showCard(
new AlexaSkill.SimpleCard()
.setTitle('Title')
.setContent('Content')
);
The standard card allows you to add an image in addition to the plain text, which has to be provided in two different sizes.
this.$alexaSkill.showStandardCard('Title', 'Content', {
smallImageUrl: 'https://via.placeholder.com/720x480',
largeImageUrl: 'https://via.placeholder.com/1200x800',
});
// or
this.$alexaSkill.showCard(
new AlexaSkill.StandardCard()
.setTitle('Title')
.setText('Text')
.setSmallImageUrl('https://via.placeholder.com/720x480')
.setLargeImageUrl('https://via.placeholder.com/1200x800')
);
Display Templates can be used to include content on the screen of the Echo Show or Spot. There is a variety of templates, each having a different composition and features. You can find the official Amazon reference here.
To be able to use display templates for devices like Echo Show, you need to enable them in the Interfaces tab in the Amazon Developer Console:
Body templates are only capable of displaying images and text. There are multiple body templates, each having a different composition.
let bodyTemplate1 = this.$alexaSkill.templateBuilder('BodyTemplate1');
bodyTemplate1.setToken('token')
.setTitle('Title')
.setTextContent('Primary Text', 'Secondary Test', 'Tertiary Text');
this.$alexaSkill.showDisplayTemplate(bodyTemplate1);
let bodyTemplate2 = this.$alexaSkill.templateBuilder('BodyTemplate2');
bodyTemplate2.setToken('token')
.setTitle('Title')
.setTextContent('Primary Text', 'Secondary Test', 'Tertiary Text')
.setRightImage({
description: 'Description',
url: 'https://via.placeholder.com/350x150',
});
this.$alexaSkill.showDisplayTemplate(bodyTemplate2);
let bodyTemplate3 = this.$alexaSkill.templateBuilder('BodyTemplate3');
bodyTemplate3.setToken('token')
.setTitle('Title')
.setTextContent('Primary Text', 'Secondary Text', 'Tertiary Text')
.setLeftImage({
description: 'Description',
url: 'https://via.placeholder.com/350x150',
});
this.$alexaSkill.showDisplayTemplate(bodyTemplate3);
let bodyTemplate6 = this.$alexaSkill.templateBuilder('BodyTemplate6');
bodyTemplate6.setToken('token')
.setTextContent('Primary Text', 'Secondary Text', 'Tertiary Text')
.setFullScreenImage({
description: 'Description',
url: 'https://via.placeholder.com/1200x1000',
});
this.$alexaSkill.showDisplayTemplate(bodyTemplate6);
The list template is used to display a set of scrollabe and selectable items (text and images).
let listTemplate1 = this.$alexaSkill.templateBuilder('ListTemplate1');
listTemplate1.setTitle('Title')
.setToken('token')
.addItem(
'token',
{
description: 'Description',
url: 'https://via.placeholder.com/1200x1000',
},
'primary text',
'secondary text',
'tertiary text'
).addItem(
'token',
null,
'primary text',
'secondary text',
'tertiary text'
);
this.$alexaSkill.showDisplayTemplate(listTemplate1);
let listTemplate2 = this.$alexaSkill.templateBuilder('ListTemplate2');
listTemplate2.setTitle('Title')
.setToken('token')
.addItem(
'token',
{
description: 'Description',
url: 'https://via.placeholder.com/1200x1000',
},
'primary text',
'secondary text',
'tertiary text'
).addItem(
'token',
null,
'primary text',
'secondary text',
'tertiary text'
);
this.$alexaSkill.showDisplayTemplate(listTemplate2);
To launch videos on an Echo Show you can use the VideoApp
interface:
this.$alexaSkill.showVideo('https://www.url.to/video.mp4', 'Any Title', 'Any Subtitle');
You can also optionally add a preamble message that Alexa will read before the video plays:
this.$alexaSkill.showVideo('https://www.url.to/video.mp4', 'Any Title', 'Any Subtitle', 'Get ready to watch your video!');
Find the official Amazon reference here.