LexModelsV2 / Client / list_session_analytics_data

list_session_analytics_data#

LexModelsV2.Client.list_session_analytics_data(**kwargs)#

Retrieves a list of metadata for individual user sessions with your bot. The startDateTime and endDateTime fields are required. These fields define a time range for which you want to retrieve results. Of the optional fields, you can organize the results in the following ways:

  • Use the filters field to filter the results and the sortBy field to specify the values by which to sort the results.

  • Use the maxResults field to limit the number of results to return in a single response and the nextToken field to return the next batch of results if the response does not return the full set of results.

See also: AWS API Documentation

Request Syntax

response = client.list_session_analytics_data(
    botId='string',
    startDateTime=datetime(2015, 1, 1),
    endDateTime=datetime(2015, 1, 1),
    sortBy={
        'name': 'ConversationStartTime'|'NumberOfTurns'|'Duration',
        'order': 'Ascending'|'Descending'
    },
    filters=[
        {
            'name': 'BotAliasId'|'BotVersion'|'LocaleId'|'Modality'|'Channel'|'Duration'|'ConversationEndState'|'SessionId'|'OriginatingRequestId'|'IntentPath',
            'operator': 'EQ'|'GT'|'LT',
            'values': [
                'string',
            ]
        },
    ],
    maxResults=123,
    nextToken='string'
)
Parameters:
  • botId (string) –

    [REQUIRED]

    The identifier for the bot for which you want to retrieve session analytics.

  • startDateTime (datetime) –

    [REQUIRED]

    The date and time that marks the beginning of the range of time for which you want to see session analytics.

  • endDateTime (datetime) –

    [REQUIRED]

    The date and time that marks the end of the range of time for which you want to see session analytics.

  • sortBy (dict) –

    An object specifying the measure and method by which to sort the session analytics data.

    • name (string) – [REQUIRED]

      The measure by which to sort the session analytics data.

      • conversationStartTime – The date and time when the conversation began. A conversation is defined as a unique combination of a sessionId and an originatingRequestId.

      • numberOfTurns – The number of turns that the session took.

      • conversationDurationSeconds – The duration of the conversation in seconds.

    • order (string) – [REQUIRED]

      Specifies whether to sort the results in ascending or descending order.

  • filters (list) –

    A list of objects, each of which describes a condition by which you want to filter the results.

    • (dict) –

      Contains fields describing a condition by which to filter the sessions. The expression may be understood as name operator values. For example:

      • LocaleId EQ en – The locale is “en”.

      • Duration GT 200 – The duration is greater than 200 seconds.

      The operators that each filter supports are listed below:

      • BotAliasEQ.

      • BotVersionEQ.

      • LocaleIdEQ.

      • ModalityEQ.

      • ChannelEQ.

      • DurationEQ, GT, LT.

      • conversationEndStateEQ, CO.

      • SessionIdEQ.

      • OriginatingRequestIdEQ.

      • IntentPathEQ.

      • name (string) – [REQUIRED]

        The category by which to filter the sessions. The descriptions for each option are as follows:

        • BotAlias – The name of the bot alias.

        • BotVersion – The version of the bot.

        • LocaleId – The locale of the bot.

        • Modality – The modality of the session with the bot (audio, DTMF, or text).

        • Channel – The channel that the bot is integrated with.

        • Duration – The duration of the session.

        • conversationEndState – The final state of the session.

        • SessionId – The identifier of the session with the bot.

        • OriginatingRequestId – The identifier of the first request in a session.

        • IntentPath – The order of intents taken in a session.

      • operator (string) – [REQUIRED]

        The operation by which to filter the category. The following operations are possible:

        • CO – Contains

        • EQ – Equals

        • GT – Greater than

        • LT – Less than

        The operators that each filter supports are listed below:

        • BotAliasEQ.

        • BotVersionEQ.

        • LocaleIdEQ.

        • ModalityEQ.

        • ChannelEQ.

        • DurationEQ, GT, LT.

        • conversationEndStateEQ, CO.

        • SessionIdEQ.

        • OriginatingRequestIdEQ.

        • IntentPathEQ.

      • values (list) – [REQUIRED]

        An array containing the values of the category by which to apply the operator to filter the results. You can provide multiple values if the operator is EQ or CO. If you provide multiple values, you filter for results that equal/contain any of the values. For example, if the name, operator, and values fields are Modality, EQ, and [Speech, Text], the operation filters for results where the modality was either Speech or Text.

        • (string) –

  • maxResults (integer) – The maximum number of results to return in each page of results. If there are fewer results than the maximum page size, only the actual number of results are returned.

  • nextToken (string) –

    If the response from the ListSessionAnalyticsData operation contains more results than specified in the maxResults parameter, a token is returned in the response.

    Use the returned token in the nextToken parameter of a ListSessionAnalyticsData request to return the next page of results. For a complete set of results, call the ListSessionAnalyticsData operation until the nextToken returned in the response is null.

Return type:

dict

Returns:

Response Syntax

{
    'botId': 'string',
    'nextToken': 'string',
    'sessions': [
        {
            'botAliasId': 'string',
            'botVersion': 'string',
            'localeId': 'string',
            'channel': 'string',
            'sessionId': 'string',
            'conversationStartTime': datetime(2015, 1, 1),
            'conversationEndTime': datetime(2015, 1, 1),
            'conversationDurationSeconds': 123,
            'conversationEndState': 'Success'|'Failure'|'Dropped',
            'mode': 'Speech'|'Text'|'DTMF'|'MultiMode',
            'numberOfTurns': 123,
            'invokedIntentSamples': [
                {
                    'intentName': 'string'
                },
            ],
            'originatingRequestId': 'string'
        },
    ]
}

Response Structure

  • (dict) –

    • botId (string) –

      The unique identifier of the bot that the sessions belong to.

    • nextToken (string) –

      If the response from the ListSessionAnalyticsData operation contains more results than specified in the maxResults parameter, a token is returned in the response.

      Use the returned token in the nextToken parameter of a ListSessionAnalyticsData request to return the next page of results. For a complete set of results, call the ListSessionAnalyticsData operation until the nextToken returned in the response is null.

    • sessions (list) –

      A list of objects, each of which contains information about a session with the bot.

      • (dict) –

        An object containing information about a specific session.

        • botAliasId (string) –

          The identifier of the alias of the bot that the session was held with.

        • botVersion (string) –

          The version of the bot that the session was held with.

        • localeId (string) –

          The locale of the bot that the session was held with.

        • channel (string) –

          The channel that is integrated with the bot that the session was held with.

        • sessionId (string) –

          The identifier of the session.

        • conversationStartTime (datetime) –

          The date and time when the conversation began. A conversation is defined as a unique combination of a sessionId and an originatingRequestId.

        • conversationEndTime (datetime) –

          The date and time when the conversation ended. A conversation is defined as a unique combination of a sessionId and an originatingRequestId.

        • conversationDurationSeconds (integer) –

          The duration of the conversation in seconds. A conversation is defined as a unique combination of a sessionId and an originatingRequestId.

        • conversationEndState (string) –

          The final state of the conversation. A conversation is defined as a unique combination of a sessionId and an originatingRequestId.

        • mode (string) –

          The mode of the session. The possible values are as follows:

          • Speech – The session was spoken.

          • Text – The session was written.

          • DTMF – The session used a touch-tone keypad (Dual Tone Multi-Frequency).

          • MultiMode – The session used multiple modes.

        • numberOfTurns (integer) –

          The number of turns that the session took.

        • invokedIntentSamples (list) –

          A list of objects containing the name of an intent that was invoked.

          • (dict) –

            An object containing the name of an intent that was invoked.

            • intentName (string) –

              The name of an intent that was invoked.

        • originatingRequestId (string) –

          The identifier of the first request in a session.

Exceptions

  • LexModelsV2.Client.exceptions.ThrottlingException

  • LexModelsV2.Client.exceptions.ValidationException

  • LexModelsV2.Client.exceptions.PreconditionFailedException

  • LexModelsV2.Client.exceptions.ServiceQuotaExceededException

  • LexModelsV2.Client.exceptions.InternalServerException