ListMessagesCommand

Gets a list of messages associated with an Amazon Q Business web experience.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { QBusinessClient, ListMessagesCommand } from "@aws-sdk/client-qbusiness"; // ES Modules import
// const { QBusinessClient, ListMessagesCommand } = require("@aws-sdk/client-qbusiness"); // CommonJS import
const client = new QBusinessClient(config);
const input = { // ListMessagesRequest
  conversationId: "STRING_VALUE", // required
  applicationId: "STRING_VALUE", // required
  userId: "STRING_VALUE",
  nextToken: "STRING_VALUE",
  maxResults: Number("int"),
};
const command = new ListMessagesCommand(input);
const response = await client.send(command);
// { // ListMessagesResponse
//   messages: [ // Messages
//     { // Message
//       messageId: "STRING_VALUE",
//       body: "STRING_VALUE",
//       time: new Date("TIMESTAMP"),
//       type: "USER" || "SYSTEM",
//       attachments: [ // AttachmentsOutput
//         { // AttachmentOutput
//           name: "STRING_VALUE",
//           status: "FAILED" || "SUCCESS",
//           error: { // ErrorDetail
//             errorMessage: "STRING_VALUE",
//             errorCode: "InternalError" || "InvalidRequest" || "ResourceInactive" || "ResourceNotFound",
//           },
//           attachmentId: "STRING_VALUE",
//           conversationId: "STRING_VALUE",
//         },
//       ],
//       sourceAttribution: [ // 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",
//                 },
//               },
//             },
//           ],
//         },
//       ],
//       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",
//       },
//       actionExecution: { // ActionExecution
//         pluginId: "STRING_VALUE", // required
//         payload: { // ActionExecutionPayload // required
//           "<keys>": { // ActionExecutionPayloadField
//             value: "DOCUMENT_VALUE", // required
//           },
//         },
//         payloadFieldNameSeparator: "STRING_VALUE", // required
//       },
//     },
//   ],
//   nextToken: "STRING_VALUE",
// };

ListMessagesCommand Input

See ListMessagesCommandInput for more details

Parameter
Type
Description
applicationId
Required
string | undefined

The identifier for the Amazon Q Business application.

conversationId
Required
string | undefined

The identifier of the Amazon Q Business web experience conversation.

maxResults
number | undefined

The maximum number of messages to return.

nextToken
string | undefined

If the number of messages returned exceeds maxResults, Amazon Q Business returns a next token as a pagination token to retrieve the next set of messages.

userId
string | undefined

The identifier of the user involved in the Amazon Q Business web experience conversation.

ListMessagesCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
messages
Message[] | undefined

An array of information on one or more messages.

nextToken
string | undefined

If the response is truncated, Amazon Q Business returns this token, which you can use in a later request to list the next set of messages.

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.

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.