Skip to content

list_utterance_analytics_data async

list_utterance_analytics_data(
    bot_id: Id,
    start_date_time: Timestamp,
    end_date_time: Timestamp,
    *,
    config_overrides: Optional[AsyncLexModelsV2ClientConfig] = None,
    sort_by: Optional[UtteranceDataSortBy] = None,
    filters: Optional[AnalyticsUtteranceFilters] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> ListUtteranceAnalyticsDataResponse

To use this API operation, your IAM role must have permissions to perform the ListAggregatedUtterances operation, which provides access to utterance-related analytics. See Viewing utterance statistics for the IAM policy to apply to the IAM role.

Retrieves a list of metadata for individual user utterances to your bot. The following fields are required:

  • startDateTime and endDateTime – 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.

Parameters:

  • bot_id (Id) –

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

  • start_date_time (Timestamp) –

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

  • end_date_time (Timestamp) –

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

  • sort_by (Optional[UtteranceDataSortBy], default: None ) –

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

  • filters (Optional[AnalyticsUtteranceFilters], default: None ) –

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

  • max_results (Optional[MaxResults], default: None ) –

    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.

  • next_token (Optional[NextToken], default: None ) –

    If the response from the ListUtteranceAnalyticsData 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 ListUtteranceAnalyticsData request to return the next page of results. For a complete set of results, call the ListUtteranceAnalyticsData operation until the nextToken returned in the response is null.

Raises:

Source code in docs_src/capo_lex_models_v2/_services/async_lex_models_v2.py
async def list_utterance_analytics_data(
    self,
    bot_id: "capo_lex_models_v2.types.id.Id",
    start_date_time: "capo_lex_models_v2.types.timestamp.Timestamp",
    end_date_time: "capo_lex_models_v2.types.timestamp.Timestamp",
    *,
    config_overrides: Optional[AsyncLexModelsV2ClientConfig] = None,
    sort_by: Optional[
        "capo_lex_models_v2.types.utterance_data_sort_by.UtteranceDataSortBy"
    ] = None,
    filters: Optional[
        "capo_lex_models_v2.types.analytics_utterance_filters.AnalyticsUtteranceFilters"
    ] = None,
    max_results: Optional["capo_lex_models_v2.types.max_results.MaxResults"] = None,
    next_token: Optional["capo_lex_models_v2.types.next_token.NextToken"] = None,
) -> "capo_lex_models_v2.types.list_utterance_analytics_data_response.ListUtteranceAnalyticsDataResponse":
    """<note> <p>To use this API operation, your IAM role must have permissions to perform the <a href="https://docs.aws.amazon.com/lexv2/latest/APIReference/API_ListAggregatedUtterances.html">ListAggregatedUtterances</a> operation, which provides access to utterance-related analytics. See <a href="https://docs.aws.amazon.com/lexv2/latest/dg/monitoring-utterances.html">Viewing utterance statistics</a> for the IAM policy to apply to the IAM role.</p> </note> <p>Retrieves a list of metadata for individual user utterances to your bot. The following fields are required:</p> <ul> <li> <p> <code>startDateTime</code> and <code>endDateTime</code> – Define a time range for which you want to retrieve results.</p> </li> </ul> <p>Of the optional fields, you can organize the results in the following ways:</p> <ul> <li> <p>Use the <code>filters</code> field to filter the results and the <code>sortBy</code> field to specify the values by which to sort the results.</p> </li> <li> <p>Use the <code>maxResults</code> field to limit the number of results to return in a single response and the <code>nextToken</code> field to return the next batch of results if the response does not return the full set of results.</p> </li> </ul>

    Args:
        bot_id: <p>The identifier for the bot for which you want to retrieve utterance analytics.</p>
        start_date_time: <p>The date and time that marks the beginning of the range of time for which you want to see utterance analytics.</p>
        end_date_time: <p>The date and time that marks the end of the range of time for which you want to see utterance analytics.</p>
        sort_by: <p>An object specifying the measure and method by which to sort the utterance analytics data.</p>
        filters: <p>A list of objects, each of which describes a condition by which you want to filter the results.</p>
        max_results: <p>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.</p>
        next_token: <p>If the response from the ListUtteranceAnalyticsData operation contains more results than specified in the maxResults parameter, a token is returned in the response.</p> <p>Use the returned token in the nextToken parameter of a ListUtteranceAnalyticsData request to return the next page of results. For a complete set of results, call the ListUtteranceAnalyticsData operation until the nextToken returned in the response is null.</p>

    Raises:
        capo_lex_models_v2.errors.internal_server_exception.InternalServerException: <p>The service encountered an unexpected condition. Try your request again.</p>
        capo_lex_models_v2.errors.precondition_failed_exception.PreconditionFailedException: <p>Your request couldn't be completed because one or more request fields aren't valid. Check the fields in your request and try again.</p>
        capo_lex_models_v2.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You have reached a quota for your bot. </p>
        capo_lex_models_v2.errors.throttling_exception.ThrottlingException: <p>Your request rate is too high. Reduce the frequency of requests.</p>
        capo_lex_models_v2.errors.validation_exception.ValidationException: <p>One of the input parameters in your request isn't valid. Check the parameters and try your request again.</p>
        capo_lex_models_v2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_lex_models_v2.types.list_utterance_analytics_data_request.ListUtteranceAnalyticsDataRequest]",
    ) -> AsyncOperationResponse[
        "capo_lex_models_v2.types.list_utterance_analytics_data_response.ListUtteranceAnalyticsDataResponse"
    ]:
        import capo_lex_models_v2._operations.lex_model_building_service_v2.list_utterance_analytics_data

        (
            output,
            http_response,
        ) = await capo_lex_models_v2._operations.lex_model_building_service_v2.list_utterance_analytics_data.async_list_utterance_analytics_data(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListUtteranceAnalyticsData")
    )
    input_: capo_lex_models_v2.types.list_utterance_analytics_data_request.ListUtteranceAnalyticsDataRequest = {
        "bot_id": bot_id,
        "start_date_time": start_date_time,
        "end_date_time": end_date_time,
    }
    if sort_by is not None:
        input_["sort_by"] = sort_by
    if filters is not None:
        input_["filters"] = filters
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output