The voxaEvent Object¶
-
class
VoxaEvent(event, context)¶ The
voxaEventobject contains all the information from the Voxa event, it’s an object kept for the entire lifecycle of the state machine transitions and as such is a perfect place for middleware to put information that should be available on every request.-
VoxaEvent.rawEvent¶ A plain javascript copy of the request object as received from the platform
-
VoxaEvent.executionContext¶ On AWS Lambda this object contains the context
-
VoxaEvent.t¶ The current translation function from i18next, initialized to the language of the current request
-
VoxaEvent.renderer¶ The renderer object used in the current request
-
VoxaEvent.platform¶ The currently running Voxa Platform
-
VoxaEvent.model¶ The default middleware instantiates a
Modeland makes it available throughvoxaEvent.model
-
VoxaEvent.intent.params¶ In Alexa the voxaEvent object makes
intent.slotsavailable throughintent.paramsafter aplying a simple transformation so{ "slots": [{ "name": "Dish", "value": "Fried Chicken" }] }
becomes:
{ "Dish": "Fried Chicken" }
in other platforms it does it’s best to make the intent params for each platform also available on
intent.params
-
VoxaEvent.user¶ An object that contains the userId and accessToken if available
{ "userId": "The platform specific userId", "id": "same as userId", "accessToken": "available if user has done account linking" }
-
VoxaEvent.model An instance of the Voxa App Model.
-
VoxaEvent.log¶ An instance of lambda-log
-
VoxaEvent.supportedInterfaces()¶ Array of supported interfaces
Returns Array: A string array of the platform’s supported interfaces
-
VoxaEvent.getUserInformation()¶ Object with user personal information from the platform being used.
{ // Google specific fields "sub": 1234567890, // The unique ID of the user's Google Account "iss": "https://accounts.google.com", // The token's issuer "aud": "123-abc.apps.googleusercontent.com", // Client ID assigned to your Actions project "iat": 233366400, // Unix timestamp of the token's creation time "exp": 233370000, // Unix timestamp of the token's expiration time "emailVerified": true, "givenName": "John", "familyName": "Doe", "locale": "en_US", // Alexa specific fields "zipCode": "98101", "userId": "amzn1.account.K2LI23KL2LK2", // Platforms common fields "email": "johndoe@gmail.com", "name": "John Doe" }
Returns object: A object with user’s information
-
VoxaEvent.getUserInformationWithGoogle()¶ Object with user personal information from Google. Go here for more information.
{ "sub": 1234567890, // The unique ID of the user's Google Account "iss": "https://accounts.google.com", // The token's issuer "aud": "123-abc.apps.googleusercontent.com", // Client ID assigned to your Actions project "iat": 233366400, // Unix timestamp of the token's creation time "exp": 233370000, // Unix timestamp of the token's expiration time "givenName": "John", "familyName": "Doe", "locale": "en_US", "email": "johndoe@gmail.com", "name": "John Doe" }
Returns object: A object with user’s information
-
IVoxaEvent is an interface that inherits its attributes and function to the specific platforms, for more information about each platform’s own methods visit: