Chat - Amazon Q Business

Chat

Starts or continues a streaming Amazon Q Business conversation.

Request Syntax

POST /applications/applicationId/conversations?clientToken=clientToken&conversationId=conversationId&parentMessageId=parentMessageId&userGroups=userGroups&userId=userId HTTP/1.1 Content-type: application/json { "actionExecutionEvent": { "payload": { "string" : { "value": JSON value } }, "payloadFieldNameSeparator": "string", "pluginId": "string" }, "attachmentEvent": { "attachment": { "data": blob, "name": "string" } }, "authChallengeResponseEvent": { "responseMap": { "string" : "string" } }, "configurationEvent": { "attributeFilter": { "andAllFilters": [ "AttributeFilter" ], "containsAll": { "name": "string", "value": { ... } }, "containsAny": { "name": "string", "value": { ... } }, "equalsTo": { "name": "string", "value": { ... } }, "greaterThan": { "name": "string", "value": { ... } }, "greaterThanOrEquals": { "name": "string", "value": { ... } }, "lessThan": { "name": "string", "value": { ... } }, "lessThanOrEquals": { "name": "string", "value": { ... } }, "notFilter": "AttributeFilter", "orAllFilters": [ "AttributeFilter" ] }, "chatMode": "string", "chatModeConfiguration": { ... } }, "endOfInputEvent": { }, "textEvent": { "userMessage": "string" } }

URI Request Parameters

The request uses the following URI parameters.

applicationId

The identifier of the Amazon Q Business application linked to a streaming Amazon Q Business conversation.

Length Constraints: Fixed length of 36.

Pattern: [a-zA-Z0-9][a-zA-Z0-9-]{35}

Required: Yes

clientToken

A token that you provide to identify the chat input.

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

conversationId

The identifier of the Amazon Q Business conversation.

Length Constraints: Fixed length of 36.

Pattern: [a-zA-Z0-9][a-zA-Z0-9-]{35}

parentMessageId

The identifier used to associate a user message with a AI generated response.

Length Constraints: Fixed length of 36.

Pattern: [a-zA-Z0-9][a-zA-Z0-9-]{35}

userGroups

The group names that a user associated with the chat input belongs to.

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

userId

The identifier of the user attached to the chat input.

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

Pattern: \P{C}*

Request Body

The request accepts the following data in JSON format.

actionExecutionEvent

A request from an end user to perform an Amazon Q Business plugin action.

Type: ActionExecutionEvent object

Required: No

attachmentEvent

A request by an end user to upload a file during chat.

Type: AttachmentInputEvent object

Required: No

authChallengeResponseEvent

An authentication verification event response by a third party authentication server to Amazon Q Business.

Type: AuthChallengeResponseEvent object

Required: No

configurationEvent

A configuration event activated by an end user request to select a specific chat mode.

Type: ConfigurationEvent object

Required: No

endOfInputEvent

The end of the streaming input for the Chat API.

Type: EndOfInputEvent object

Required: No

textEvent

Information about the payload of the ChatInputStream event containing the end user message input.

Type: TextInputEvent object

Required: No

Response Syntax

HTTP/1.1 200 Content-type: application/json { "actionReviewEvent": { "conversationId": "string", "payload": { "string" : { "allowedFormat": "string", "allowedValues": [ { "displayValue": JSON value, "value": JSON value } ], "arrayItemJsonSchema": JSON value, "displayDescription": "string", "displayName": "string", "displayOrder": number, "required": boolean, "type": "string", "value": JSON value } }, "payloadFieldNameSeparator": "string", "pluginId": "string", "pluginType": "string", "systemMessageId": "string", "userMessageId": "string" }, "authChallengeRequestEvent": { "authorizationUrl": "string" }, "failedAttachmentEvent": { "attachment": { "error": { "errorCode": "string", "errorMessage": "string" }, "name": "string", "status": "string" }, "conversationId": "string", "systemMessageId": "string", "userMessageId": "string" }, "metadataEvent": { "conversationId": "string", "finalTextMessage": "string", "sourceAttributions": [ { "citationNumber": number, "snippet": "string", "textMessageSegments": [ { "beginOffset": number, "endOffset": number, "snippetExcerpt": { "text": "string" } } ], "title": "string", "updatedAt": number, "url": "string" } ], "systemMessageId": "string", "userMessageId": "string" }, "textEvent": { "conversationId": "string", "systemMessage": "string", "systemMessageId": "string", "userMessageId": "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.

actionReviewEvent

A request from Amazon Q Business to the end user for information Amazon Q Business needs to successfully complete a requested plugin action.

Type: ActionReviewEvent object

authChallengeRequestEvent

An authentication verification event activated by an end user request to use a custom plugin.

Type: AuthChallengeRequestEvent object

failedAttachmentEvent

A failed file upload event during a web experience chat.

Type: FailedAttachmentEvent object

metadataEvent

A metadata event for a AI-generated text output message in a Amazon Q Business conversation.

Type: MetadataEvent object

textEvent

Information about the payload of the ChatOutputStream event containing the AI-generated message output.

Type: TextOutputEvent object

Errors

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

AccessDeniedException

You don't have access to perform this action. Make sure you have the required permission policies and user accounts and try again.

HTTP Status Code: 403

ConflictException

You are trying to perform an action that conflicts with the current status of your resource. Fix any inconsistences with your resources and try again.

HTTP Status Code: 409

InternalServerException

An issue occurred with the internal server used for your Amazon Q Business service. Wait some minutes and try again, or contact Support for help.

HTTP Status Code: 500

LicenseNotFoundException

You don't have permissions to perform the action because your license is inactive. Ask your admin to activate your license and try again after your licence is active.

HTTP Status Code: 400

ResourceNotFoundException

The resource you want to use doesn’t exist. Make sure you have provided the correct resource and try again.

HTTP Status Code: 404

ThrottlingException

The request was denied due to throttling. Reduce the number of requests and try again.

HTTP Status Code: 429

ValidationException

The input doesn't meet the constraints set by the Amazon Q Business service. Provide the correct input and try again.

HTTP Status Code: 400

See Also

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