Managing Attributes in Alexa Skill Kit

In this article, we will learn about the Alexa Skill Kit. The Alexa Skills Kit is a software development kit (SDK) that enables a developer to build skills.

Introduction

 
The Alexa Skills Kit is a software development kit (SDK) that enables a developer to build skills. It is available on the Amazon Alexa artificial intelligence assistant. Alexa Skills Kit is comprised of tools and application program interfaces (APIs).
 

Managing Attributes in Alexa Skill Kit

 

Session Attribute 

 
Session Attributes exist throughout the lifespan of the current session of skill. These attributes get discarded, once the session gets closed/ expired. Any attribute set in the request processing life cycle will be set to Alexa service and will be available in the next request within the same session. Session attributes do not rewire any external storage solution i.e. these attributes are not available for use of any out of session request.
 

Request attributes 

 
Request attributes are useful with request and response interceptors like you can inject additional data or helper classes into request attributes with the help of request interceptors so that they can be retrieved by request handlers.
 

Persistence Attribute 

 
These are the attributes that persist beyond the life cycle of the existing session. These are dependent on persistence adaptor. You need to configure the adaptor to manage the persistence attribute. If you will not configure the adaptor AttributesManager will through exception for PersistanceAdaptor configuration. 
 

PersistenceAdaptor

 
It is used for saving and fetching attributes to the database or local file system i.e. persistence layer. You can user PersistenceAdapter Interface which has below methods:
  • getAttributes(RequestEnvelope requestEnvelope)
  • saveAttributes( RequestEnvelope requestEnvelope, {[key : string] requestEnvelope })
  • deleteAttributes( RequestEnvelope requestEnvelope)
This Adaptor can be used for DynamoDB and s3 Bucket, below are the adaptor as described below.
 

DynamoDbPersistenceAdapter

 
It implements PersistenceApdaptor for saving and fetching Persistence attributes.
 

S3PersistenceAdapter 

 
It implements PersistenceApdaptor for saving and fetching Persistence attributes. 
 

Summary 

 
In this article, we learned about Alexa Skill Kit and all the attributes of the Alexa Skill Kit (SDK).