- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
ChatSyncCommand
Starts or continues a non-streaming Amazon Q Business conversation.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { QBusinessClient, ChatSyncCommand } from "@aws-sdk/client-qbusiness"; // ES Modules import
// const { QBusinessClient, ChatSyncCommand } = require("@aws-sdk/client-qbusiness"); // CommonJS import
const client = new QBusinessClient(config);
const input = { // ChatSyncInput
applicationId: "STRING_VALUE", // required
userId: "STRING_VALUE",
userGroups: [ // UserGroups
"STRING_VALUE",
],
userMessage: "STRING_VALUE",
attachments: [ // AttachmentsInput
{ // AttachmentInput
data: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
name: "STRING_VALUE",
copyFrom: { // CopyFromSource Union: only one key present
conversation: { // ConversationSource
conversationId: "STRING_VALUE", // required
attachmentId: "STRING_VALUE", // required
},
},
},
],
actionExecution: { // ActionExecution
pluginId: "STRING_VALUE", // required
payload: { // ActionExecutionPayload // required
"<keys>": { // ActionExecutionPayloadField
value: "DOCUMENT_VALUE", // required
},
},
payloadFieldNameSeparator: "STRING_VALUE", // required
},
authChallengeResponse: { // AuthChallengeResponse
responseMap: { // AuthorizationResponseMap // required
"<keys>": "STRING_VALUE",
},
},
conversationId: "STRING_VALUE",
parentMessageId: "STRING_VALUE",
attributeFilter: { // AttributeFilter
andAllFilters: [ // AttributeFilters
{
andAllFilters: [
"<AttributeFilter>",
],
orAllFilters: [
"<AttributeFilter>",
],
notFilter: "<AttributeFilter>",
equalsTo: { // DocumentAttribute
name: "STRING_VALUE", // required
value: { // DocumentAttributeValue Union: only one key present
stringValue: "STRING_VALUE",
stringListValue: [ // DocumentAttributeStringListValue
"STRING_VALUE",
],
longValue: Number("long"),
dateValue: new Date("TIMESTAMP"),
},
},
containsAll: {
name: "STRING_VALUE", // required
value: {// Union: only one key present
stringValue: "STRING_VALUE",
stringListValue: [
"STRING_VALUE",
],
longValue: Number("long"),
dateValue: new Date("TIMESTAMP"),
},
},
containsAny: {
name: "STRING_VALUE", // required
value: {// Union: only one key present
stringValue: "STRING_VALUE",
stringListValue: [
"STRING_VALUE",
],
longValue: Number("long"),
dateValue: new Date("TIMESTAMP"),
},
},
greaterThan: {
name: "STRING_VALUE", // required
value: {// Union: only one key present
stringValue: "STRING_VALUE",
stringListValue: [
"STRING_VALUE",
],
longValue: Number("long"),
dateValue: new Date("TIMESTAMP"),
},
},
greaterThanOrEquals: {
name: "STRING_VALUE", // required
value: {// Union: only one key present
stringValue: "STRING_VALUE",
stringListValue: [
"STRING_VALUE",
],
longValue: Number("long"),
dateValue: new Date("TIMESTAMP"),
},
},
lessThan: "<DocumentAttribute>",
lessThanOrEquals: "<DocumentAttribute>",
},
],
orAllFilters: [
"<AttributeFilter>",
],
notFilter: "<AttributeFilter>",
equalsTo: "<DocumentAttribute>",
containsAll: "<DocumentAttribute>",
containsAny: "<DocumentAttribute>",
greaterThan: "<DocumentAttribute>",
greaterThanOrEquals: "<DocumentAttribute>",
lessThan: "<DocumentAttribute>",
lessThanOrEquals: "<DocumentAttribute>",
},
chatMode: "RETRIEVAL_MODE" || "CREATOR_MODE" || "PLUGIN_MODE",
chatModeConfiguration: { // ChatModeConfiguration Union: only one key present
pluginConfiguration: { // PluginConfiguration
pluginId: "STRING_VALUE", // required
},
},
clientToken: "STRING_VALUE",
};
const command = new ChatSyncCommand(input);
const response = await client.send(command);
// { // ChatSyncOutput
// conversationId: "STRING_VALUE",
// systemMessage: "STRING_VALUE",
// systemMessageId: "STRING_VALUE",
// userMessageId: "STRING_VALUE",
// actionReview: { // ActionReview
// pluginId: "STRING_VALUE",
// pluginType: "SERVICE_NOW" || "SALESFORCE" || "JIRA" || "ZENDESK" || "CUSTOM" || "QUICKSIGHT" || "SERVICENOW_NOW_PLATFORM" || "JIRA_CLOUD" || "SALESFORCE_CRM" || "ZENDESK_SUITE" || "ATLASSIAN_CONFLUENCE" || "GOOGLE_CALENDAR" || "MICROSOFT_TEAMS" || "MICROSOFT_EXCHANGE" || "PAGERDUTY_ADVANCE" || "SMARTSHEET" || "ASANA",
// payload: { // ActionReviewPayload
// "<keys>": { // ActionReviewPayloadField
// displayName: "STRING_VALUE",
// displayOrder: Number("int"),
// displayDescription: "STRING_VALUE",
// type: "STRING" || "NUMBER" || "ARRAY" || "BOOLEAN",
// value: "DOCUMENT_VALUE",
// allowedValues: [ // ActionReviewPayloadFieldAllowedValues
// { // ActionReviewPayloadFieldAllowedValue
// value: "DOCUMENT_VALUE",
// displayValue: "DOCUMENT_VALUE",
// },
// ],
// allowedFormat: "STRING_VALUE",
// arrayItemJsonSchema: "DOCUMENT_VALUE",
// required: true || false,
// },
// },
// payloadFieldNameSeparator: "STRING_VALUE",
// },
// authChallengeRequest: { // AuthChallengeRequest
// authorizationUrl: "STRING_VALUE", // required
// },
// sourceAttributions: [ // SourceAttributions
// { // SourceAttribution
// title: "STRING_VALUE",
// snippet: "STRING_VALUE",
// url: "STRING_VALUE",
// citationNumber: Number("int"),
// updatedAt: new Date("TIMESTAMP"),
// textMessageSegments: [ // TextSegmentList
// { // TextSegment
// beginOffset: Number("int"),
// endOffset: Number("int"),
// snippetExcerpt: { // SnippetExcerpt
// text: "STRING_VALUE",
// },
// mediaId: "STRING_VALUE",
// mediaMimeType: "STRING_VALUE",
// sourceDetails: { // SourceDetails Union: only one key present
// imageSourceDetails: { // ImageSourceDetails
// mediaId: "STRING_VALUE",
// mediaMimeType: "STRING_VALUE",
// },
// audioSourceDetails: { // AudioSourceDetails
// mediaId: "STRING_VALUE",
// mediaMimeType: "STRING_VALUE",
// startTimeMilliseconds: Number("long"),
// endTimeMilliseconds: Number("long"),
// audioExtractionType: "TRANSCRIPT" || "SUMMARY",
// },
// videoSourceDetails: { // VideoSourceDetails
// mediaId: "STRING_VALUE",
// mediaMimeType: "STRING_VALUE",
// startTimeMilliseconds: Number("long"),
// endTimeMilliseconds: Number("long"),
// videoExtractionType: "TRANSCRIPT" || "SUMMARY",
// },
// },
// },
// ],
// },
// ],
// failedAttachments: [ // AttachmentsOutput
// { // AttachmentOutput
// name: "STRING_VALUE",
// status: "FAILED" || "SUCCESS",
// error: { // ErrorDetail
// errorMessage: "STRING_VALUE",
// errorCode: "InternalError" || "InvalidRequest" || "ResourceInactive" || "ResourceNotFound",
// },
// attachmentId: "STRING_VALUE",
// conversationId: "STRING_VALUE",
// },
// ],
// };
ChatSyncCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
applicationId Required | string | undefined | The identifier of the Amazon Q Business application linked to the Amazon Q Business conversation. |
actionExecution | ActionExecution | undefined | A request from an end user to perform an Amazon Q Business plugin action. |
attachments | AttachmentInput[] | undefined | A list of files uploaded directly during chat. You can upload a maximum of 5 files of upto 10 MB each. |
attributeFilter | AttributeFilter | undefined | Enables filtering of Amazon Q Business web experience responses based on document attributes or metadata fields. |
authChallengeResponse | AuthChallengeResponse | undefined | An authentication verification event response by a third party authentication server to Amazon Q Business. |
chatMode | ChatMode | undefined | The
If none of the modes are selected, Amazon Q will only respond using the information from the attached files. For more information, see Admin controls and guardrails , Plugins , and Response sources . |
chatModeConfiguration | ChatModeConfiguration | undefined | The chat mode configuration for an Amazon Q Business application. |
clientToken | string | undefined | A token that you provide to identify a chat request. |
conversationId | string | undefined | The identifier of the Amazon Q Business conversation. |
parentMessageId | string | undefined | The identifier of the previous system message in a conversation. |
userGroups | string[] | undefined | The group names that a user associated with the chat input belongs to. |
userId | string | undefined | The identifier of the user attached to the chat input. |
userMessage | string | undefined | A end user message in a conversation. |
ChatSyncCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
actionReview | ActionReview | undefined | A request from Amazon Q Business to the end user for information Amazon Q Business needs to successfully complete a requested plugin action. |
authChallengeRequest | AuthChallengeRequest | undefined | An authentication verification event activated by an end user request to use a custom plugin. |
conversationId | string | undefined | The identifier of the Amazon Q Business conversation. |
failedAttachments | AttachmentOutput[] | undefined | A list of files which failed to upload during chat. |
sourceAttributions | SourceAttribution[] | undefined | The source documents used to generate the conversation response. |
systemMessage | string | undefined | An AI-generated message in a conversation. |
systemMessageId | string | undefined | The identifier of an Amazon Q Business AI generated message within the conversation. |
userMessageId | string | undefined | The identifier of an Amazon Q Business end user text input message within the conversation. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
AccessDeniedException | client | You don't have access to perform this action. Make sure you have the required permission policies and user accounts and try again. |
ConflictException | client | You are trying to perform an action that conflicts with the current status of your resource. Fix any inconsistencies with your resources and try again. |
ExternalResourceException | client | An external resource that you configured with your application is returning errors and preventing this operation from succeeding. Fix those errors and try again. |
InternalServerException | server | 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. |
LicenseNotFoundException | client | 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. |
ResourceNotFoundException | client | The application or plugin resource you want to use doesn’t exist. Make sure you have provided the correct resource and try again. |
ThrottlingException | client | The request was denied due to throttling. Reduce the number of requests and try again. |
ValidationException | client | The input doesn't meet the constraints set by the Amazon Q Business service. Provide the correct input and try again. |
QBusinessServiceException | Base exception class for all service exceptions from QBusiness service. |