Skip to content

get_contact_metrics async

get_contact_metrics(
    instance_id: InstanceIdOrArn,
    contact_id: InstanceIdOrArn,
    metrics: ContactMetrics,
    *,
    config_overrides: Optional[AsyncConnectClientConfig] = None,
) -> GetContactMetricsResponse

Retrieves contact metric data for a specified contact.

Use cases

Following are common use cases for position in queue and estimated wait time:

  • Customer-Facing Wait Time Announcements - Display or announce the estimated wait time and position in queue to customers before or during their queue experience.

  • Callback Offerings - Offer customers a callback option when the estimated wait time or position in queue exceeds a defined threshold.

  • Queue Routing Decisions - Route incoming contacts to less congested queues by comparing estimated wait time and position in queue across multiple queues.

  • Self-Service Deflection - Redirect customers to self-service options like chatbots or FAQs when estimated wait time is high or position in queue is unfavorable.

Important things to know

  • Metrics are only available while the contact is actively in queue.

  • For more information, see the Position in queue metric in the Connect Customer Administrator Guide.

Endpoints: See Connect Customer endpoints and quotas.

Parameters:

  • instance_id (InstanceIdOrArn) –

    The identifier of the Connect Customer instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance.

  • contact_id (InstanceIdOrArn) –

    The identifier of the contact in this instance of Connect Customer.

  • metrics (ContactMetrics) –

    A list of contact level metrics to retrieve.Supported metrics include POSITION_IN_QUEUE (the contact's current position in the queue) and ESTIMATED_WAIT_TIME (the predicted time in seconds until the contact is connected to an agent)

Raises:

Source code in docs_src/capo_connect/_services/async_connect.py
async def get_contact_metrics(
    self,
    instance_id: "capo_connect.types.instance_id_or_arn.InstanceIdOrArn",
    contact_id: "capo_connect.types.instance_id_or_arn.InstanceIdOrArn",
    metrics: "capo_connect.types.contact_metrics.ContactMetrics",
    *,
    config_overrides: Optional[AsyncConnectClientConfig] = None,
) -> "capo_connect.types.get_contact_metrics_response.GetContactMetricsResponse":
    """<p>Retrieves contact metric data for a specified contact.</p> <p> <b>Use cases</b> </p> <p>Following are common use cases for position in queue and estimated wait time:</p> <ul> <li> <p>Customer-Facing Wait Time Announcements - Display or announce the estimated wait time and position in queue to customers before or during their queue experience. </p> </li> <li> <p>Callback Offerings - Offer customers a callback option when the estimated wait time or position in queue exceeds a defined threshold. </p> </li> <li> <p>Queue Routing Decisions - Route incoming contacts to less congested queues by comparing estimated wait time and position in queue across multiple queues. </p> </li> <li> <p>Self-Service Deflection - Redirect customers to self-service options like chatbots or FAQs when estimated wait time is high or position in queue is unfavorable. </p> </li> </ul> <p> <b>Important things to know</b> </p> <ul> <li> <p>Metrics are only available while the contact is actively in queue.</p> </li> <li> <p>For more information, see the <a href="https://docs.aws.amazon.com/connect/latest/adminguide/metrics-definitions.html">Position in queue</a> metric in the <i>Connect Customer Administrator Guide</i>. </p> </li> </ul> <p> <b>Endpoints</b>: See <a href="https://docs.aws.amazon.com/general/latest/gr/connect_region.html">Connect Customer endpoints and quotas</a>.</p>

    Args:
        instance_id: <p>The identifier of the Connect Customer instance. You can <a href="https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html">find the instance ID</a> in the Amazon Resource Name (ARN) of the instance.</p>
        contact_id: <p>The identifier of the contact in this instance of Connect Customer. </p>
        metrics: <p>A list of contact level metrics to retrieve.Supported metrics include POSITION_IN_QUEUE (the contact's current position in the queue) and ESTIMATED_WAIT_TIME (the predicted time in seconds until the contact is connected to an agent)</p>

    Raises:
        capo_connect.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action.</p>
        capo_connect.errors.internal_service_exception.InternalServiceException: <p>Request processing failed because of an error or failure with the service.</p>
        capo_connect.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more of the specified parameters are not valid.</p>
        capo_connect.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_connect.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_connect.errors.throttling_exception.ThrottlingException: <p>The throttling limit has been exceeded.</p>
        capo_connect.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_connect.types.get_contact_metrics_request.GetContactMetricsRequest]",
    ) -> AsyncOperationResponse[
        "capo_connect.types.get_contact_metrics_response.GetContactMetricsResponse"
    ]:
        import capo_connect._operations.amazon_connect_service.get_contact_metrics

        (
            output,
            http_response,
        ) = await capo_connect._operations.amazon_connect_service.get_contact_metrics.async_get_contact_metrics(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetContactMetrics")
    )
    input_: capo_connect.types.get_contact_metrics_request.GetContactMetricsRequest = {
        "instance_id": instance_id,
        "contact_id": contact_id,
        "metrics": metrics,
    }

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