쿠키 기본 설정 선택

당사는 사이트와 서비스를 제공하는 데 필요한 필수 쿠키 및 유사한 도구를 사용합니다. 고객이 사이트를 어떻게 사용하는지 파악하고 개선할 수 있도록 성능 쿠키를 사용해 익명의 통계를 수집합니다. 필수 쿠키는 비활성화할 수 없지만 '사용자 지정' 또는 ‘거부’를 클릭하여 성능 쿠키를 거부할 수 있습니다.

사용자가 동의하는 경우 AWS와 승인된 제3자도 쿠키를 사용하여 유용한 사이트 기능을 제공하고, 사용자의 기본 설정을 기억하고, 관련 광고를 비롯한 관련 콘텐츠를 표시합니다. 필수가 아닌 모든 쿠키를 수락하거나 거부하려면 ‘수락’ 또는 ‘거부’를 클릭하세요. 더 자세한 내용을 선택하려면 ‘사용자 정의’를 클릭하세요.

StartConversation

포커스 모드
StartConversation - Amazon Lex API Reference
이 페이지는 귀하의 언어로 번역되지 않았습니다. 번역 요청

Starts an HTTP/2 bidirectional event stream that enables you to send audio, text, or DTMF input in real time. After your application starts a conversation, users send input to Amazon Lex V2 as a stream of events. Amazon Lex V2 processes the incoming events and responds with streaming text or audio events.

Audio input must be in the following format: audio/lpcm sample-rate=8000 sample-size-bits=16 channel-count=1; is-big-endian=false.

If the optional post-fulfillment response is specified, the messages are returned as follows. For more information, see PostFulfillmentStatusSpecification.

  • Success message - Returned if the Lambda function completes successfully and the intent state is fulfilled or ready fulfillment if the message is present.

  • Failed message - The failed message is returned if the Lambda function throws an exception or if the Lambda function returns a failed intent state without a message.

  • Timeout message - If you don't configure a timeout message and a timeout, and the Lambda function doesn't return within 30 seconds, the timeout message is returned. If you configure a timeout, the timeout message is returned when the period times out.

For more information, see Completion message.

If the optional update message is configured, it is played at the specified frequency while the Lambda function is running and the update message state is active. If the fulfillment update message is not active, the Lambda function runs with a 30 second timeout.

For more information, see Update message

The StartConversation operation is supported only in the following SDKs:

Request Syntax

POST /bots/botId/botAliases/botAliasId/botLocales/localeId/sessions/sessionId/conversation HTTP/1.1 x-amz-lex-conversation-mode: conversationMode Content-type: application/json { "AudioInputEvent": { "audioChunk": blob, "clientTimestampMillis": number, "contentType": "string", "eventId": "string" }, "ConfigurationEvent": { "clientTimestampMillis": number, "disablePlayback": boolean, "eventId": "string", "requestAttributes": { "string" : "string" }, "responseContentType": "string", "sessionState": { "activeContexts": [ { "contextAttributes": { "string" : "string" }, "name": "string", "timeToLive": { "timeToLiveInSeconds": number, "turnsToLive": number } } ], "dialogAction": { "slotElicitationStyle": "string", "slotToElicit": "string", "subSlotToElicit": { "name": "string", "subSlotToElicit": "ElicitSubSlot" }, "type": "string" }, "intent": { "confirmationState": "string", "name": "string", "slots": { "string" : { "shape": "string", "subSlots": { "string" : "Slot" }, "value": { "interpretedValue": "string", "originalValue": "string", "resolvedValues": [ "string" ] }, "values": [ "Slot" ] } }, "state": "string" }, "originatingRequestId": "string", "runtimeHints": { "slotHints": { "string" : { "string" : { "runtimeHintValues": [ { "phrase": "string" } ], "subSlotHints": { "string" : "RuntimeHintDetails" } } } } }, "sessionAttributes": { "string" : "string" } }, "welcomeMessages": [ { "content": "string", "contentType": "string", "imageResponseCard": { "buttons": [ { "text": "string", "value": "string" } ], "imageUrl": "string", "subtitle": "string", "title": "string" } } ] }, "DisconnectionEvent": { "clientTimestampMillis": number, "eventId": "string" }, "DTMFInputEvent": { "clientTimestampMillis": number, "eventId": "string", "inputCharacter": "string" }, "PlaybackCompletionEvent": { "clientTimestampMillis": number, "eventId": "string" }, "TextInputEvent": { "clientTimestampMillis": number, "eventId": "string", "text": "string" } }

URI Request Parameters

The request uses the following URI parameters.

botAliasId

The alias identifier in use for the bot that processes the request.

Required: Yes

botId

The identifier of the bot to process the request.

Length Constraints: Fixed length of 10.

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

Required: Yes

conversationMode

The conversation type that you are using the Amazon Lex V2. If the conversation mode is AUDIO you can send both audio and DTMF information. If the mode is TEXT you can only send text.

Valid Values: AUDIO | TEXT

localeId

The locale where the session is in use.

Length Constraints: Minimum length of 1.

Required: Yes

sessionId

The identifier of the user session that is having the conversation.

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

Pattern: [0-9a-zA-Z._:-]+

Required: Yes

Request Body

The request accepts the following data in JSON format.

AudioInputEvent

Speech audio sent from your client application to Amazon Lex V2. Audio starts accumulating when Amazon Lex V2 identifies a voice and continues until a natural pause in the speech is found before processing.

Type: AudioInputEvent object

Required: No

ConfigurationEvent

Configuration information sent from your client application to Amazon Lex V2

Type: ConfigurationEvent object

Required: No

DisconnectionEvent

Event sent from the client application to indicate to Amazon Lex V2 that the conversation is over.

Type: DisconnectionEvent object

Required: No

DTMFInputEvent

DTMF information sent to Amazon Lex V2 by your application. Amazon Lex V2 accumulates the DMTF information from when the user sends the first character and ends

  • when there's a pause longer that the value configured for the end timeout.

  • when there's a digit that is the configured end character.

  • when Amazon Lex V2 accumulates characters equal to the maximum DTMF character configuration.

Type: DTMFInputEvent object

Required: No

PlaybackCompletionEvent

Event sent from the client application to Amazon Lex V2 to indicate that it has finished playing audio and that Amazon Lex V2 should start listening for user input.

Type: PlaybackCompletionEvent object

Required: No

TextInputEvent

Text sent from your client application to Amazon Lex V2. Each TextInputEvent is processed individually.

Type: TextInputEvent object

Required: No

Response Syntax

HTTP/1.1 200 Content-type: application/json { "AccessDeniedException": { }, "AudioResponseEvent": { "audioChunk": blob, "contentType": "string", "eventId": "string" }, "BadGatewayException": { }, "ConflictException": { }, "DependencyFailedException": { }, "HeartbeatEvent": { "eventId": "string" }, "IntentResultEvent": { "eventId": "string", "inputMode": "string", "interpretations": [ { "intent": { "confirmationState": "string", "name": "string", "slots": { "string" : { "shape": "string", "subSlots": { "string" : "Slot" }, "value": { "interpretedValue": "string", "originalValue": "string", "resolvedValues": [ "string" ] }, "values": [ "Slot" ] } }, "state": "string" }, "interpretationSource": "string", "nluConfidence": { "score": number }, "sentimentResponse": { "sentiment": "string", "sentimentScore": { "mixed": number, "negative": number, "neutral": number, "positive": number } } } ], "recognizedBotMember": { "botId": "string", "botName": "string" }, "requestAttributes": { "string" : "string" }, "sessionId": "string", "sessionState": { "activeContexts": [ { "contextAttributes": { "string" : "string" }, "name": "string", "timeToLive": { "timeToLiveInSeconds": number, "turnsToLive": number } } ], "dialogAction": { "slotElicitationStyle": "string", "slotToElicit": "string", "subSlotToElicit": { "name": "string", "subSlotToElicit": "ElicitSubSlot" }, "type": "string" }, "intent": { "confirmationState": "string", "name": "string", "slots": { "string" : { "shape": "string", "subSlots": { "string" : "Slot" }, "value": { "interpretedValue": "string", "originalValue": "string", "resolvedValues": [ "string" ] }, "values": [ "Slot" ] } }, "state": "string" }, "originatingRequestId": "string", "runtimeHints": { "slotHints": { "string" : { "string" : { "runtimeHintValues": [ { "phrase": "string" } ], "subSlotHints": { "string" : "RuntimeHintDetails" } } } } }, "sessionAttributes": { "string" : "string" } } }, "InternalServerException": { }, "PlaybackInterruptionEvent": { "causedByEventId": "string", "eventId": "string", "eventReason": "string" }, "ResourceNotFoundException": { }, "TextResponseEvent": { "eventId": "string", "messages": [ { "content": "string", "contentType": "string", "imageResponseCard": { "buttons": [ { "text": "string", "value": "string" } ], "imageUrl": "string", "subtitle": "string", "title": "string" } } ] }, "ThrottlingException": { }, "TranscriptEvent": { "eventId": "string", "transcript": "string" }, "ValidationException": { } }

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.

AccessDeniedException

Exception thrown when the credentials passed with the request are invalid or expired. Also thrown when the credentials in the request do not have permission to access the StartConversation operation.

Type: Exception

HTTP Status Code: 403
AudioResponseEvent

An event sent from Amazon Lex V2 to your client application containing audio to play to the user.

Type: AudioResponseEvent object

BadGatewayException

Type: Exception

HTTP Status Code: 502
ConflictException

Exception thrown when two clients are using the same AWS account, Amazon Lex V2 bot, and session ID.

Type: Exception

HTTP Status Code: 409
DependencyFailedException

Type: Exception

HTTP Status Code: 424
HeartbeatEvent

Event that Amazon Lex V2 sends to indicate that the stream is still open between the client application and Amazon Lex V2

Type: HeartbeatEvent object

IntentResultEvent

Event sent from Amazon Lex V2 to the client application containing the current state of the conversation between the user and Amazon Lex V2.

Type: IntentResultEvent object

InternalServerException

An error occurred with Amazon Lex V2.

Type: Exception

HTTP Status Code: 500
PlaybackInterruptionEvent

Event sent from Amazon Lex V2 to indicate to the client application should stop playback of audio. For example, if the client is playing a prompt that asks for the user's telephone number, the user might start to say the phone number before the prompt is complete. Amazon Lex V2 sends this event to the client application to indicate that the user is responding and that Amazon Lex V2 is processing their input.

Type: PlaybackInterruptionEvent object

ResourceNotFoundException

Exception thrown if one of the input parameters points to a resource that does not exist. For example, if the bot ID specified does not exist.

Type: Exception

HTTP Status Code: 404
TextResponseEvent

The event sent from Amazon Lex V2 to your application with text to present to the user.

Type: TextResponseEvent object

ThrottlingException

Exception thrown when your application exceeds the maximum number of concurrent requests.

Type: Exception

HTTP Status Code: 429
TranscriptEvent

Event sent from Amazon Lex V2 to your client application that contains a transcript of voice audio.

Type: TranscriptEvent object

ValidationException

Exception thrown when one or more parameters could not be validated. The message contains the name of the field that isn't valid.

Type: Exception

HTTP Status Code: 400

Errors

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

AccessDeniedException

HTTP Status Code: 403

InternalServerException

HTTP Status Code: 500

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:

이 페이지에서

프라이버시사이트 이용 약관쿠키 기본 설정
© 2025, Amazon Web Services, Inc. 또는 계열사. All rights reserved.