Amazon Q Connect

2026/02/16 - Amazon Q Connect - 2 updated api methods

Changes  Update MessageType enum to include missing types.

GetNextMessage (updated) Link ¶
Changes (response)
{'type': {'TOOL_USE_RESULT'}}

Retrieves next message on an Amazon Q in Connect session.

See also: AWS API Documentation

Request Syntax

client.get_next_message(
    assistantId='string',
    sessionId='string',
    nextMessageToken='string'
)
type assistantId:

string

param assistantId:

[REQUIRED]

The identifier of the Amazon Q in Connect assistant.

type sessionId:

string

param sessionId:

[REQUIRED]

The identifier of the Amazon Q in Connect session.

type nextMessageToken:

string

param nextMessageToken:

[REQUIRED]

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.

rtype:

dict

returns:

Response Syntax

{
    'type': 'TEXT'|'TOOL_USE_RESULT',
    'response': {
        'value': {
            'text': {
                'value': 'string',
                'citations': [
                    {
                        'contentId': 'string',
                        'title': 'string',
                        'knowledgeBaseId': 'string',
                        'citationSpan': {
                            'beginOffsetInclusive': 123,
                            'endOffsetExclusive': 123
                        },
                        'sourceURL': 'string',
                        'referenceType': 'WEB_CRAWLER'|'KNOWLEDGE_BASE'|'BEDROCK_KB_S3'|'BEDROCK_KB_WEB'|'BEDROCK_KB_CONFLUENCE'|'BEDROCK_KB_SALESFORCE'|'BEDROCK_KB_SHAREPOINT'|'BEDROCK_KB_KENDRA'|'BEDROCK_KB_CUSTOM_DOCUMENT'|'BEDROCK_KB_SQL'
                    },
                ],
                'aiGuardrailAssessment': {
                    'blocked': True|False
                }
            },
            'toolUseResult': {
                'toolUseId': 'string',
                'toolName': 'string',
                'toolResult': {...}|[...]|123|123.4|'string'|True|None,
                'inputSchema': {...}|[...]|123|123.4|'string'|True|None
            }
        },
        'messageId': 'string',
        'participant': 'CUSTOMER'|'AGENT'|'BOT',
        'timestamp': datetime(2015, 1, 1)
    },
    'requestMessageId': 'string',
    'conversationState': {
        'status': 'CLOSED'|'READY'|'PROCESSING',
        'reason': 'SUCCESS'|'FAILED'|'REJECTED'
    },
    'nextMessageToken': 'string',
    'conversationSessionData': [
        {
            'key': 'string',
            'value': {
                'stringValue': 'string'
            }
        },
    ],
    'chunkedResponseTerminated': True|False
}

Response Structure

  • (dict) --

    • type (string) --

      The type of message response.

    • response (dict) --

      The message response to the requested message.

      • value (dict) --

        The value of a message data.

        • text (dict) --

          The message data in text type.

          • value (string) --

            The value of the message data in text type.

          • citations (list) --

            The citations associated with the text message.

            • (dict) --

              A citation that references source content.

              • contentId (string) --

                The identifier of the content being cited.

              • title (string) --

                The title of the cited content.

              • knowledgeBaseId (string) --

                The identifier of the knowledge base containing the cited content.

              • citationSpan (dict) --

                Contains information about where the text with a citation begins and ends in the generated output.

                • beginOffsetInclusive (integer) --

                  Where the text with a citation starts in the generated output.

                • endOffsetExclusive (integer) --

                  Where the text with a citation ends in the generated output.

              • sourceURL (string) --

                The source URL for the citation.

              • referenceType (string) --

                A type to define the KB origin of a cited content

          • aiGuardrailAssessment (dict) --

            The AI Guardrail assessment for the text message.

            • blocked (boolean) --

              Indicates whether the AI Guardrail blocked the content.

        • toolUseResult (dict) --

          The result of tool usage in the message.

          • toolUseId (string) --

            The identifier of the tool use instance.

          • toolName (string) --

            The name of the tool that was used.

          • toolResult (:ref:`document<document>`) --

            The result of the tool usage.

          • inputSchema (:ref:`document<document>`) --

            The input schema for the tool use result.

      • messageId (string) --

        The identifier of a message.

      • participant (string) --

        The participant of a message.

      • timestamp (datetime) --

        The timestamp of a message.

    • requestMessageId (string) --

      The identifier of the submitted message.

    • conversationState (dict) --

      The state of current conversation.

      • status (string) --

        The status of the conversation state.

      • reason (string) --

        The reason of the conversation state.

    • nextMessageToken (string) --

      The token for the next message.

    • conversationSessionData (list) --

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

      • (dict) --

        The list of key-value pairs that are stored on the session.

        • key (string) --

          The key of the data stored on the session.

        • value (dict) --

          The value of the data stored on the session.

          • stringValue (string) --

            The string value of the data stored on the session.

    • chunkedResponseTerminated (boolean) --

      Indicates whether the chunked response has been terminated.

SendMessage (updated) Link ¶
Changes (request)
{'type': {'TOOL_USE_RESULT'}}

Submits a message to the Amazon Q in Connect session.

See also: AWS API Documentation

Request Syntax

client.send_message(
    assistantId='string',
    sessionId='string',
    type='TEXT'|'TOOL_USE_RESULT',
    message={
        'value': {
            'text': {
                'value': 'string',
                'citations': [
                    {
                        'contentId': 'string',
                        'title': 'string',
                        'knowledgeBaseId': 'string',
                        'citationSpan': {
                            'beginOffsetInclusive': 123,
                            'endOffsetExclusive': 123
                        },
                        'sourceURL': 'string',
                        'referenceType': 'WEB_CRAWLER'|'KNOWLEDGE_BASE'|'BEDROCK_KB_S3'|'BEDROCK_KB_WEB'|'BEDROCK_KB_CONFLUENCE'|'BEDROCK_KB_SALESFORCE'|'BEDROCK_KB_SHAREPOINT'|'BEDROCK_KB_KENDRA'|'BEDROCK_KB_CUSTOM_DOCUMENT'|'BEDROCK_KB_SQL'
                    },
                ],
                'aiGuardrailAssessment': {
                    'blocked': True|False
                }
            },
            'toolUseResult': {
                'toolUseId': 'string',
                'toolName': 'string',
                'toolResult': {...}|[...]|123|123.4|'string'|True|None,
                'inputSchema': {...}|[...]|123|123.4|'string'|True|None
            }
        }
    },
    aiAgentId='string',
    conversationContext={
        'selfServiceConversationHistory': [
            {
                'turnNumber': 123,
                'inputTranscript': 'string',
                'botResponse': 'string',
                'timestamp': datetime(2015, 1, 1)
            },
        ]
    },
    configuration={
        'generateFillerMessage': True|False,
        'generateChunkedMessage': True|False
    },
    clientToken='string',
    orchestratorUseCase='string',
    metadata={
        'string': 'string'
    }
)
type assistantId:

string

param assistantId:

[REQUIRED]

The identifier of the Amazon Q in Connect assistant.

type sessionId:

string

param sessionId:

[REQUIRED]

The identifier of the Amazon Q in Connect session.

type type:

string

param type:

[REQUIRED]

The message type.

type message:

dict

param message:

[REQUIRED]

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

  • value (dict) -- [REQUIRED]

    The message input value.

    • text (dict) --

      The message data in text type.

      • value (string) --

        The value of the message data in text type.

      • citations (list) --

        The citations associated with the text message.

        • (dict) --

          A citation that references source content.

          • contentId (string) --

            The identifier of the content being cited.

          • title (string) --

            The title of the cited content.

          • knowledgeBaseId (string) --

            The identifier of the knowledge base containing the cited content.

          • citationSpan (dict) -- [REQUIRED]

            Contains information about where the text with a citation begins and ends in the generated output.

            • beginOffsetInclusive (integer) --

              Where the text with a citation starts in the generated output.

            • endOffsetExclusive (integer) --

              Where the text with a citation ends in the generated output.

          • sourceURL (string) --

            The source URL for the citation.

          • referenceType (string) -- [REQUIRED]

            A type to define the KB origin of a cited content

      • aiGuardrailAssessment (dict) --

        The AI Guardrail assessment for the text message.

        • blocked (boolean) -- [REQUIRED]

          Indicates whether the AI Guardrail blocked the content.

    • toolUseResult (dict) --

      The result of tool usage in the message.

      • toolUseId (string) -- [REQUIRED]

        The identifier of the tool use instance.

      • toolName (string) -- [REQUIRED]

        The name of the tool that was used.

      • toolResult (:ref:`document<document>`) -- [REQUIRED]

        The result of the tool usage.

      • inputSchema (:ref:`document<document>`) --

        The input schema for the tool use result.

type aiAgentId:

string

param aiAgentId:

The identifier of the AI Agent to use for processing the message.

type conversationContext:

dict

param conversationContext:

The conversation context before the Amazon Q in Connect session.

  • selfServiceConversationHistory (list) -- [REQUIRED]

    The self service conversation history before the Amazon Q in Connect session.

    • (dict) --

      The conversation history data to included in conversation context data before the Amazon Q in Connect session.

      • turnNumber (integer) --

        The number of turn of the conversation history data.

      • inputTranscript (string) --

        The input transcript of the conversation history data.

      • botResponse (string) --

        The bot response of the conversation history data.

      • timestamp (datetime) --

        The timestamp of the conversation history entry.

type configuration:

dict

param configuration:

The configuration of the SendMessage request.

  • generateFillerMessage (boolean) --

    Generates a filler response when tool selection is QUESTION.

  • generateChunkedMessage (boolean) --

    Configuration for generating chunked messages.

type clientToken:

string

param clientToken:

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.

This field is autopopulated if not provided.

type orchestratorUseCase:

string

param orchestratorUseCase:

The orchestrator use case for message processing.

type metadata:

dict

param metadata:

Additional metadata for the message.

  • (string) --

    • (string) --

rtype:

dict

returns:

Response Syntax

{
    'requestMessageId': 'string',
    'configuration': {
        'generateFillerMessage': True|False,
        'generateChunkedMessage': True|False
    },
    'nextMessageToken': 'string'
}

Response Structure

  • (dict) --

    • requestMessageId (string) --

      The identifier of the submitted message.

    • configuration (dict) --

      The configuration of the SendMessage request.

      • generateFillerMessage (boolean) --

        Generates a filler response when tool selection is QUESTION.

      • generateChunkedMessage (boolean) --

        Configuration for generating chunked messages.

    • nextMessageToken (string) --

      The token for the next message, used by GetNextMessage.