# Message metrics

In the UI, metrics can be found by going to **Admin** > **Integrations**. Under the **Audit Messaging** tab, you'll be able to see the current number of queued messages, the number of messages sent over a given timeframe, and the current message delay between when the action was taken and when the message was sent.

Further, each of these metrics can be queried from the API using the following calls:

## Gets counts of audit events yet to have messages sent out

<mark style="color:blue;">`GET`</mark> `https://ris.rightsline.com/v4/messages-queued`

This endpoint will return count of audit events (grouped by the entity type - charTypeId) that are queued up to be sent out as messages. &#x20;

#### Headers

| Name                                            | Type   | Description             |
| ----------------------------------------------- | ------ | ----------------------- |
| x-api-key<mark style="color:red;">\*</mark>     | String | Your company's API key. |
| Authorization<mark style="color:red;">\*</mark> | String | Authentication token    |

{% tabs %}
{% tab title="200: OK Success return of queued message counts" %}

```json
{
    "queuedMessagesByCharType": [
        {
            "charTypeId": 0,
            "count": 9999
        },
        {
            "charTypeId": 1,
            "count": 8888
        },
        {
            "charTypeId": 3,
            "count": 7777
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Get the number of messages sent over a time period

<mark style="color:green;">`POST`</mark> `https://ris.rightsline.com/v4/messages-sent`

Specify a startDate and endDate that must be within the past month. Response will be a count of the messages that were sent out during that time frame.

#### Headers

| Name                                            | Type   | Description             |
| ----------------------------------------------- | ------ | ----------------------- |
| x-api-key<mark style="color:red;">\*</mark>     | String | Your company's API key. |
| Authorization<mark style="color:red;">\*</mark> | String | Authentication token    |

#### Request Body

| Name      | Type     | Description                                                                                 |
| --------- | -------- | ------------------------------------------------------------------------------------------- |
| startDate | DateTime | Start of the time frame to query messages sent. Must be within past 30 days.                |
| endDate   | DateTime | End of the time frame to query messages sent. Must be less than 30 days from the startDate. |

{% tabs %}
{% tab title="200: OK Total count of messages sent during time frame" %}
9999
{% endtab %}
{% endtabs %}

## Get an average delay (in seconds) for the messages sent during the time frame

<mark style="color:green;">`POST`</mark> `https://ris.rightsline.com/v4/message-delay`

Specify a startDate and endDate that must be within the past month. Response will be the average time between when an event occurred to when the message(s) for that event were sent out.&#x20;

#### Headers

| Name                                            | Type   | Description             |
| ----------------------------------------------- | ------ | ----------------------- |
| x-api-key<mark style="color:red;">\*</mark>     | String | Your company's API key. |
| Authorization<mark style="color:red;">\*</mark> | String | Authentication token    |

#### Request Body

| Name      | Type     | Description                                                                                                                                                       |
| --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| startDate | DateTime | Start of the time frame to query messages sent. Must be within past 30 days. Expected in ISO format and UTC time zone (e.g. "2023-09-09T12:00:00")                |
| endDate   | DateTime | End of the time frame to query messages sent. Must be less than 30 days from the startDate. Expected in ISO format and UTC time zone (e.g. "2023-09-09T12:00:00") |

{% tabs %}
{% tab title="200: OK Average message delay in seconds, rounded to the nearest tenth." %}
1234.5
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://queue-docs.rightsline.com/message-metrics.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
