SendMessageCommand

Submits a message to the Amazon Q in Connect session.

Example Syntax

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

import { QConnectClient, SendMessageCommand } from "@aws-sdk/client-qconnect"; // ES Modules import
// const { QConnectClient, SendMessageCommand } = require("@aws-sdk/client-qconnect"); // CommonJS import
const client = new QConnectClient(config);
const input = { // SendMessageRequest
  assistantId: "STRING_VALUE", // required
  sessionId: "STRING_VALUE", // required
  type: "STRING_VALUE", // required
  message: { // MessageInput
    value: { // MessageData Union: only one key present
      text: { // TextMessage
        value: "STRING_VALUE",
      },
    },
  },
  conversationContext: { // ConversationContext
    selfServiceConversationHistory: [ // SelfServiceConversationHistoryList // required
      { // SelfServiceConversationHistory
        turnNumber: Number("int"), // required
        inputTranscript: "STRING_VALUE",
        botResponse: "STRING_VALUE",
      },
    ],
  },
  configuration: { // MessageConfiguration
    generateFillerMessage: true || false,
  },
  clientToken: "STRING_VALUE",
};
const command = new SendMessageCommand(input);
const response = await client.send(command);
// { // SendMessageResponse
//   requestMessageId: "STRING_VALUE", // required
//   configuration: { // MessageConfiguration
//     generateFillerMessage: true || false,
//   },
//   nextMessageToken: "STRING_VALUE", // required
// };

SendMessageCommand Input

See SendMessageCommandInput for more details

Parameter
Type
Description
assistantId
Required
string | undefined

The identifier of the Amazon Q in Connect assistant.

message
Required
MessageInput | undefined

The message data to submit to the Amazon Q in Connect session.

sessionId
Required
string | undefined

The identifier of the Amazon Q in Connect session.

type
Required
MessageType | undefined

The message type.

clientToken
string | undefined

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the AWS SDK populates this field.For more information about idempotency, see Making retries safe with idempotent APIs.

configuration
MessageConfiguration | undefined

The configuration of the SendMessage  request.

conversationContext
ConversationContext | undefined

The conversation context before the Amazon Q in Connect session.

SendMessageCommand Output

See SendMessageCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
nextMessageToken
Required
string | undefined

The token for the next message, used by GetNextMessage.

requestMessageId
Required
string | undefined

The identifier of the submitted message.

configuration
MessageConfiguration | undefined

The configuration of the SendMessage  request.

Throws

Name
Fault
Details
AccessDeniedException
client

You do not have sufficient access to perform this action.

ConflictException
client

The request could not be processed because of conflict in the current state of the resource. For example, if you're using a Create API (such as CreateAssistant) that accepts name, a conflicting resource (usually with the same name) is being created or mutated.

RequestTimeoutException
client

The request reached the service more than 15 minutes after the date stamp on the request or more than 15 minutes after the request expiration date (such as for pre-signed URLs), or the date stamp on the request is more than 15 minutes in the future.

ResourceNotFoundException
client

The specified resource does not exist.

ThrottlingException
client

The throttling limit has been exceeded.

ValidationException
client

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

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