GetNextMessageCommand

Retrieves next message 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, GetNextMessageCommand } from "@aws-sdk/client-qconnect"; // ES Modules import
// const { QConnectClient, GetNextMessageCommand } = require("@aws-sdk/client-qconnect"); // CommonJS import
const client = new QConnectClient(config);
const input = { // GetNextMessageRequest
  assistantId: "STRING_VALUE", // required
  sessionId: "STRING_VALUE", // required
  nextMessageToken: "STRING_VALUE", // required
};
const command = new GetNextMessageCommand(input);
const response = await client.send(command);
// { // GetNextMessageResponse
//   type: "STRING_VALUE", // required
//   response: { // 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
//   },
//   requestMessageId: "STRING_VALUE", // required
//   conversationState: { // ConversationState
//     status: "STRING_VALUE", // required
//     reason: "STRING_VALUE",
//   },
//   nextMessageToken: "STRING_VALUE",
//   conversationSessionData: [ // RuntimeSessionDataList
//     { // RuntimeSessionData
//       key: "STRING_VALUE", // required
//       value: { // RuntimeSessionDataValue Union: only one key present
//         stringValue: "STRING_VALUE",
//       },
//     },
//   ],
// };

GetNextMessageCommand Input

See GetNextMessageCommandInput for more details

Parameter
Type
Description
assistantId
Required
string | undefined

The identifier of the Amazon Q in Connect assistant.

nextMessageToken
Required
string | undefined

The token for the next message. Use the value returned in the SendMessage or previous response in the next request to retrieve the next message.

sessionId
Required
string | undefined

The identifier of the Amazon Q in Connect session.

GetNextMessageCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
conversationState
Required
ConversationState | undefined

The state of current conversation.

requestMessageId
Required
string | undefined

The identifier of the submitted message.

response
Required
MessageOutput | undefined

The message response to the requested message.

type
Required
MessageType | undefined

The type of message response.

conversationSessionData
RuntimeSessionData[] | undefined

The conversation data stored on an Amazon Q in Connect Session.

nextMessageToken
string | undefined

The token for the next message.

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.