getContactMetrics method

Future<GetContactMetricsResponse> getContactMetrics({
  1. required String contactId,
  2. required String instanceId,
  3. required List<ContactMetricInfo> metrics,
})

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.

May throw AccessDeniedException. May throw InternalServiceException. May throw InvalidParameterException. May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter contactId : The identifier of the contact in this instance of Connect Customer.

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

Parameter metrics : 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)

Implementation

Future<GetContactMetricsResponse> getContactMetrics({
  required String contactId,
  required String instanceId,
  required List<ContactMetricInfo> metrics,
}) async {
  final $payload = <String, dynamic>{
    'ContactId': contactId,
    'InstanceId': instanceId,
    'Metrics': metrics,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/metrics/contact',
    exceptionFnMap: _exceptionFns,
  );
  return GetContactMetricsResponse.fromJson(response);
}