public class PostTextRequest extends AmazonWebServiceRequest implements java.io.Serializable
Sends user input to Amazon Lex. Client applications can use this API to send requests to Amazon Lex at runtime. Amazon Lex then interprets the user input using the machine learning model it built for the bot.
In response, Amazon Lex returns the next message
to convey to
the user an optional responseCard
to display. Consider the
following example messages:
For a user input "I would like a pizza", Amazon Lex might return a response with a message eliciting slot data (for example, PizzaSize): "What size pizza would you like?"
After the user provides all of the pizza order information, Amazon Lex might return a response with a message to obtain user confirmation "Proceed with the pizza order?".
After the user replies to a confirmation prompt with a "yes", Amazon Lex might return a conclusion statement: "Thank you, your cheese pizza has been ordered.".
Not all Amazon Lex messages require a user response. For example, a
conclusion statement does not require a response. Some messages require only
a "yes" or "no" user response. In addition to the message
,
Amazon Lex provides additional context about the message in the response that
you might use to enhance client behavior, for example, to display the
appropriate client user interface. These are the slotToElicit
,
dialogState
, intentName
, and slots
fields in the response. Consider the following examples:
If the message is to elicit slot data, Amazon Lex returns the following context information:
dialogState
set to ElicitSlot
intentName
set to the intent name in the current context
slotToElicit
set to the slot name for which the
message
is eliciting information
slots
set to a map of slots, configured for the intent, with
currently known values
If the message is a confirmation prompt, the dialogState
is set
to ConfirmIntent and SlotToElicit
is set to null.
If the message is a clarification prompt (configured for the intent) that
indicates that user intent is not understood, the dialogState
is
set to ElicitIntent and slotToElicit
is set to null.
In addition, Amazon Lex also returns your application-specific
sessionAttributes
. For more information, see Managing
Conversation Context.
Constructor and Description |
---|
PostTextRequest() |
Modifier and Type | Method and Description |
---|---|
PostTextRequest |
addrequestAttributesEntry(java.lang.String key,
java.lang.String value)
Request-specific information passed between Amazon Lex and a client
application.
|
PostTextRequest |
addsessionAttributesEntry(java.lang.String key,
java.lang.String value)
Application-specific information passed between Amazon Lex and a client
application.
|
PostTextRequest |
clearrequestAttributesEntries()
Removes all the entries added into requestAttributes.
|
PostTextRequest |
clearsessionAttributesEntries()
Removes all the entries added into sessionAttributes.
|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getBotAlias()
The alias of the Amazon Lex bot.
|
java.lang.String |
getBotName()
The name of the Amazon Lex bot.
|
java.lang.String |
getInputText()
The text that the user entered (Amazon Lex interprets this text).
|
java.util.Map<java.lang.String,java.lang.String> |
getRequestAttributes()
Request-specific information passed between Amazon Lex and a client
application.
|
java.util.Map<java.lang.String,java.lang.String> |
getSessionAttributes()
Application-specific information passed between Amazon Lex and a client
application.
|
java.lang.String |
getUserId()
The ID of the client application user.
|
int |
hashCode() |
void |
setBotAlias(java.lang.String botAlias)
The alias of the Amazon Lex bot.
|
void |
setBotName(java.lang.String botName)
The name of the Amazon Lex bot.
|
void |
setInputText(java.lang.String inputText)
The text that the user entered (Amazon Lex interprets this text).
|
void |
setRequestAttributes(java.util.Map<java.lang.String,java.lang.String> requestAttributes)
Request-specific information passed between Amazon Lex and a client
application.
|
void |
setSessionAttributes(java.util.Map<java.lang.String,java.lang.String> sessionAttributes)
Application-specific information passed between Amazon Lex and a client
application.
|
void |
setUserId(java.lang.String userId)
The ID of the client application user.
|
java.lang.String |
toString()
Returns a string representation of this object; useful for testing and
debugging.
|
PostTextRequest |
withBotAlias(java.lang.String botAlias)
The alias of the Amazon Lex bot.
|
PostTextRequest |
withBotName(java.lang.String botName)
The name of the Amazon Lex bot.
|
PostTextRequest |
withInputText(java.lang.String inputText)
The text that the user entered (Amazon Lex interprets this text).
|
PostTextRequest |
withRequestAttributes(java.util.Map<java.lang.String,java.lang.String> requestAttributes)
Request-specific information passed between Amazon Lex and a client
application.
|
PostTextRequest |
withSessionAttributes(java.util.Map<java.lang.String,java.lang.String> sessionAttributes)
Application-specific information passed between Amazon Lex and a client
application.
|
PostTextRequest |
withUserId(java.lang.String userId)
The ID of the client application user.
|
clone, getCloneRoot, getCloneSource, getGeneralProgressListener, getRequestClientOptions, getRequestCredentials, getRequestMetricCollector, setGeneralProgressListener, setRequestCredentials, setRequestMetricCollector, withGeneralProgressListener, withRequestMetricCollector
public java.lang.String getBotName()
The name of the Amazon Lex bot.
The name of the Amazon Lex bot.
public void setBotName(java.lang.String botName)
The name of the Amazon Lex bot.
botName
- The name of the Amazon Lex bot.
public PostTextRequest withBotName(java.lang.String botName)
The name of the Amazon Lex bot.
Returns a reference to this object so that method calls can be chained together.
botName
- The name of the Amazon Lex bot.
public java.lang.String getBotAlias()
The alias of the Amazon Lex bot.
The alias of the Amazon Lex bot.
public void setBotAlias(java.lang.String botAlias)
The alias of the Amazon Lex bot.
botAlias
- The alias of the Amazon Lex bot.
public PostTextRequest withBotAlias(java.lang.String botAlias)
The alias of the Amazon Lex bot.
Returns a reference to this object so that method calls can be chained together.
botAlias
- The alias of the Amazon Lex bot.
public java.lang.String getUserId()
The ID of the client application user. Amazon Lex uses this to identify a
user's conversation with your bot. At runtime, each request must contain
the userID
field.
To decide the user ID to use for your application, consider the following factors.
The userID
field must not contain any personally
identifiable information of the user, for example, name, personal
identification numbers, or other end user personal information.
If you want a user to start a conversation on one device and continue on another device, use a user-specific identifier.
If you want the same user to be able to have two independent conversations on two different devices, choose a device-specific identifier.
A user can't have two independent conversations with two different versions of the same bot. For example, a user can't have a conversation with the PROD and BETA versions of the same bot. If you anticipate that a user will need to have conversation with two different versions, for example, while testing, include the bot alias in the user ID to separate the two conversations.
Constraints:
Length: 2 - 100
Pattern: [0-9a-zA-Z._:-]+
The ID of the client application user. Amazon Lex uses this to
identify a user's conversation with your bot. At runtime, each
request must contain the userID
field.
To decide the user ID to use for your application, consider the following factors.
The userID
field must not contain any personally
identifiable information of the user, for example, name, personal
identification numbers, or other end user personal information.
If you want a user to start a conversation on one device and continue on another device, use a user-specific identifier.
If you want the same user to be able to have two independent conversations on two different devices, choose a device-specific identifier.
A user can't have two independent conversations with two different versions of the same bot. For example, a user can't have a conversation with the PROD and BETA versions of the same bot. If you anticipate that a user will need to have conversation with two different versions, for example, while testing, include the bot alias in the user ID to separate the two conversations.
public void setUserId(java.lang.String userId)
The ID of the client application user. Amazon Lex uses this to identify a
user's conversation with your bot. At runtime, each request must contain
the userID
field.
To decide the user ID to use for your application, consider the following factors.
The userID
field must not contain any personally
identifiable information of the user, for example, name, personal
identification numbers, or other end user personal information.
If you want a user to start a conversation on one device and continue on another device, use a user-specific identifier.
If you want the same user to be able to have two independent conversations on two different devices, choose a device-specific identifier.
A user can't have two independent conversations with two different versions of the same bot. For example, a user can't have a conversation with the PROD and BETA versions of the same bot. If you anticipate that a user will need to have conversation with two different versions, for example, while testing, include the bot alias in the user ID to separate the two conversations.
Constraints:
Length: 2 - 100
Pattern: [0-9a-zA-Z._:-]+
userId
-
The ID of the client application user. Amazon Lex uses this to
identify a user's conversation with your bot. At runtime, each
request must contain the userID
field.
To decide the user ID to use for your application, consider the following factors.
The userID
field must not contain any personally
identifiable information of the user, for example, name,
personal identification numbers, or other end user personal
information.
If you want a user to start a conversation on one device and continue on another device, use a user-specific identifier.
If you want the same user to be able to have two independent conversations on two different devices, choose a device-specific identifier.
A user can't have two independent conversations with two different versions of the same bot. For example, a user can't have a conversation with the PROD and BETA versions of the same bot. If you anticipate that a user will need to have conversation with two different versions, for example, while testing, include the bot alias in the user ID to separate the two conversations.
public PostTextRequest withUserId(java.lang.String userId)
The ID of the client application user. Amazon Lex uses this to identify a
user's conversation with your bot. At runtime, each request must contain
the userID
field.
To decide the user ID to use for your application, consider the following factors.
The userID
field must not contain any personally
identifiable information of the user, for example, name, personal
identification numbers, or other end user personal information.
If you want a user to start a conversation on one device and continue on another device, use a user-specific identifier.
If you want the same user to be able to have two independent conversations on two different devices, choose a device-specific identifier.
A user can't have two independent conversations with two different versions of the same bot. For example, a user can't have a conversation with the PROD and BETA versions of the same bot. If you anticipate that a user will need to have conversation with two different versions, for example, while testing, include the bot alias in the user ID to separate the two conversations.
Returns a reference to this object so that method calls can be chained together.
Constraints:
Length: 2 - 100
Pattern: [0-9a-zA-Z._:-]+
userId
-
The ID of the client application user. Amazon Lex uses this to
identify a user's conversation with your bot. At runtime, each
request must contain the userID
field.
To decide the user ID to use for your application, consider the following factors.
The userID
field must not contain any personally
identifiable information of the user, for example, name,
personal identification numbers, or other end user personal
information.
If you want a user to start a conversation on one device and continue on another device, use a user-specific identifier.
If you want the same user to be able to have two independent conversations on two different devices, choose a device-specific identifier.
A user can't have two independent conversations with two different versions of the same bot. For example, a user can't have a conversation with the PROD and BETA versions of the same bot. If you anticipate that a user will need to have conversation with two different versions, for example, while testing, include the bot alias in the user ID to separate the two conversations.
public java.util.Map<java.lang.String,java.lang.String> getSessionAttributes()
Application-specific information passed between Amazon Lex and a client application.
For more information, see Setting Session Attributes.
Application-specific information passed between Amazon Lex and a client application.
For more information, see Setting Session Attributes.
public void setSessionAttributes(java.util.Map<java.lang.String,java.lang.String> sessionAttributes)
Application-specific information passed between Amazon Lex and a client application.
For more information, see Setting Session Attributes.
sessionAttributes
- Application-specific information passed between Amazon Lex and a client application.
For more information, see Setting Session Attributes.
public PostTextRequest withSessionAttributes(java.util.Map<java.lang.String,java.lang.String> sessionAttributes)
Application-specific information passed between Amazon Lex and a client application.
For more information, see Setting Session Attributes.
Returns a reference to this object so that method calls can be chained together.
sessionAttributes
- Application-specific information passed between Amazon Lex and a client application.
For more information, see Setting Session Attributes.
public PostTextRequest addsessionAttributesEntry(java.lang.String key, java.lang.String value)
Application-specific information passed between Amazon Lex and a client application.
For more information, see Setting Session Attributes.
The method adds a new key-value pair into sessionAttributes parameter, and returns a reference to this object so that method calls can be chained together.
key
- The key of the entry to be added into sessionAttributes.value
- The corresponding value of the entry to be added into
sessionAttributes.public PostTextRequest clearsessionAttributesEntries()
Returns a reference to this object so that method calls can be chained together.
public java.util.Map<java.lang.String,java.lang.String> getRequestAttributes()
Request-specific information passed between Amazon Lex and a client application.
The namespace x-amz-lex:
is reserved for special attributes.
Don't create any request attributes with the prefix
x-amz-lex:
.
For more information, see Setting Request Attributes.
Request-specific information passed between Amazon Lex and a client application.
The namespace x-amz-lex:
is reserved for special
attributes. Don't create any request attributes with the prefix
x-amz-lex:
.
For more information, see Setting Request Attributes.
public void setRequestAttributes(java.util.Map<java.lang.String,java.lang.String> requestAttributes)
Request-specific information passed between Amazon Lex and a client application.
The namespace x-amz-lex:
is reserved for special attributes.
Don't create any request attributes with the prefix
x-amz-lex:
.
For more information, see Setting Request Attributes.
requestAttributes
- Request-specific information passed between Amazon Lex and a client application.
The namespace x-amz-lex:
is reserved for special
attributes. Don't create any request attributes with the
prefix x-amz-lex:
.
For more information, see Setting Request Attributes.
public PostTextRequest withRequestAttributes(java.util.Map<java.lang.String,java.lang.String> requestAttributes)
Request-specific information passed between Amazon Lex and a client application.
The namespace x-amz-lex:
is reserved for special attributes.
Don't create any request attributes with the prefix
x-amz-lex:
.
For more information, see Setting Request Attributes.
Returns a reference to this object so that method calls can be chained together.
requestAttributes
- Request-specific information passed between Amazon Lex and a client application.
The namespace x-amz-lex:
is reserved for special
attributes. Don't create any request attributes with the
prefix x-amz-lex:
.
For more information, see Setting Request Attributes.
public PostTextRequest addrequestAttributesEntry(java.lang.String key, java.lang.String value)
Request-specific information passed between Amazon Lex and a client application.
The namespace x-amz-lex:
is reserved for special attributes.
Don't create any request attributes with the prefix
x-amz-lex:
.
For more information, see Setting Request Attributes.
The method adds a new key-value pair into requestAttributes parameter, and returns a reference to this object so that method calls can be chained together.
key
- The key of the entry to be added into requestAttributes.value
- The corresponding value of the entry to be added into
requestAttributes.public PostTextRequest clearrequestAttributesEntries()
Returns a reference to this object so that method calls can be chained together.
public java.lang.String getInputText()
The text that the user entered (Amazon Lex interprets this text).
Constraints:
Length: 1 - 1024
The text that the user entered (Amazon Lex interprets this text).
public void setInputText(java.lang.String inputText)
The text that the user entered (Amazon Lex interprets this text).
Constraints:
Length: 1 - 1024
inputText
- The text that the user entered (Amazon Lex interprets this text).
public PostTextRequest withInputText(java.lang.String inputText)
The text that the user entered (Amazon Lex interprets this text).
Returns a reference to this object so that method calls can be chained together.
Constraints:
Length: 1 - 1024
inputText
- The text that the user entered (Amazon Lex interprets this text).
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Copyright © 2018 Amazon Web Services, Inc. All Rights Reserved.