AWS Alexa Skill Builder EssentialsCourse Navigation
Int roduct ionSection 1
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
St at e Managem entSection 4
Now Your Journey BeginsSection 5
Int roduct ionSection 1
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
St at e Managem entSection 4
Now Your Journey BeginsSection 5
Introduction
Back t o Main
Course Navigation
Course Introduction
Get t ing St ar t ed
About the Author
Get t ing St ar t ed
Get t ing St ar t ed
Dear St udent s. Welcome to the Linux Academy AWS Alexa Sk il l Builder Essent ials course. This course provides the necessary knowledge for building new Alexa skills.
In this course, you will learn:- What the in t eract ion m odel is and its purpose- How to add and design custom in t ent s- How to add custom slot s to intents- How to set up a dialog direct ive and use ent it y resolut ion- What at t r ibut es are and how to use them to store
information until it is needed
By the end, you will be able to design simple Alexa skills and have the foundation to continue learning more advanced topics.
Thank you for taking the course ? let 's get started!
Lar ry Fr it t s
Int roduct ionSection 1
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
St at e Managem entSection 4
Now Your Journey BeginsSection 5
Introduction
Back t o Main
Course Navigation
Course Introduction
Get t ing St ar t ed
About the Author
Course Int roduct ion
Course Int roduct ion
Int ent / Utterance
Skill Code
JSON JSON
Audio Audio
Alexa
Ar t if icial IntelligenceMachine Learning
Natural Language Processing
Spoken Response
Core Concepts
Back t o Main
Int roduct ionSection 1
Course Navigation
Interaction Model and Intents
Alexa Sk il l Com ponent s
User Utterances and Natural Language Processing
Intent Triggered Lambda Functions
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
Alexa Skills Kit Command Line Interface (AWS-CLI)
Capt ur ing Dat a f rom User Ut t erances
Custom Intents
Custom Slots
Alexa Sk il l Com ponent s
Alexa Sk il l Com ponent s
Select the items below to see Alexa skill components:
Next
Int eract ion Model and Int ent s
User Ut t erances and Nat ural Language Processing
Int ent Tr iggered Lam bda Funct ions
Alexa Sk il ls Kit Com m and Line Int er face (AWS-CLI)
Core Concepts
Back t o Main
Int roduct ionSection 1
Course Navigation
Interaction Model and Intents
Alexa Sk il l Com ponent s
User Utterances and Natural Language Processing
Intent Triggered Lambda Functions
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
Alexa Skills Kit Command Line Interface (AWS-CLI)
Capt ur ing Dat a f rom User Ut t erances
Custom Intents
Custom Slots
Int eract ion Model and Int ent s
Int eract ion Model and Int ent s
int eract ionModel
The in t eract ionModel is the container for models. The container holds the intents, slots, types, and anyt hing else needed t o def ine t he sk il l 's m odel.
. . / model s/ en- US. j son
{
" i nt er act i onModel " : { " l anguageModel " : { " i nvocat i onName" : " l i nux academy l ab" , " i nt ent s" : [ { " name" : " AMAZON. Cancel I nt ent " , " sampl es" : [ ] } , { " name" : " AMAZON. Hel pI nt ent " , " sampl es" : [ ] } , { " name" : " AMAZON. St opI nt ent " , " sampl es" : [ ] } , { " name" : " Hel l oWor l dI nt ent " , " sampl es" : [ " hel l o" ] } ] } }}
Core Concepts
Back t o Main
Int roduct ionSection 1
Course Navigation
Interaction Model and Intents
Alexa Sk il l Com ponent s
User Utterances and Natural Language Processing
Intent Triggered Lambda Functions
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
Alexa Skills Kit Command Line Interface (AWS-CLI)
Capt ur ing Dat a f rom User Ut t erances
Custom Intents
Custom Slots
User Ut t erances and Nat ural Language Processing
User Ut t erances and Nat ural Language Processing
There are many pre-built models for Alexa skills. These have the advantage of not requir ing an invocat ion nam e.
Invocat ion Nam e: This is name given to a custom skill. It should be easy to remember for users. For example, for a cust om -built sk il l t hat cont rols your sm ar t bed, a good invocation name might be "smart bed." A name like "sleeping apparatus" may not be as good. Invocation names must be at least two words.
"Alexa, ask sm ar t bed t o increase t he t em perat ure t o 72 and raise t he head by 20 degrees."
"Alexa, ask sleeping apparat us t o..."
This name is not a natural way of naming the bed and may make it difficult for users to remember.
On the other hand, if there was a built-in skill that could be used to automate the smart bed, then the Alexa skill is even easier.
"Alexa, raise t he head of t he bed 20 degrees."
Built -In and Cust om Alexa Sk il ls
An Alexa Sk il l Voice Com m and:
"Alexa, ask l ight m anager t o t urn on t he k it chen l ight s every day at 6 am ."
Wake Word: "Alexa"Com m and: "ask" (these are reserved words)Invocat ion Nam e: "light manager " (not always necessary see below)Int ent : "turn on the kitchen lights"Slot s: "every day at 6 am" (not always required)
Core Concepts
Back t o Main
Int roduct ionSection 1
Course Navigation
Interaction Model and Intents
Alexa Sk il l Com ponent s
User Utterances and Natural Language Processing
Intent Triggered Lambda Functions
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
Alexa Skills Kit Command Line Interface (AWS-CLI)
Capt ur ing Dat a f rom User Ut t erances
Custom Intents
Custom Slots
Int ent Tr iggered Lam bda Funct ions
Int ent Tr iggered Lam bda Funct ions
Lam bda Funct ion Int ent Handler
Lambda functions are the workhorse of the Alexa skill. They determine what response to return to the user 's intent request.
. . / l ambda/ cust om/ i ndex. j s
const Wel comeI nt ent Handl er = {
canHandl e( handl er I nput ) {
r et ur n handl er I nput . r equest Envel ope. r equest . t ype ===
' I nt ent Request ' &&
handl er I nput . r equest Envel ope. r equest . i nt ent . name ===
' Wel comeI nt ent ' ;
} ,
handl e( handl er I nput ) {
const speechText = " Let ' s get l ear ni ng! " ;
r et ur n handl er I nput . r esponseBui l der
. speak( speechText )
. wi t hSi mpl eCar d( ' Hur r y Back! ' , speechText )
. get Response( ) ;
} ,
} ;
Core Concepts
Back t o Main
Int roduct ionSection 1
Course Navigation
Interaction Model and Intents
Alexa Sk il l Com ponent s
User Utterances and Natural Language Processing
Intent Triggered Lambda Functions
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
Alexa Skills Kit Command Line Interface (AWS-CLI)
Capt ur ing Dat a f rom User Ut t erances
Custom Intents
Custom Slots
Alexa Sk il ls Kit Com m and Line Int er face (AWS-CLI)
Alexa Sk il ls Kit Com m and Line Int er face (AWS-CLI)
ASK CLI allows you to create, deploy, and publish an Alexa skill from the command line.
Prerequisit es- AWS developer account- AWS account with an IAM user- Node- Git
Inst allat ionOn a Windows machine, first run:npm inst all -g --product ion w indows-build-t ools
To install ASK on all machines:npm inst all -g ask-cli
Com m on ASK Com m ands- ask new
Creates a skill from a Git repo template or a built-in template
- ask cloneClones a skill from an "in development" skill in the developer console
- ask deployDeploys the skill
- ask dialogAllows the developer to simulate a session with the skill using written language
- ask sim ulat eAllows the developer to simulate a session with the skill returning JSON objects
Core Concepts
Back t o Main
Int roduct ionSection 1
Course Navigation
Interaction Model and Intents
Alexa Sk il l Com ponent s
User Utterances and Natural Language Processing
Intent Triggered Lambda Functions
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
Alexa Skills Kit Command Line Interface (AWS-CLI)
Capt ur ing Dat a f rom User Ut t erances
Custom Intents
Custom Slots
Capt ur ing Dat a f rom User Ut t erances
Capt ur ing Dat a f rom User Ut t erances
Select the items below to see capturing data from user utterances:
Next
Cust om Slot s
Im proving t he User Exper ience
Core Concepts
Back t o Main
Int roduct ionSection 1
Course Navigation
Interaction Model and Intents
Alexa Sk il l Com ponent s
User Utterances and Natural Language Processing
Intent Triggered Lambda Functions
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
Alexa Skills Kit Command Line Interface (AWS-CLI)
Capt ur ing Dat a f rom User Ut t erances
Custom Intents
Custom Slots
Cust om Int ent s
Cust om Int ent s
. . / model s/ en- US. j son
{ . . . " i nt ent s" : [ / / r equi r ed { " name" : " AMAZON. Cancel I nt ent " , " sampl es" : [ ] } , / / r equi r ed { " name" : " AMAZON. Hel pI nt ent " , " sampl es" : [ ] } , / / r equi r ed { " name" : " AMAZON. St opI nt ent " , " sampl es" : [ ] } , { " name" : " Sampl eI nt ent " , " sampl es" : [ " sampl e" , " a smapl e" , " one sampl e"
] } , . . .}
Back
Core Concepts
Back t o Main
Int roduct ionSection 1
Course Navigation
Interaction Model and Intents
Alexa Sk il l Com ponent s
User Utterances and Natural Language Processing
Intent Triggered Lambda Functions
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
Alexa Skills Kit Command Line Interface (AWS-CLI)
Capt ur ing Dat a f rom User Ut t erances
Custom Intents
Custom Slots
Cust om Slot s
Cust om Slot s
Cust om Types
Custom types are defined by the skill builder and must be defined in the in t eract ionModel. For a custom type, the skill builder must define the values.
. . . " s l ot s" : [ { " name" : " ani mal " , " t ype" " ANI MAL_TYPE" } ] , " sampl es" : [ " { ani mal } " ]. . . , " t ypes" : [ { " name" : " ANI MAL_TYPE" , " val ues" : [ { " name" : { " val ue" : " ani mal " } } ] } ]. . .
Back
Core Concepts
Back t o Main
Int roduct ionSection 1
Course Navigation
Interaction Model and Intents
Alexa Sk il l Com ponent s
User Utterances and Natural Language Processing
Intent Triggered Lambda Functions
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
Alexa Skills Kit Command Line Interface (AWS-CLI)
Capt ur ing Dat a f rom User Ut t erances
Custom Intents
Custom Slots
Cust om Int ent s
Cust om Int ent s
. . / model s/ en- US. j son
{ . . . " i nt ent s" : [ / / r equi r ed { " name" : " AMAZON. Cancel I nt ent " , " sampl es" : [ ] } , / / r equi r ed { " name" : " AMAZON. Hel pI nt ent " , " sampl es" : [ ] } , / / r equi r ed { " name" : " AMAZON. St opI nt ent " , " sampl es" : [ ] } , { " name" : " Sampl eI nt ent " , " sampl es" : [ " sampl e" , " a smapl e" , " one sampl e"
] } , . . .}
Back
Core Concepts
Back t o Main
Int roduct ionSection 1
Course Navigation
Interaction Model and Intents
Alexa Sk il l Com ponent s
User Utterances and Natural Language Processing
Intent Triggered Lambda Functions
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
Alexa Skills Kit Command Line Interface (AWS-CLI)
Capt ur ing Dat a f rom User Ut t erances
Custom Intents
Custom Slots
Cust om Slot s
Cust om Slot s
Cust om Types
Custom types are defined by the skill builder and must be defined in the in t eract ionModel. For a custom type, the skill builder must define the values.
. . . " s l ot s" : [ { " name" : " ani mal " , " t ype" " ANI MAL_TYPE" } ] , " sampl es" : [ " { ani mal } " ]. . . , " t ypes" : [ { " name" : " ANI MAL_TYPE" , " val ues" : [ { " name" : { " val ue" : " ani mal " } } ] } ]. . .
Back
Improving the User Experience
Back t o Main
Int roduct ionSection 1
Course Navigation
SKill Sessions and Multi-turn Conversations
Dialogs
Dialog Directive and Entity Resolution
Mult im odal Int er faces
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
St at e Managem entSection 4
Using Cards to Display Information
Dialogs
Dialogs
Select the items below to see dialogs:
Next
SKil l Sessions and Mult i-t urn Conversat ions
Dialog Direct ive and Ent it y Resolut ion
Improving the User Experience
Back t o Main
Int roduct ionSection 1
Course Navigation
SKill Sessions and Multi-turn Conversations
Dialogs
Dialog Directive and Entity Resolution
Mult im odal Int er faces
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
St at e Managem entSection 4
Using Cards to Display Information
SKill Sessions and Mult i-t urn Conversat ions
SKill Sessions and Mult i-t urn Conversat ions
Building a Mult i-Turn Conversat ionMulti-turn conversation skills can be used for many things, including a quiz skill where Alexa waits for the user to respond.
There are three ways to accomplish this.
DialogReprom pt
Improving the User Experience
Back t o Main
Int roduct ionSection 1
Course Navigation
SKill Sessions and Multi-turn Conversations
Dialogs
Dialog Directive and Entity Resolution
Mult im odal Int er faces
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
St at e Managem entSection 4
Using Cards to Display Information
SKill Sessions and Mult i-t urn Conversat ions
SKill Sessions and Mult i-t urn Conversat ions
Building a Mult i-Turn Conversat ionMulti-turn conversation skills can be used for many things, including a quiz skill where Alexa waits for the user to respond.
There are three ways to accomplish this.
DialogReprom pt
reprom pt (t ext )
Using reprom pt in your response will automatically set the shouldEndSession to false. By telling the responseBuilder that there is a reprompt, you notify the skill that it should wait for a user response and thus the session is held open.
The session will be held open for eight seconds in this instance. If no response is received, the test given to reprom pt is spoken by Alexa and the session is held open another eight seconds.
If no user input is received, the session closes.
Exampl e of r epr ompt
r et ur n handl er I nput . r esponseBui l der
. speak( t ext ) . r epr ompt ( r epr ompt _t ext ) . get Response( ) ;
Improving the User Experience
Back t o Main
Int roduct ionSection 1
Course Navigation
SKill Sessions and Multi-turn Conversations
Dialogs
Dialog Directive and Entity Resolution
Mult im odal Int er faces
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
St at e Managem entSection 4
Using Cards to Display Information
Dialog Direct ive and Ent it y Resolut ion
Dialog Direct ive and Ent it y Resolut ion, Par t 1
Dialog
Adding a dialog directive to your skill allows for a m ore nat urally f low ing conversat ion st yle that can be used to fill slots for an Alexa skill.
The dialog model identifies slots that are required, the prompts Alexa uses to get the slot values, confirmation by the user if necessary, conf irm at ion of t he whole int ent if necessary, and can validate the slot value and reprompt for the slot value if it does not pass validation.
The sk il l builder can delegate the dialog to Alexa to control, control the dialog via code, or a combination of the two.
When Alexa is delegated the control, all the slots are filled, the entire intent is sent for processing, and the skill builder can focus on t he logic of t he processing of t he slot s.
Improving the User Experience
Back t o Main
Int roduct ionSection 1
Course Navigation
SKill Sessions and Multi-turn Conversations
Dialogs
Dialog Directive and Entity Resolution
Mult im odal Int er faces
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
St at e Managem entSection 4
Using Cards to Display Information
Mult im odal Int er faces
Mult im odal Int er faces
Select the items below to see multimodal interfaces:
Next
Using Cards t o Display Inform at ion
Improving the User Experience
Back t o Main
Int roduct ionSection 1
Course Navigation
SKill Sessions and Multi-turn Conversations
Dialogs
Dialog Directive and Entity Resolution
Mult im odal Int er faces
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
St at e Managem entSection 4
Using Cards to Display Information
Using Cards t o Display Inform at ion
Using Cards t o Display Inform at ion
The Alexa Sk il ls Kit provides dif ferent t ypes of cards:
- A Simple card displays plain text. You provide text for the card t it le and content.
- A Standard card also displays plain text but can include an image. You provide the text for the t it le and content, and the URL for the image to display.
- A LinkAccount card is a special card type only used with account linking. This card lets users start the account linking process.
- An AskForPermissionsConsent card is sent to the Alexa app when a skill requires the customer to grant specific permissions.
an exampl e of a Si mpl e car d
r et ur n handl er I nput . r esponseBui l der
. speak(
" Thi s i s t he t ext Al exa speaks.
Go t o t he Al exa app t o see t he
car d! "
)
. wi t hSi mpl eCar d(
" Thi s i s t he Ti t l e of t he Car d" ,
" Thi s i s t he car d cont ent . Thi s
car d j ust has pl ai n t ext
cont ent . \ r \ nThe cont ent i s
f or mat t ed wi t h l i ne br eaks t o
i mpr ove r eadabi l i t y . "
)
. get Response( ) ;
State Management
Back t o Main
Int roduct ionSection 1
Course Navigation
Request, Session and Persistent Attribute Scope
At t r ibut es
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
St at e Managem entSection 4
Now Your Journey BeginsSection 5
At t r ibut es
At t r ibut es
Select the items below to see attributes:
Next
Request , Session and Persist ent At t r ibut e Scope
State Management
Back t o Main
Int roduct ionSection 1
Course Navigation
Request, Session and Persistent Attribute Scope
At t r ibut es
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
St at e Managem entSection 4
Now Your Journey BeginsSection 5
Request , Session and Persist ent At t r ibut e Scope
Request , Session and Persist ent At t r ibut e Scope
At t r ibut es
Attributes can be used to store data as a key-value pair. A key-value pair al lows you t o nam e a value. For example, you might have a list of dog names. In a paper list, it might look like this:
Dog nam es:Male: Fem ale:
Dexter AliceAlfred NancySpot ZoeyFred
You could ask, what is the t h ird nam e in the male dog names list? Spot.
In JavaScript, this list might look more like this:
var dogNames = { " mal e" : [ " Dext er " , " Al f r ed" , " Spot " , " Fr ed" ] , " f emal e" : [ " Al i ce" , " Nancy" , " Zoey" ]}
In this case, the keys would be m ale and fem ale. They must be strings. But their values are arrays.
To access the name Spot from the attribute dogNam es:
dogNam es.m ale[2] <? Note that array indexes start at 0
Next
State Management
Back t o Main
Int roduct ionSection 1
Course Navigation
Request, Session and Persistent Attribute Scope
At t r ibut es
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
St at e Managem entSection 4
Now Your Journey BeginsSection 5
Request , Session and Persist ent At t r ibut e Scope
Request , Session and Persist ent At t r ibut e Scope
Alexa At t r ibut e Types
Show Types
Persist ent :Persistent attributes are attributes that are stored between sessions. These attributes can be recalled on a per-user basis when the user returns to the skill.
Met hods:get Persist ent At t r ibut es()set Persist ent At t r ibut es()savePersist ent At t r ibut es()delet ePersist ent At t r ibut es()
Session:These attributes are available until the session ends. Once the session is over, they no longer exist.
Met hods:get SessionAt t r ibut es()set SessionAt t r ibut es()
Request :These attributes are only available inside of the request cycle. Once the request cycles have ended, the attributes no longer exist.
Met hods:get Request At t r ibut es()set Request At t r ibut es()
Now Your Journey Begins
Back t o Main
Int roduct ionSection 1
Course Navigation
Review
Where To Go From Here
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
St at e Managem entSection 4
Now Your Journey BeginsSection 5
Review
Review
Select the items below to review:
Next
Where To Go From Here
Now Your Journey Begins
Back t o Main
Int roduct ionSection 1
Course Navigation
Review
Where To Go From Here
Core Concept sSection 2
Im proving t he User Exper ience
Section 3
St at e Managem entSection 4
Now Your Journey BeginsSection 5
Where To Go From Here
Where To Go From Here
Linux Academ y Courses t hat w il l help you cont inue t o develop bet t er Alexa sk il ls:
Review
Now Your Journey Begins
AWS Certified Solutions Architect - Associate Level
Amazon DynamoDB Deep Dive
Lambda Deep Dive
Managing Data in S3 with Versioning and Lifecycle Rules
Testing and Debugging Lambda Functions
Top Related