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.

Creates an Amazon Lex conversational bot or replaces an existing bot. When you create or update a bot you are only required to specify a name, a locale, and whether the bot is directed toward children under age 13. You can use this to add intents later, or to remove intents from an existing bot. When you create a bot with the minimum information, the bot is created or updated but Amazon Lex returns the response FAILED. You can build the bot after you add one or more intents. For more information about Amazon Lex bots, see how-it-works.

If you specify the name of an existing bot, the fields in the request replace the existing values in the $LATEST version of the bot. Amazon Lex removes any fields that you don't provide values for in the request, except for the idleTTLInSeconds and privacySettings fields, which are set to their default values. If you don't specify values for required fields, Amazon Lex throws an exception.

This operation requires permissions for the lex:PutBot action. For more information, see auth-and-access-control.


For .NET Core and PCL this operation is only available in asynchronous form. Please refer to PutBotAsync.

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


public virtual PutBotResponse PutBot(
         PutBotRequest request
Type: Amazon.LexModelBuildingService.Model.PutBotRequest

Container for the necessary parameters to execute the PutBot service method.

Return Value
The response from the PutBot service method, as returned by LexModelBuildingService.


BadRequestException The request is not well formed. For example, a value is invalid or a required field is missing. Check the field values, and try again.
ConflictException There was a conflict processing the request. Try your request again.
InternalFailureException An internal Amazon Lex error occurred. Try your request again.
LimitExceededException The request exceeded a limit. Try your request again.
PreconditionFailedException The checksum of the resource that you are trying to change does not match the checksum in the request. Check the resource's checksum and try again.


This example shows how to create a bot for ordering pizzas.

To create a bot

var response = client.PutBot(new PutBotRequest 
    Name = "DocOrderPizzaBot",
    AbortStatement = new Statement { Messages = new List {
        new Message {
            Content = "I don't understand. Can you try again?",
            ContentType = "PlainText"
        new Message {
            Content = "I'm sorry, I don't understand.",
            ContentType = "PlainText"
    } },
    ChildDirected = true,
    ClarificationPrompt = new Prompt {
        MaxAttempts = 1,
        Messages = new List {
            new Message {
                Content = "I'm sorry, I didn't hear that. Can you repeate what you just said?",
                ContentType = "PlainText"
            new Message {
                Content = "Can you say that again?",
                ContentType = "PlainText"
    Description = "Orders a pizza from a local pizzeria.",
    IdleSessionTTLInSeconds = 300,
    Intents = new List {
        new Intent {
            IntentName = "DocOrderPizza",
            IntentVersion = "$LATEST"
    Locale = "en-US",
    ProcessBehavior = "SAVE"

string version = response.Version;
string name = response.Name;
Statement abortStatement = response.AbortStatement;
string checksum = response.Checksum;
bool childDirected = response.ChildDirected;
Prompt clarificationPrompt = response.ClarificationPrompt;
DateTime createdDate = response.CreatedDate;
string description = response.Description;
integer idleSessionTTLInSeconds = response.IdleSessionTTLInSeconds;
List intents = response.Intents;
DateTime lastUpdatedDate = response.LastUpdatedDate;
string locale = response.Locale;
string status = response.Status;


Version Information

.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

See Also