Module

Amazon.Alexa.Types

Package
purescript-alexa
Repository
twitchard/purescript-alexa

#AlexaRequest Source

data AlexaRequest

An AlexaRequest represents the JSON body provided by Alexa when invoking your skill.

If the user invokes your skill simply by naming it ("Alexa, open <YOUR SKILL> "), without providing further instructions, then Amazon will issue a LaunchRequest.

If the user invokes your skill providing specific instructions ("Alexa, ask <YOUR SKILL> to <DO SOMETHING>"), or if the user has already entered into your skill and responds to a prompt, then Amazon will determine the most likely "intent" of those defined by your skill's "language model" and issue an appropriate IntentRequest to your skill.

If your skill is prompting the user for a response, and the user does not respond within 8 seconds after the prompt (or the "reprompt", if one was specified), or if the user says "exit", then Amazon will issue a "SessionEnded" request. Unlike to LaunchRequests and IntentRequests, you cannot reply to a SessionEnded request and have speech delivered or a card displayed to the user. Your reply will be ignored by Alexa. The purpose of the SessionEnded response is to give you a chance to do any processing or clean-up, now that the session is over.

Constructors

Instances

#AlexaLaunchRequest Source

type AlexaLaunchRequest = { locale :: String, requestId :: String, timestamp :: String }

#AlexaIntentRequest Source

type AlexaIntentRequest = { dialogState :: Maybe String, intent :: AlexaIntent, locale :: String, requestId :: String, timestamp :: String }

#AlexaSessionEndedRequest Source

type AlexaSessionEndedRequest = { error :: Maybe AlexaError, locale :: String, reason :: String, requestId :: String, timestamp :: String }

#AlexaSession Source

type AlexaSession = { application :: AlexaApplication, attributes :: Foreign, new :: Boolean, sessionId :: String, user :: AlexaUser }

#AlexaContext Source

#AlexaIntent Source

type AlexaIntent = { confirmationStatus :: Maybe String, name :: String, slots :: Foreign }

#AlexaError Source

type AlexaError = { message :: String, type :: String }

#AlexaApplication Source

#AlexaUser Source

type AlexaUser = { accessToken :: Maybe String, userId :: String }

#AlexaResponse Source

type AlexaResponse a = { response :: { card :: Maybe Card, outputSpeech :: Maybe Speech, reprompt :: Maybe { outputSpeech :: Speech }, shouldEndSession :: Boolean }, sessionAttributes :: a, version :: String }

An AlexaResponse represents the JSON object you must provide to Amazon in response to an AlexaRequest to have Alexa deliver speech to the user, or display a "card" to the user. You may also set "shouldEndSession" to false in order to prompt the user for a response after your reply is delivered. In this case, you will receive an IntentRequest when the user replies to your prompt (or a SessionEndedRequest if the user does not reply) and whatever value you provide for 'sessionAttributes' will be placed onto the 'session.attributes' property of that AlexaRequest.

#readBuiltInIntent Source

readBuiltInIntent :: String -> Maybe BuiltInIntent

This function translates reads a built-in intent by its name.