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

See ChatSyncCommandInput for more details

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 chatMode parameter determines the chat modes available to Amazon Q Business users:

  • RETRIEVAL_MODE - If you choose this mode, Amazon Q generates responses solely from the data sources connected and indexed by the application. If an answer is not found in the data sources or there are no data sources available, Amazon Q will respond with a "No Answer Found" message, unless LLM knowledge has been enabled. In that case, Amazon Q will generate a response from the LLM knowledge

  • CREATOR_MODE - By selecting this mode, you can choose to generate responses only from the LLM knowledge. You can also attach files and have Amazon Q generate a response based on the data in those files. If the attached files do not contain an answer for the query, Amazon Q will automatically fall back to generating a response from the LLM knowledge.

  • PLUGIN_MODE - By selecting this mode, users can choose to use plugins in chat to get their responses.

If none of the modes are selected, Amazon Q will only respond using the information from the attached files.

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

See ChatSyncCommandOutput for details

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
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.