Skip to content

/AWS1/IF_CNT=>GETCONTACTMETRICS()

About GetContactMetrics

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 Amazon Connect Administrator Guide.

Endpoints: See Amazon Connect endpoints and quotas.

Method Signature

METHODS /AWS1/IF_CNT~GETCONTACTMETRICS
  IMPORTING
    !IV_INSTANCEID TYPE /AWS1/CNTINSTANCEIDORARN OPTIONAL
    !IV_CONTACTID TYPE /AWS1/CNTINSTANCEIDORARN OPTIONAL
    !IT_METRICS TYPE /AWS1/CL_CNTCONTACTMETRICINFO=>TT_CONTACTMETRICS OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_cntgetcontactmetrsp
  RAISING
    /AWS1/CX_CNTACCESSDENIEDEX
    /AWS1/CX_CNTINTERNALSERVICEEX
    /AWS1/CX_CNTINVALIDPARAMETEREX
    /AWS1/CX_CNTINVALIDREQUESTEX
    /AWS1/CX_CNTRESOURCENOTFOUNDEX
    /AWS1/CX_CNTTHROTTLINGEX
    /AWS1/CX_CNTCLIENTEXC
    /AWS1/CX_CNTSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_instanceid TYPE /AWS1/CNTINSTANCEIDORARN /AWS1/CNTINSTANCEIDORARN

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

iv_contactid TYPE /AWS1/CNTINSTANCEIDORARN /AWS1/CNTINSTANCEIDORARN

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

it_metrics TYPE /AWS1/CL_CNTCONTACTMETRICINFO=>TT_CONTACTMETRICS TT_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)

RETURNING

oo_output TYPE REF TO /aws1/cl_cntgetcontactmetrsp /AWS1/CL_CNTGETCONTACTMETRSP

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->getcontactmetrics(
  it_metrics = VALUE /aws1/cl_cntcontactmetricinfo=>tt_contactmetrics(
    ( new /aws1/cl_cntcontactmetricinfo( |string| ) )
  )
  iv_contactid = |string|
  iv_instanceid = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  LOOP AT lo_result->get_metricresults( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_contactmetricname = lo_row_1->get_name( ).
      lo_contactmetricvalue = lo_row_1->get_value( ).
      IF lo_contactmetricvalue IS NOT INITIAL.
        lv_double = lo_contactmetricvalue->get_number( ).
      ENDIF.
    ENDIF.
  ENDLOOP.
  lv_contactid = lo_result->get_id( ).
  lv_arn = lo_result->get_arn( ).
ENDIF.