String text
Text visible to the user on the button.
Constraints:
Length: 1 - 15
String value
Value sent to Amazon Lex when user clicks the button. For example, consider button text "NYC". When the user clicks the button, the value sent can be "New York City".
Constraints:
Length: 1 - 1000
String title
Title of the option.
Constraints:
Length: 1 - 80
String subTitle
Subtitle shown below the title.
Constraints:
Length: 1 - 80
String attachmentLinkUrl
Constraints:
Length: 1 - 2048
String imageUrl
URL of an image that is displayed to the user.
Constraints:
Length: 1 - 2048
List<E> buttons
List of options to show to the user.
String retryAfterSeconds
String botName
Name of the Amazon Lex bot.
String botAlias
Alias of the Amazon Lex bot.
String userId
User ID of your client application. Typically, your application users should have a unique ID. Note the following considerations:
If you want a user to start conversation on one mobile device and continue the conversation on another device, you might choose user-specific identifier, such as login, or Amazon Cognito user ID (assuming your application is using Amazon Cognito).
If you want the same user to be able to have two independent conversations on two different devices, you might choose device-specific identifier, such as device ID, or some globally unique identifier.
Constraints:
Length: 2 - 50
Pattern: [0-9a-zA-Z._:-]+
Map<K,V> sessionAttributes
You pass this value in the x-amz-lex-session-attributes
HTTP
header. The value must be map (keys and values must be string) that is
JSON serialized and then base64-encoded.
A session represents dialog between a user and Amazon Lex. At runtime, a
client application can pass contextual information (session attributes),
in the request. For example, "FirstName" : "Joe"
.
Amazon Lex passes these session attributes to the Lambda functions
configured for the intent (see dialogCodeHook
and
fulfillmentActivity.codeHook
in CreateIntent
).
In the Lambda function code, you can use the session attributes for
customization. For example:
In a pizza ordering application, if you pass user location (for example,
"Location" : "some location"
) as a session attribute, your
Lambda function might use this information to determine the closest
pizzeria to place the order.
You might use session attribute information to personalize prompts. For
example, suppose you pass in a user name as a session attribute (
"FirstName" : "Joe"
). You might configure subsequent prompts
to refer to this attribute, as $session.FirstName"
. At
runtime, Amazon Lex substitutes a real value when the prompt is
generated, such as "Hello Joe, what would you like to order?"
Amazon Lex does not persist session attributes.
If you have not configured a Lambda function to process an intent (that is, you want processing done on the client), Amazon Lex simply returns the session attributes back to the client application.
If you configured a Lambda function to process the intent, Amazon Lex passes the incoming session attributes to the Lambda function. The Lambda function must return these session attributes if you want Amazon Lex to return them back to client.
String contentType
You pass this values as the Content-Type
HTTP header.
Indicates the audio format or text. The header value must start with one of the following prefixes:
audio/l16; rate=16000; channels=1
audio/x-l16; sample-rate=16000; channel-count=1
text/plain; charset=utf-8
audio/x-cbr-opus-with-preamble; preamble-size=0; bit-rate=1; frame-size-milliseconds=1.1
String accept
You pass this value as the Accept
HTTP header.
The message Amazon Lex returns in the response can be either text or
speech based on the Accept
HTTP header value in the request.
If the value is text/plain; charset=utf-8
, Amazon Lex
returns text in the response.
If the value begins with audio/
, the Amazon Lex returns a
speech in the response. Amazon Lex uses Amazon Polly to generate the
speech (using the configuration you specified in the Accept
header). For example, if you specify audio/mpeg
as the
value, Amazon Lex returns speech in the MPEG format.
The following are the accepted values:
audio/mpeg
audio/ogg
audio/pcm
text/plain; charset=utf-8
audio/* (defaults to mpeg)
InputStream inputStreamValue
User input, in the format as described in the Content-Type
HTTP header.
String contentType
Content type as specified in the Accept
HTTP header in the
request.
String intentName
Name of the intent.
Map<K,V> slots
Map of zero or more intent slots (name/value pairs) Amazon Lex detected from the user input during the conversation.
Map<K,V> sessionAttributes
JSON serialized and then base64-encoded map of key value pairs representing the session specific context information.
String message
Based on the build-time application configuration, Amazon Lex determines the prompt (or statement) to convey to the user. If your application uses a Lambda function, then it can determine what prompt (or statement) to convey to the user.
Constraints:
Length: 1 - 1024
String dialogState
Represents the message type to be conveyed to the user. For example:
ElicitIntent
– Amazon Lex wants to elicit the user's intent.
Consider the following examples:
Suppose Amazon Lex did not understand the first utterances. For example, "I want to order pizza" (indicating OrderPizza intent). If Amazon Lex doesn't understand the user's input to determine the intent, the service returns this dialog state.
Suppose the intent is configured with a follow up prompt. For example, after the OrderPizza intent is fulfilled, the intent might have a follow up prompt such as "Do you want to order a drink or desert?" In this case, Amazon Lex returns this dialog state.
ConfirmIntent
– Amazon Lex is expecting a yes/no response
from the user indicating whether to go ahead and fulfill the intent (for
example, OK to go ahead and order the pizza).
In addition to yes/no reply, user might provide respond with additional slot information. It can be a new slot information or change in existing slot value. For example, the user might reply with "Yes, but change the crust to thick crust." Amazon Lex can understand the additional information and update the intent slots accordingly.
Consider another example. Before fulfilling an order, your application might prompt for confirmation such as "OK to place this pizza order?" A user might reply with "No, I want to order a drink." In this case, Amazon Lex recognizes the new OrderDrink intent.
ElicitSlot
– Amazon Lex is expecting a value of a slot for
the current intent. Suppose Amazon Lex asks
"What size pizza would you like?" A user might reply with "Medium" or
"Medium pepperoni pizza". Amazon Lex recognizes the size and the topping
as the two separate slot values.
Fulfilled
– Conveys that the Lambda function has
successfully fulfilled the intent. If Lambda function returns a
statement/message to convey the fulfillment result, Amazon Lex passes
this string to the client. If not, Amazon Lex looks for
conclusionStatement
that you configured for the intent.
If both the Lambda function statement and the
conclusionStatement
are missing, Amazon Lex throws a bad
request exception.
ReadyForFulfillment
– Conveys that the client has to do the
fulfillment work for the intent (this is the case when the current intent
has the fulfillmentActivity
configured as
ReturnIntent
).
Failed
– Conversation with the user failed. Some of the
reasons for this dialog state are: the user did not provide appropriate
response after the preconfigured number of attempts, or the Lambda
function failed to fulfill an intent.
Constraints:
Allowed Values: ElicitIntent, ConfirmIntent, ElicitSlot,
Fulfilled, ReadyForFulfillment, Failed
String slotToElicit
If dialogState
value is ElicitSlot
, this
returns the name of the slot for which Amazon Lex is eliciting a value.
InputStream audioStream
Prompt (or statement) to convey to the user. This is based on the
application configuration and context. For example, if Amazon Lex did not
understand the user intent, it sends the clarificationPrompt
configured for the application. If the intent requires confirmation
before taking the fulfillment action, it sends the
confirmationPrompt
. Here is another example, suppose the
Lambda function successfully fulfilled the intent, and sent a message to
convey to the user. Then Amazon Lex sends that message in the response.
String botName
Name of the Amazon Lex bot.
String botAlias
Alias of the Amazon Lex bot.
String userId
User ID of your client application. Typically, each of your application users should have a unique ID. Note the following considerations:
If you want a user to start a conversation on one mobile device and continue the conversation on another device, you might choose a user-specific identifier, such as a login or Amazon Cognito user ID (assuming your application is using Amazon Cognito).
If you want the same user to be able to have two independent conversations on two different devices, you might choose a device-specific identifier, such as device ID, or some globally unique identifier.
Constraints:
Length: 2 - 50
Pattern: [0-9a-zA-Z._:-]+
Map<K,V> sessionAttributes
A session represents the dialog between a user and Amazon Lex. At
runtime, a client application can pass contextual information (session
attributes) in the request. For example, "FirstName" : "Joe"
. Amazon Lex passes these session attributes to the AWS Lambda functions
configured for the intent (see dialogCodeHook
and
fulfillmentActivity.codeHook
in CreateIntent
).
In your Lambda function, you can use the session attributes for customization. Some examples are:
In a pizza ordering application, if you can pass user location as a
session attribute (for example,
"Location" : "111 Maple street"
), your Lambda function might
use this information to determine the closest pizzeria to place the
order.
Use session attributes to personalize prompts. For example, you pass in
user name as a session attribute ("FirstName" : "Joe"
), you
might configure subsequent prompts to refer to this attribute, as
$session.FirstName"
. At runtime, Amazon Lex substitutes a
real value when it generates a prompt, such as
"Hello Joe, what would you like to order?"
Amazon Lex does not persist session attributes.
If the intent is configured without a Lambda function to process the intent (that is, the client application to process the intent), Amazon Lex simply returns the session attributes back to the client application.
If the intent is configured with a Lambda function to process the intent, Amazon Lex passes the incoming session attributes to the Lambda function. The Lambda function must return these session attributes if you want Amazon Lex to return them back to the client.
String inputText
Text user entered (Amazon Lex interprets this text).
Constraints:
Length: 1 - 1024
String intentName
Intent Amazon Lex inferred from the user input text. This is one of the intents configured for the bot.
Map<K,V> slots
Intent slots (name/value pairs) Amazon Lex detected so far from the user input in the conversation.
Map<K,V> sessionAttributes
Map of key value pairs representing the session specific context information.
String message
Prompt (or statement) to convey to the user. This is based on the
application configuration and context. For example, if Amazon Lex did not
understand the user intent, it sends the clarificationPrompt
configured for the application. In another example, if the intent
requires confirmation before taking the fulfillment action, it sends the
confirmationPrompt
. Suppose the Lambda function successfully
fulfilled the intent, and sent a message to convey to the user. In that
situation, Amazon Lex sends that message in the response.
Constraints:
Length: 1 - 1024
String dialogState
Represents the message type to be conveyed to the user. For example:
ElicitIntent
– Amazon Lex wants to elicit user intent. For
example, Amazon Lex did not understand the first utterances such as
"I want to order pizza", which indicates the OrderPizza intent. If Amazon
Lex doesn't understand the intent, it returns this
dialogState
. Another example is when your intent is
configured with a follow up prompt. For example, after OrderPizza intent
is fulfilled, the intent might have a follow up prompt such as
" Do you want to order a drink or desert?" In this case, Amazon Lex
returns this dialogState
.
ConfirmIntent
– Amazon Lex is expecting a yes/no response
from the user indicating whether to go ahead and fulfill the intent (for
example, OK to go ahead and order the pizza). In addition to a yes/no
reply, the user might provide a response with additional slot information
(either new slot information or changes to the existing slot values). For
example, "Yes, but change to thick crust." Amazon Lex understands the
additional information and updates the intent slots accordingly.
Consider another example. Before fulfilling an order, your application might prompt for confirmation such as "Do you want to place this pizza order?" A user might reply with "No, I want to order a drink." Amazon Lex recognizes the new OrderDrink intent.
ElicitSlot
– Amazon Lex is expecting a value of a slot for
the current intent. For example, suppose Amazon Lex asks,
"What size pizza would you like?" A user might reply with
"Medium pepperoni pizza." Amazon Lex recognizes the size and the topping
as the two separate slot values.
Fulfilled
– Conveys that the Lambda function has
successfully fulfilled the intent. If Lambda function returns a
statement/message to convey the fulfillment result, Amazon Lex passes
this string to the client. If not, Amazon Lex looks for
conclusionStatement
that you configured for the intent.
If both the Lambda function statement and the
conclusionStatement
are missing, Amazon Lex throws a bad
request exception.
ReadyForFulfillment
– conveys that the client has to do the
fulfillment work for the intent. This is the case when the current intent
is configured with ReturnIntent
as the
fulfillmentActivity
, where Amazon Lex returns this state to
client.
Failed
– Conversation with the user failed. Some of the
reasons for this dialogState
are: after the configured
number of attempts the user didn't provide an appropriate response, or
the Lambda function failed to fulfill an intent.
Constraints:
Allowed Values: ElicitIntent, ConfirmIntent, ElicitSlot,
Fulfilled, ReadyForFulfillment, Failed
String slotToElicit
If dialogState
value is ElicitSlot
, returns the
name of the slot for which Amazon Lex is eliciting a value.
ResponseCard responseCard
Represents the options that the user has to respond to the current
prompt. Amazon Lex sends this in the response only if the
dialogState
value indicates that a user response is
expected.
Copyright © 2016. All rights reserved.