QBusiness / Client / list_messages

list_messages#

QBusiness.Client.list_messages(**kwargs)#

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

See also: AWS API Documentation

Request Syntax

response = client.list_messages(
    conversationId='string',
    applicationId='string',
    userId='string',
    nextToken='string',
    maxResults=123
)
Parameters:
  • conversationId (string) –

    [REQUIRED]

    The identifier of the Amazon Q Business web experience conversation.

  • applicationId (string) –

    [REQUIRED]

    The identifier for the Amazon Q Business application.

  • userId (string) – The identifier of the user involved in the Amazon Q Business web experience conversation.

  • nextToken (string) – 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.

  • maxResults (integer) – The maximum number of messages to return.

Return type:

dict

Returns:

Response Syntax

{
    'messages': [
        {
            'messageId': 'string',
            'body': 'string',
            'time': datetime(2015, 1, 1),
            'type': 'USER'|'SYSTEM',
            'attachments': [
                {
                    'name': 'string',
                    'status': 'FAILED'|'SUCCESS',
                    'error': {
                        'errorMessage': 'string',
                        'errorCode': 'InternalError'|'InvalidRequest'|'ResourceInactive'|'ResourceNotFound'
                    },
                    'attachmentId': 'string',
                    'conversationId': 'string'
                },
            ],
            'sourceAttribution': [
                {
                    'title': 'string',
                    'snippet': 'string',
                    'url': 'string',
                    'citationNumber': 123,
                    'updatedAt': datetime(2015, 1, 1),
                    'textMessageSegments': [
                        {
                            'beginOffset': 123,
                            'endOffset': 123,
                            'snippetExcerpt': {
                                'text': 'string'
                            },
                            'mediaId': 'string',
                            'mediaMimeType': 'string'
                        },
                    ]
                },
            ],
            'actionReview': {
                'pluginId': 'string',
                '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': {
                    'string': {
                        'displayName': 'string',
                        'displayOrder': 123,
                        'displayDescription': 'string',
                        'type': 'STRING'|'NUMBER'|'ARRAY'|'BOOLEAN',
                        'value': {...}|[...]|123|123.4|'string'|True|None,
                        'allowedValues': [
                            {
                                'value': {...}|[...]|123|123.4|'string'|True|None,
                                'displayValue': {...}|[...]|123|123.4|'string'|True|None
                            },
                        ],
                        'allowedFormat': 'string',
                        'arrayItemJsonSchema': {...}|[...]|123|123.4|'string'|True|None,
                        'required': True|False
                    }
                },
                'payloadFieldNameSeparator': 'string'
            },
            'actionExecution': {
                'pluginId': 'string',
                'payload': {
                    'string': {
                        'value': {...}|[...]|123|123.4|'string'|True|None
                    }
                },
                'payloadFieldNameSeparator': 'string'
            }
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) –

    • messages (list) –

      An array of information on one or more messages.

      • (dict) –

        A message in an Amazon Q Business web experience.

        • messageId (string) –

          The identifier of the Amazon Q Business web experience message.

        • body (string) –

          The content of the Amazon Q Business web experience message.

        • time (datetime) –

          The timestamp of the first Amazon Q Business web experience message.

        • type (string) –

          The type of Amazon Q Business message, whether HUMAN or AI generated.

        • attachments (list) –

          A file directly uploaded into an Amazon Q Business web experience chat.

          • (dict) –

            The details of a file uploaded during chat.

            • name (string) –

              The name of a file uploaded during chat.

            • status (string) –

              The status of a file uploaded during chat.

            • error (dict) –

              An error associated with a file uploaded during chat.

              • errorMessage (string) –

                The message explaining the Amazon Q Business request error.

              • errorCode (string) –

                The code associated with the Amazon Q Business request error.

            • attachmentId (string) –

              The unique identifier of the Amazon Q Business attachment.

            • conversationId (string) –

              The unique identifier of the Amazon Q Business conversation.

        • sourceAttribution (list) –

          The source documents used to generate Amazon Q Business web experience message.

          • (dict) –

            The documents used to generate an Amazon Q Business web experience response.

            • title (string) –

              The title of the document which is the source for the Amazon Q Business generated response.

            • snippet (string) –

              The content extract from the document on which the generated response is based.

            • url (string) –

              The URL of the document which is the source for the Amazon Q Business generated response.

            • citationNumber (integer) –

              The number attached to a citation in an Amazon Q Business generated response.

            • updatedAt (datetime) –

              The Unix timestamp when the Amazon Q Business application was last updated.

            • textMessageSegments (list) –

              A text extract from a source document that is used for source attribution.

              • (dict) –

                Provides information about a text extract in a chat response that can be attributed to a source document.

                • beginOffset (integer) –

                  The zero-based location in the response string where the source attribution starts.

                • endOffset (integer) –

                  The zero-based location in the response string where the source attribution ends.

                • snippetExcerpt (dict) –

                  The relevant text excerpt from a source that was used to generate a citation text segment in an Amazon Q Business chat response.

                  • text (string) –

                    The relevant text excerpt from a source that was used to generate a citation text segment in an Amazon Q chat response.

                • mediaId (string) –

                  The identifier of the media object associated with the text segment in the source attribution.

                • mediaMimeType (string) –

                  The MIME type (image/png) of the media object associated with the text segment in the source attribution.

        • actionReview (dict) –

          An output event that Amazon Q Business returns to an user who wants to perform a plugin action during a non-streaming chat conversation. It contains information about the selected action with a list of possible user input fields, some pre-populated by Amazon Q Business.

          • pluginId (string) –

            The identifier of the plugin associated with the action review.

          • pluginType (string) –

            The type of plugin.

          • payload (dict) –

            Field values that an end user needs to provide to Amazon Q Business for Amazon Q Business to perform the requested plugin action.

            • (string) –

              • (dict) –

                A user input field in an plugin action review payload.

                • displayName (string) –

                  The name of the field.

                • displayOrder (integer) –

                  The display order of fields in a payload.

                • displayDescription (string) –

                  The field level description of each action review input field. This could be an explanation of the field. In the Amazon Q Business web experience, these descriptions could be used to display as tool tips to help users understand the field.

                • type (string) –

                  The type of field.

                • value (document) –

                  The field value.

                • allowedValues (list) –

                  Information about the field values that an end user can use to provide to Amazon Q Business for Amazon Q Business to perform the requested plugin action.

                  • (dict) –

                    Information about the field values that an end user can use to provide to Amazon Q Business for Amazon Q Business to perform the requested plugin action.

                    • value (document) –

                      The field value.

                    • displayValue (document) –

                      The name of the field.

                • allowedFormat (string) –

                  The expected data format for the action review input field value. For example, in PTO request, from and to would be of datetime allowed format.

                • arrayItemJsonSchema (document) –

                  Use to create a custom form with array fields (fields with nested objects inside an array).

                • required (boolean) –

                  Information about whether the field is required.

          • payloadFieldNameSeparator (string) –

            A string used to retain information about the hierarchical contexts within an action review payload.

        • actionExecution (dict) –

          Performs an Amazon Q Business plugin action during a non-streaming chat conversation.

          • pluginId (string) –

            The identifier of the plugin the action is attached to.

          • payload (dict) –

            A mapping of field names to the field values in input that an end user provides to Amazon Q Business requests to perform their plugin action.

            • (string) –

              • (dict) –

                A user input field in an plugin action execution payload.

                • value (document) –

                  The content of a user input field in an plugin action execution payload.

          • payloadFieldNameSeparator (string) –

            A string used to retain information about the hierarchical contexts within an action execution event payload.

    • nextToken (string) –

      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.

Exceptions

  • QBusiness.Client.exceptions.ResourceNotFoundException

  • QBusiness.Client.exceptions.InternalServerException

  • QBusiness.Client.exceptions.LicenseNotFoundException

  • QBusiness.Client.exceptions.ThrottlingException

  • QBusiness.Client.exceptions.ValidationException

  • QBusiness.Client.exceptions.AccessDeniedException