CreateSlot - Amazon Lex

CreateSlot

Creates a slot in an intent. A slot is a variable needed to fulfill an intent. For example, an OrderPizza intent might need slots for size, crust, and number of pizzas. For each slot, you define one or more utterances that Amazon Lex uses to elicit a response from the user.

Request Syntax

PUT /bots/botId/botversions/botVersion/botlocales/localeId/intents/intentId/slots/ HTTP/1.1 Content-type: application/json { "description": "string", "multipleValuesSetting": { "allowMultipleValues": boolean }, "obfuscationSetting": { "obfuscationSettingType": "string" }, "slotName": "string", "slotTypeId": "string", "valueElicitationSetting": { "defaultValueSpecification": { "defaultValueList": [ { "defaultValue": "string" } ] }, "promptSpecification": { "allowInterrupt": boolean, "maxRetries": number, "messageGroups": [ { "message": { "customPayload": { "value": "string" }, "imageResponseCard": { "buttons": [ { "text": "string", "value": "string" } ], "imageUrl": "string", "subtitle": "string", "title": "string" }, "plainTextMessage": { "value": "string" }, "ssmlMessage": { "value": "string" } }, "variations": [ { "customPayload": { "value": "string" }, "imageResponseCard": { "buttons": [ { "text": "string", "value": "string" } ], "imageUrl": "string", "subtitle": "string", "title": "string" }, "plainTextMessage": { "value": "string" }, "ssmlMessage": { "value": "string" } } ] } ] }, "sampleUtterances": [ { "utterance": "string" } ], "slotConstraint": "string", "waitAndContinueSpecification": { "active": boolean, "continueResponse": { "allowInterrupt": boolean, "messageGroups": [ { "message": { "customPayload": { "value": "string" }, "imageResponseCard": { "buttons": [ { "text": "string", "value": "string" } ], "imageUrl": "string", "subtitle": "string", "title": "string" }, "plainTextMessage": { "value": "string" }, "ssmlMessage": { "value": "string" } }, "variations": [ { "customPayload": { "value": "string" }, "imageResponseCard": { "buttons": [ { "text": "string", "value": "string" } ], "imageUrl": "string", "subtitle": "string", "title": "string" }, "plainTextMessage": { "value": "string" }, "ssmlMessage": { "value": "string" } } ] } ] }, "stillWaitingResponse": { "allowInterrupt": boolean, "frequencyInSeconds": number, "messageGroups": [ { "message": { "customPayload": { "value": "string" }, "imageResponseCard": { "buttons": [ { "text": "string", "value": "string" } ], "imageUrl": "string", "subtitle": "string", "title": "string" }, "plainTextMessage": { "value": "string" }, "ssmlMessage": { "value": "string" } }, "variations": [ { "customPayload": { "value": "string" }, "imageResponseCard": { "buttons": [ { "text": "string", "value": "string" } ], "imageUrl": "string", "subtitle": "string", "title": "string" }, "plainTextMessage": { "value": "string" }, "ssmlMessage": { "value": "string" } } ] } ], "timeoutInSeconds": number }, "waitingResponse": { "allowInterrupt": boolean, "messageGroups": [ { "message": { "customPayload": { "value": "string" }, "imageResponseCard": { "buttons": [ { "text": "string", "value": "string" } ], "imageUrl": "string", "subtitle": "string", "title": "string" }, "plainTextMessage": { "value": "string" }, "ssmlMessage": { "value": "string" } }, "variations": [ { "customPayload": { "value": "string" }, "imageResponseCard": { "buttons": [ { "text": "string", "value": "string" } ], "imageUrl": "string", "subtitle": "string", "title": "string" }, "plainTextMessage": { "value": "string" }, "ssmlMessage": { "value": "string" } } ] } ] } } } }

URI Request Parameters

The request uses the following URI parameters.

botId

The identifier of the bot associated with the slot.

Length Constraints: Fixed length of 10.

Pattern: ^[0-9a-zA-Z]+$

Required: Yes

botVersion

The version of the bot associated with the slot.

Length Constraints: Fixed length of 5.

Pattern: ^DRAFT$

Required: Yes

intentId

The identifier of the intent that contains the slot.

Length Constraints: Fixed length of 10.

Pattern: ^[0-9a-zA-Z]+$

Required: Yes

localeId

The identifier of the language and locale that the slot will be used in. The string must match one of the supported locales. All of the bots, intents, slot types used by the slot must have the same locale. For more information, see Supported languages.

Required: Yes

Request Body

The request accepts the following data in JSON format.

description

A description of the slot. Use this to help identify the slot in lists.

Type: String

Length Constraints: Minimum length of 0. Maximum length of 200.

Required: No

multipleValuesSetting

Indicates whether the slot returns multiple values in one response. Multi-value slots are only available in the en-US locale. If you set this value to true in any other locale, Amazon Lex throws a ValidationException.

If the multipleValuesSetting is not set, the default value is false.

Type: MultipleValuesSetting object

Required: No

obfuscationSetting

Determines how slot values are used in Amazon CloudWatch logs. If the value of the obfuscationSetting parameter is DefaultObfuscation, slot values are obfuscated in the log output. If the value is None, the actual value is present in the log output.

The default is to obfuscate values in the CloudWatch logs.

Type: ObfuscationSetting object

Required: No

slotName

The name of the slot. Slot names must be unique within the bot that contains the slot.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 100.

Pattern: ^([0-9a-zA-Z][_-]?)+$

Required: Yes

slotTypeId

The unique identifier for the slot type associated with this slot. The slot type determines the values that can be entered into the slot.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 25.

Pattern: ^((AMAZON\.)[a-zA-Z_]+?|[0-9a-zA-Z]+)$

Required: Yes

valueElicitationSetting

Specifies prompts that Amazon Lex sends to the user to elicit a response that provides the value for the slot.

Type: SlotValueElicitationSetting object

Required: Yes

Response Syntax

HTTP/1.1 200 Content-type: application/json { "botId": "string", "botVersion": "string", "creationDateTime": number, "description": "string", "intentId": "string", "localeId": "string", "multipleValuesSetting": { "allowMultipleValues": boolean }, "obfuscationSetting": { "obfuscationSettingType": "string" }, "slotId": "string", "slotName": "string", "slotTypeId": "string", "valueElicitationSetting": { "defaultValueSpecification": { "defaultValueList": [ { "defaultValue": "string" } ] }, "promptSpecification": { "allowInterrupt": boolean, "maxRetries": number, "messageGroups": [ { "message": { "customPayload": { "value": "string" }, "imageResponseCard": { "buttons": [ { "text": "string", "value": "string" } ], "imageUrl": "string", "subtitle": "string", "title": "string" }, "plainTextMessage": { "value": "string" }, "ssmlMessage": { "value": "string" } }, "variations": [ { "customPayload": { "value": "string" }, "imageResponseCard": { "buttons": [ { "text": "string", "value": "string" } ], "imageUrl": "string", "subtitle": "string", "title": "string" }, "plainTextMessage": { "value": "string" }, "ssmlMessage": { "value": "string" } } ] } ] }, "sampleUtterances": [ { "utterance": "string" } ], "slotConstraint": "string", "waitAndContinueSpecification": { "active": boolean, "continueResponse": { "allowInterrupt": boolean, "messageGroups": [ { "message": { "customPayload": { "value": "string" }, "imageResponseCard": { "buttons": [ { "text": "string", "value": "string" } ], "imageUrl": "string", "subtitle": "string", "title": "string" }, "plainTextMessage": { "value": "string" }, "ssmlMessage": { "value": "string" } }, "variations": [ { "customPayload": { "value": "string" }, "imageResponseCard": { "buttons": [ { "text": "string", "value": "string" } ], "imageUrl": "string", "subtitle": "string", "title": "string" }, "plainTextMessage": { "value": "string" }, "ssmlMessage": { "value": "string" } } ] } ] }, "stillWaitingResponse": { "allowInterrupt": boolean, "frequencyInSeconds": number, "messageGroups": [ { "message": { "customPayload": { "value": "string" }, "imageResponseCard": { "buttons": [ { "text": "string", "value": "string" } ], "imageUrl": "string", "subtitle": "string", "title": "string" }, "plainTextMessage": { "value": "string" }, "ssmlMessage": { "value": "string" } }, "variations": [ { "customPayload": { "value": "string" }, "imageResponseCard": { "buttons": [ { "text": "string", "value": "string" } ], "imageUrl": "string", "subtitle": "string", "title": "string" }, "plainTextMessage": { "value": "string" }, "ssmlMessage": { "value": "string" } } ] } ], "timeoutInSeconds": number }, "waitingResponse": { "allowInterrupt": boolean, "messageGroups": [ { "message": { "customPayload": { "value": "string" }, "imageResponseCard": { "buttons": [ { "text": "string", "value": "string" } ], "imageUrl": "string", "subtitle": "string", "title": "string" }, "plainTextMessage": { "value": "string" }, "ssmlMessage": { "value": "string" } }, "variations": [ { "customPayload": { "value": "string" }, "imageResponseCard": { "buttons": [ { "text": "string", "value": "string" } ], "imageUrl": "string", "subtitle": "string", "title": "string" }, "plainTextMessage": { "value": "string" }, "ssmlMessage": { "value": "string" } } ] } ] } } } }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

botId

The unique identifier of the bot associated with the slot.

Type: String

Length Constraints: Fixed length of 10.

Pattern: ^[0-9a-zA-Z]+$

botVersion

The version of the bot associated with the slot.

Type: String

Length Constraints: Fixed length of 5.

Pattern: ^DRAFT$

creationDateTime

The timestamp of the date and time that the slot was created.

Type: Timestamp

description

The description associated with the slot.

Type: String

Length Constraints: Minimum length of 0. Maximum length of 200.

intentId

The unique identifier of the intent associated with the slot.

Type: String

Length Constraints: Fixed length of 10.

Pattern: ^[0-9a-zA-Z]+$

localeId

The language and local specified for the slot.

Type: String

multipleValuesSetting

Indicates whether the slot returns multiple values in one response.

Type: MultipleValuesSetting object

obfuscationSetting

Indicates whether the slot is configured to obfuscate values in Amazon CloudWatch logs.

Type: ObfuscationSetting object

slotId

The unique identifier associated with the slot. Use this to identify the slot when you update or delete it.

Type: String

Length Constraints: Fixed length of 10.

Pattern: ^[0-9a-zA-Z]+$

slotName

The name specified for the slot.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 100.

Pattern: ^([0-9a-zA-Z][_-]?)+$

slotTypeId

The unique identifier of the slot type associated with this slot.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 25.

Pattern: ^((AMAZON\.)[a-zA-Z_]+?|[0-9a-zA-Z]+)$

valueElicitationSetting

The value elicitation settings specified for the slot.

Type: SlotValueElicitationSetting object

Errors

For information about the errors that are common to all actions, see Common Errors.

ConflictException

HTTP Status Code: 409

InternalServerException

HTTP Status Code: 500

PreconditionFailedException

HTTP Status Code: 412

ServiceQuotaExceededException

HTTP Status Code: 402

ThrottlingException

HTTP Status Code: 429

ValidationException

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: