AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Container for the parameters to the PutIntent operation. Creates an intent or replaces an existing intent.

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:

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

If you specify an existing intent name to update the intent, Amazon Lex replaces the values in the $LATEST version of the slot type 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.

For more information, see how-it-works.

This operation requires permissions for the lex:PutIntent action.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.LexModelBuildingService.AmazonLexModelBuildingServiceRequest
      Amazon.LexModelBuildingService.Model.PutIntentRequest

Namespace: Amazon.LexModelBuildingService.Model
Assembly: AWSSDK.LexModelBuildingService.dll
Version: 3.x.y.z

Syntax

C#
public class PutIntentRequest : AmazonLexModelBuildingServiceRequest
         IAmazonWebServiceRequest

The PutIntentRequest type exposes the following members

Constructors

NameDescription
Public Method PutIntentRequest()

Properties

NameTypeDescription
Public Property Checksum System.String

Gets and sets the property Checksum.

Identifies a specific revision of the $LATEST version.

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.

Public Property ConclusionStatement Amazon.LexModelBuildingService.Model.Statement

Gets and sets the property ConclusionStatement.

The statement that you want Amazon Lex to convey to the user after the intent is successfully fulfilled by the Lambda function.

This element is relevant only if you provide a Lambda function in the fulfillmentActivity. If you return the intent to the client application, you can't specify this element.

The followUpPrompt and conclusionStatement are mutually exclusive. You can specify only one.

Public Property ConfirmationPrompt Amazon.LexModelBuildingService.Model.Prompt

Gets and sets the property ConfirmationPrompt.

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.

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

Public Property Description System.String

Gets and sets the property Description.

A description of the intent.

Public Property DialogCodeHook Amazon.LexModelBuildingService.Model.CodeHook

Gets and sets the property DialogCodeHook.

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.

Public Property FollowUpPrompt Amazon.LexModelBuildingService.Model.FollowUpPrompt

Gets and sets the property FollowUpPrompt.

Amazon Lex uses this prompt to solicit additional activity after fulfilling an intent. For example, after the OrderPizza intent is fulfilled, you might prompt the user to order a drink.

The action that Amazon Lex takes depends on the user's response, as follows:

  • If the user says "Yes" it responds with the clarification prompt that is configured for the bot.

  • if the user says "Yes" and continues with an utterance that triggers an intent it starts a conversation for the intent.

  • If the user says "No" it responds with the rejection statement configured for the the follow-up prompt.

  • If it doesn't recognize the utterance it repeats the follow-up prompt again.

The followUpPrompt field and the conclusionStatement field are mutually exclusive. You can specify only one.

Public Property FulfillmentActivity Amazon.LexModelBuildingService.Model.FulfillmentActivity

Gets and sets the property FulfillmentActivity.

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).

Public Property Name System.String

Gets and sets the property Name.

The name of the intent. The name is not case sensitive.

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.

For a list of built-in intents, see Standard Built-in Intents in the Alexa Skills Kit.

Public Property ParentIntentSignature System.String

Gets and sets the property ParentIntentSignature.

A unique identifier for the built-in intent to base this intent on. To find the signature for an intent, see Standard Built-in Intents in the Alexa Skills Kit.

Public Property RejectionStatement Amazon.LexModelBuildingService.Model.Statement

Gets and sets the property RejectionStatement.

When the user answers "no" to the question defined in confirmationPrompt, Amazon Lex responds with this statement to acknowledge that the intent was canceled.

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

Public Property SampleUtterances System.Collections.Generic.List<System.String>

Gets and sets the property SampleUtterances.

An array of utterances (strings) that a user might say to signal the intent. For example, "I want {PizzaSize} pizza", "Order {Quantity} {PizzaSize} pizzas".

In each utterance, a slot name is enclosed in curly braces.

Public Property Slots System.Collections.Generic.List<Amazon.LexModelBuildingService.Model.Slot>

Gets and sets the property Slots.

An array of intent slots. At runtime, Amazon Lex elicits required slot values from the user using prompts defined in the slots. For more information, see how-it-works.

Examples

This example shows how to create an intent for ordering pizzas.

To create an intent


var response = client.PutIntent(new PutIntentRequest 
{
    Name = "DocOrderPizza",
    ConclusionStatement = new Statement {
        Messages = new List {
            new Message {
                Content = "All right, I ordered  you a {Crust} crust {Type} pizza with {Sauce} sauce.",
                ContentType = "PlainText"
            },
            new Message {
                Content = "OK, your {Crust} crust {Type} pizza with {Sauce} sauce is on the way.",
                ContentType = "PlainText"
            }
        },
        ResponseCard = "foo"
    },
    ConfirmationPrompt = new Prompt {
        MaxAttempts = 1,
        Messages = new List {
            new Message {
                Content = "Should I order  your {Crust} crust {Type} pizza with {Sauce} sauce?",
                ContentType = "PlainText"
            }
        }
    },
    Description = "Order a pizza from a local pizzeria.",
    FulfillmentActivity = new FulfillmentActivity { Type = "ReturnIntent" },
    RejectionStatement = new Statement { Messages = new List {
        new Message {
            Content = "Ok, I'll cancel your order.",
            ContentType = "PlainText"
        },
        new Message {
            Content = "I cancelled your order.",
            ContentType = "PlainText"
        }
    } },
    SampleUtterances = new List {
        "Order me a pizza.",
        "Order me a {Type} pizza.",
        "I want a {Crust} crust {Type} pizza",
        "I want a {Crust} crust {Type} pizza with {Sauce} sauce."
    },
    Slots = new List {
        new Slot {
            Name = "Type",
            Description = "The type of pizza to order.",
            Priority = 1,
            SampleUtterances = new List {
                "Get me a {Type} pizza.",
                "A {Type} pizza please.",
                "I'd like a {Type} pizza."
            },
            SlotConstraint = "Required",
            SlotType = "DocPizzaType",
            SlotTypeVersion = "$LATEST",
            ValueElicitationPrompt = new Prompt {
                MaxAttempts = 1,
                Messages = new List {
                    new Message {
                        Content = "What type of pizza would you like?",
                        ContentType = "PlainText"
                    },
                    new Message {
                        Content = "Vegie or cheese pizza?",
                        ContentType = "PlainText"
                    },
                    new Message {
                        Content = "I can get you a vegie or a cheese pizza.",
                        ContentType = "PlainText"
                    }
                }
            }
        },
        new Slot {
            Name = "Crust",
            Description = "The type of pizza crust to order.",
            Priority = 2,
            SampleUtterances = new List {
                "Make it a {Crust} crust.",
                "I'd like a {Crust} crust."
            },
            SlotConstraint = "Required",
            SlotType = "DocPizzaCrustType",
            SlotTypeVersion = "$LATEST",
            ValueElicitationPrompt = new Prompt {
                MaxAttempts = 1,
                Messages = new List {
                    new Message {
                        Content = "What type of crust would you like?",
                        ContentType = "PlainText"
                    },
                    new Message {
                        Content = "Thick or thin crust?",
                        ContentType = "PlainText"
                    }
                }
            }
        },
        new Slot {
            Name = "Sauce",
            Description = "The type of sauce to use on the pizza.",
            Priority = 3,
            SampleUtterances = new List {
                "Make it {Sauce} sauce.",
                "I'd like {Sauce} sauce."
            },
            SlotConstraint = "Required",
            SlotType = "DocPizzaSauceType",
            SlotTypeVersion = "$LATEST",
            ValueElicitationPrompt = new Prompt {
                MaxAttempts = 1,
                Messages = new List {
                    new Message {
                        Content = "White or red sauce?",
                        ContentType = "PlainText"
                    },
                    new Message {
                        Content = "Garlic or tomato sauce?",
                        ContentType = "PlainText"
                    }
                }
            }
        }
    }
});

string version = response.Version;
string name = response.Name;
string checksum = response.Checksum;
Statement conclusionStatement = response.ConclusionStatement;
Prompt confirmationPrompt = response.ConfirmationPrompt;
DateTime createdDate = response.CreatedDate;
string description = response.Description;
FulfillmentActivity fulfillmentActivity = response.FulfillmentActivity;
DateTime lastUpdatedDate = response.LastUpdatedDate;
Statement rejectionStatement = response.RejectionStatement;
List sampleUtterances = response.SampleUtterances;
List slots = response.Slots;

            

Version Information

.NET Standard:
Supported in: 1.3

.NET Framework:
Supported in: 4.5, 4.0, 3.5

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms