PutIntent

To define the interaction between the user and your bot, you use one or more intents.
For a pizza ordering bot, for example, you would create an OrderPizza intent.

To create an intent or replace an existing intent, you must provide the
following:

Intent name. For example, OrderPizza.

Sample utterances. For example, "Can I order a pizza, please." and "I want to order
a pizza."

Information to be gathered. You specify slot types for the information that your
bot will request from the user. You can specify standard slot types, such as a date
or a
time, or custom slot types such as the size and crust of a pizza.

How the intent will be fulfilled. You can provide a Lambda function or configure
the intent to return the intent information to the client application. If you use
a Lambda
function, when all of the intent information is available, Amazon Lex invokes your
Lambda
function. If you configure your intent to return the intent information to the client
application.

You can specify other optional information in the request, such as:

A confirmation prompt to ask the user to confirm an intent. For example, "Shall I
order your pizza?"

A conclusion statement to send to the user after the intent has been fulfilled. For
example, "I placed your pizza order."

A follow-up prompt that asks the user for additional activity. For example, asking
"Do you want to order a drink with your pizza?"

If you specify an existing intent name to update the intent, Amazon Lex replaces the
values
in the $LATEST version of the intent with the values in the request. Amazon Lex
removes fields that you don't provide in the request. If you don't specify the required
fields, Amazon Lex throws an exception. When you update the $LATEST version of an
intent, the status field of any bot that uses the $LATEST version of
the intent is set to NOT_BUILT.

URI Request Parameters

The name can't match a built-in intent name, or a built-in intent name with "AMAZON."
removed. For example, because there is a built-in intent called
AMAZON.HelpIntent, you can't create a custom intent called
HelpIntent.

Request Body

When you create a new intent, leave the checksum field blank. If you
specify a checksum you get a BadRequestException exception.

When you want to update a intent, set the checksum field to the checksum
of the most recent revision of the $LATEST version. If you don't specify the
checksum field, or if the checksum does not match the $LATEST
version, you get a PreconditionFailedException exception.

Prompts the user to confirm the intent. This question should have a yes or no
answer.

Amazon Lex uses this prompt to ensure that the user acknowledges that the intent is
ready
for fulfillment. For example, with the OrderPizza intent, you might want to
confirm that the order is correct before placing it. For other intents, such as intents
that
simply respond to user questions, you might not need to ask the user for confirmation
before
providing the information.

Note

You you must provide both the rejectionStatement and the
confirmationPrompt, or neither.

Specifies a Lambda function to invoke for each user input. You can invoke this Lambda
function to personalize user interaction.

For example, suppose your bot determines that the user is John. Your Lambda function
might retrieve John's information from a backend database and prepopulate some of
the values.
For example, if you find that John is gluten intolerant, you might set the corresponding
intent slot, GlutenIntolerant, to true. You might find John's phone number and
set the corresponding session attribute.

Required. Describes how the intent is fulfilled. For example, after a user provides
all
of the information for a pizza order, fulfillmentActivity defines how the bot
places an order with a local pizza store.

You might configure Amazon Lex to return all of the intent information to the client
application, or direct it to invoke a Lambda function that can process the intent
(for
example, place an order with a pizzeria).