How to Use Alexa Presentation Language with Cognigy out of the box

Topic: 
|
2 min read
Media contact: Cognigy November 14, 2018

Amazon recently introduced APL (Alexa Presentation Language). APL enables developers to build interactive and multimodal Skills that support screens. Thanks to the generic Alexa directive support built in to Cognigy, you can already leverage this new capability.

All you need to do is:

  1. Activate the Alexa Presentation Language interface.

  2. Create visuals for your Alexa Skill.

  3. Add the APL RenderDocument Skill directive to your conversational responses.

alexa_interfaces

Enabled APL Interface in the Alexa developer console

 

To activate this feature, go to the Alexa developer console, select your Skill and enable the Alexa Presentation Language in the Interfaces section.

apl_authoring

Amazon’s APL authoring tool

 

Next, create the visuals using APL. APL is a JSON-language (JavaScript Object Notation) and can be written manually as described in the specificationsIt is easier and less error-prone to start with the APL Authoring Tool provided by Amazon.

There you can create visuals (using a sample template or starting from scratch), export the final document, and copy its “document” and “datasources” properties for your Alexa response. The JSON structure for the APL RenderDocument Skill directive also requires a type and a custom token. 

The JSON looks roughly like this:                 

 

{

"type": "Alexa.Presentation.APL.RenderDocument",

"token": "anydocument",

"document": {



},

"datasources": {



}

}

 

cognigy

Alexa directive in a Cognigy Say Node

 

The last step is to create a Say-Node in Cognigy, select the Alexa tab, and add the JSON document as a new directive.

You also can send APL commands to already-rendered APL documents using the Alexa.Presentation.APL.ExecuteCommands directiveTo improve this further, you can distinguish between devices with and without APL support by checking for the Alexa.Presentation.APL property in your conversation flow (ci.data.context.System.device.supportedInterfaces).

You can also handle user events which are sent to your Skill.  To do this, check the Alexa.Presentation.APL.UserEvent request type which can be found under ci.data.request.type.

REQUEST A DEMO

Start Now

See our Alexa quick start video and start your Alexa Skill now using  the free Community Edition. We can't wait to see what you will build. 

Sascha Wolter

Written by Sascha Wolter

Sascha Wolter is a professional developer and user experience enthusiast. His true passion is to improve the human-computer interaction:

He loves to build conversational and multimodal experiences with text (chatbots) and voice (aka Alexa) and, as such, he works as Senior UX Consultant and Principal Technology Evangelist at Cognigy.

image119-1
image119-1
image119-1