ListMessagesCommand

Lists messages on an Amazon Q in Connect session.

Example Syntax

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

import { QConnectClient, ListMessagesCommand } from "@aws-sdk/client-qconnect"; // ES Modules import
// const { QConnectClient, ListMessagesCommand } = require("@aws-sdk/client-qconnect"); // CommonJS import
const client = new QConnectClient(config);
const input = { // ListMessagesRequest
  assistantId: "STRING_VALUE", // required
  sessionId: "STRING_VALUE", // required
  nextToken: "STRING_VALUE",
  maxResults: Number("int"),
};
const command = new ListMessagesCommand(input);
const response = await client.send(command);
// { // ListMessagesResponse
//   messages: [ // MessageList // required
//     { // MessageOutput
//       value: { // MessageData Union: only one key present
//         text: { // TextMessage
//           value: "STRING_VALUE",
//         },
//       },
//       messageId: "STRING_VALUE", // required
//       participant: "STRING_VALUE", // required
//       timestamp: new Date("TIMESTAMP"), // required
//     },
//   ],
//   nextToken: "STRING_VALUE",
// };

ListMessagesCommand Input

See ListMessagesCommandInput for more details

Parameter
Type
Description
assistantId
Required
string | undefined

The identifier of the Amazon Q in Connect assistant.

sessionId
Required
string | undefined

The identifier of the Amazon Q in Connect session.

maxResults
number | undefined

The maximum number of results to return per page.

nextToken
string | undefined

The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

ListMessagesCommand Output

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

The message information.

nextToken
string | undefined

The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

Throws

Name
Fault
Details
AccessDeniedException
client

You do not have sufficient access to perform this action.

ResourceNotFoundException
client

The specified resource does not exist.

ValidationException
client

The input fails to satisfy the constraints specified by a service.

QConnectServiceException
Base exception class for all service exceptions from QConnect service.