> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.app/llms.txt
> Use this file to discover all available pages before exploring further.

# User Engagement Trend API

<Badge icon="arrow-left" color="gray">[Back to API List](/ai-for-service/apis/automation/api-list)</Badge>

To provide the number of users who have interacted with the bot in a given period across different time intervals.

| Field             | Value                                                                                                                                              |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Method**        | POST                                                                                                                                               |
| **Endpoint**      | `https://{{host}}/api/public/bot/{{BotID}}/userEngagementTrend?aggregation_type={{type}}&start_date={{from}}&end_date={{to}}&channels={{channel}}` |
| **Content Type**  | `application/json`                                                                                                                                 |
| **Authorization** | `auth: {{JWT}}` See \[[How to generate the JWT Token](/ai-for-service/apis/automation/api-introduction#generating-the-jwt-token).                  |
| **API Scope**     | App Builder: User Engagement Trend; Admin Console: Not Applicable                                                                                  |

## Path Parameters

| Parameter | Required | Description                                                                       |
| --------- | -------- | --------------------------------------------------------------------------------- |
| `host`    | Required | Environment URL, for example, `https://platform.kore.ai`                          |
| `BotID`   | Required | Bot ID or Stream ID. You can access it from the General Settings page of the bot. |

## Sample Request

```json theme={null}
curl -X POST \
  'https://{{host}}/api/public/bot/{{bot_id}}/userEngagementTrend?aggregation_type=Hourly&start_date=2020-09-01&end_date=2020-09-05&channels=rtm' \
  -H 'auth: {{YOUR_JWT_ACCESS_TOKEN}}' \
  -H 'content-type: application/json'
```

## Body Parameters

| Parameter          | Required | Type   | Description                                                       |
| ------------------ | -------- | ------ | ----------------------------------------------------------------- |
| `filters`          | Required |        | Object with the following details to filter the result set.       |
| `start_date`       | Required | Date   | Refers to the start time of the period to be considered.          |
| `end_date`         | Required | Date   | Refers to the end time of the period to be considered.            |
| `channel`          | Optional | String | Refers to the channel from which the interactions have happened.  |
| `aggregation_type` | Optional | String | Refers to the type of aggregation: `Hourly` (default) or `Daily`. |

## Sample Response

**When `aggregation_type = Daily`:**

```json theme={null}
{
  "results":[
     { "date": "MMM DD YYYY",
       "users": "number of users"
      },
     { "date": "MMM DD YYYY",
       "users": "number of users"
      }
  ],
  "totalResults": 2
}
```

**When `aggregation_type = Hourly` or empty or not given:**

```json theme={null}
{
  "results": [
    {
      "date":"Aug 06 2020",
      "0 - 1": 20,
      "1 - 2": 0,
      "2 - 3": 0,
      "3 - 4": 10,
      "23 - 0": 0
    },
    {
      "date":"Aug 07 2020",
      "0 - 1": 20,
      "23 - 0": 0
    }
  ],
  "totalResults": 2
}
```
