public class PostContentRequest extends AmazonWebServiceRequest implements Serializable
Sends user input (speech or text), at runtime, to Amazon Lex. Amazon Lex uses the machine learning model (built for the specific bot), in order to interpret the user input specified in the request.
When building Amazon Lex text bots, you can use the PostText
API
operation, which supports response cards. When building Amazon Lex bots that
communicate by speech alone or by speech and text, you use the this API.
In response, Amazon Lex returns the next message
to convey to
the user and the message type (dialogState
). Based on the user
interaction context, Amazon Lex knows the message to return and the message
type indicates whether to expect a user response for that message. For
example, consider the following response messages:
"What pizza toppings would you like?" - For this message, the
dialogState
would be ElicitSlot
(that is, a user
response is expected).
"Your order has been placed." - For this message, Amazon Lex returns one of
the following dialog states depending on how the fulfillment is configured
for the intent (see fulfillmentActivity
in
CreateIntent
):
FulFilled
– The intent fulfillmentActivity
is
configured with a Lambda function to fulfill the intent.
ReadyForFulfilment
– The intent's
fulfillmentActivity
is configured to simply return the intent
data back to the client application.
Constructor and Description |
---|
PostContentRequest() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getAccept()
You pass this value as the
Accept HTTP header. |
String |
getBotAlias()
Alias of the Amazon Lex bot.
|
String |
getBotName()
Name of the Amazon Lex bot.
|
String |
getContentType()
You pass this values as the
Content-Type HTTP header. |
InputStream |
getInputStream()
User input, in the format as described in the
Content-Type
HTTP header. |
Map<String,String> |
getSessionAttributes()
You pass this value in the
x-amz-lex-session-attributes HTTP
header. |
String |
getUserId()
User ID of your client application.
|
int |
hashCode() |
void |
setAccept(String accept)
You pass this value as the
Accept HTTP header. |
void |
setBotAlias(String botAlias)
Alias of the Amazon Lex bot.
|
void |
setBotName(String botName)
Name of the Amazon Lex bot.
|
void |
setContentType(String contentType)
You pass this values as the
Content-Type HTTP header. |
void |
setInputStream(InputStream inputStreamValue)
User input, in the format as described in the
Content-Type
HTTP header. |
void |
setSessionAttributes(Map<String,String> sessionAttributes)
You pass this value in the
x-amz-lex-session-attributes HTTP
header. |
void |
setUserId(String userId)
User ID of your client application.
|
String |
toString()
Returns a string representation of this object; useful for testing and
debugging.
|
PostContentRequest |
withAccept(String accept)
You pass this value as the
Accept HTTP header. |
PostContentRequest |
withBotAlias(String botAlias)
Alias of the Amazon Lex bot.
|
PostContentRequest |
withBotName(String botName)
Name of the Amazon Lex bot.
|
PostContentRequest |
withContentType(String contentType)
You pass this values as the
Content-Type HTTP header. |
PostContentRequest |
withInputStream(InputStream inputStreamValue)
User input, in the format as described in the
Content-Type
HTTP header. |
PostContentRequest |
withSessionAttributes(Map<String,String> sessionAttributes)
You pass this value in the
x-amz-lex-session-attributes HTTP
header. |
PostContentRequest |
withUserId(String userId)
User ID of your client application.
|
clone, copyBaseTo, getCloneRoot, getCloneSource, getGeneralProgressListener, getRequestClientOptions, getRequestCredentials, getRequestMetricCollector, setGeneralProgressListener, setRequestCredentials, setRequestMetricCollector, withGeneralProgressListener, withRequestMetricCollector
public String getBotName()
Name of the Amazon Lex bot.
Name of the Amazon Lex bot.
public void setBotName(String botName)
Name of the Amazon Lex bot.
botName
- Name of the Amazon Lex bot.
public PostContentRequest withBotName(String botName)
Name of the Amazon Lex bot.
Returns a reference to this object so that method calls can be chained together.
botName
- Name of the Amazon Lex bot.
public String getBotAlias()
Alias of the Amazon Lex bot.
Alias of the Amazon Lex bot.
public void setBotAlias(String botAlias)
Alias of the Amazon Lex bot.
botAlias
- Alias of the Amazon Lex bot.
public PostContentRequest withBotAlias(String botAlias)
Alias of the Amazon Lex bot.
Returns a reference to this object so that method calls can be chained together.
botAlias
- Alias of the Amazon Lex bot.
public String getUserId()
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._:-]+
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.
public void setUserId(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._:-]+
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.
public PostContentRequest withUserId(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.
Returns a reference to this object so that method calls can be chained together.
Constraints:
Length: 2 - 50
Pattern: [0-9a-zA-Z._:-]+
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.
public Map<String,String> getSessionAttributes()
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.
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.
public void setSessionAttributes(Map<String,String> 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.
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.
public PostContentRequest withSessionAttributes(Map<String,String> 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.
Returns a reference to this object so that method calls can be chained together.
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.
public String getContentType()
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
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
public void setContentType(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
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
public PostContentRequest withContentType(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
Returns a reference to this object so that method calls can be chained together.
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
public String getAccept()
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)
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)
public void setAccept(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)
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)
public PostContentRequest withAccept(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)
Returns a reference to this object so that method calls can be chained together.
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)
public InputStream getInputStream()
User input, in the format as described in the Content-Type
HTTP header.
User input, in the format as described in the
Content-Type
HTTP header.
public void setInputStream(InputStream inputStreamValue)
User input, in the format as described in the Content-Type
HTTP header.
inputStreamValue
-
User input, in the format as described in the
Content-Type
HTTP header.
public PostContentRequest withInputStream(InputStream inputStreamValue)
User input, in the format as described in the Content-Type
HTTP header.
Returns a reference to this object so that method calls can be chained together.
inputStreamValue
-
User input, in the format as described in the
Content-Type
HTTP header.
public String toString()
toString
in class Object
Object.toString()
Copyright © 2018. All rights reserved.