chatwoot/app
Pranav 5ec77aca64
feat: Add first response time distribution report endpoint (#13400)
The index is already added in production.

Adds a new reporting API that returns conversation counts grouped by
channel type and first response time buckets (0-1h, 1-4h, 4-8h, 8-24h,
24h+).

- GET /api/v2/accounts/:id/reports/first_response_time_distribution
- Uses SQL aggregation to handle large datasets efficiently
- Adds composite index on reporting_events for query performance

Tested on production workload.
Request: GET
`/api/v2/accounts/1/reports/first_response_time_distribution?since=<since>&until=<until>`
Response payload:
```
{
    "Channel::WebWidget": {
      "0-1h": 120,
      "1-4h": 85,
      "4-8h": 32,
      "8-24h": 12,
      "24h+": 3
    },
    "Channel::Email": {
      "0-1h": 12,
      "1-4h": 28,
      "4-8h": 45,
      "8-24h": 35,
      "24h+": 10
    },
    "Channel::FacebookPage": {
      "0-1h": 50,
      "1-4h": 30,
      "4-8h": 15,
      "8-24h": 8,
      "24h+": 2
    }
  }
```

---------

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
2026-01-30 22:22:27 +04:00
..
actions
assets
builders feat: Add first response time distribution report endpoint (#13400) 2026-01-30 22:22:27 +04:00
channels
controllers feat: Add first response time distribution report endpoint (#13400) 2026-01-30 22:22:27 +04:00
dashboards
dispatchers
drops
fields
finders
helpers feat: new Captain Editor (#13235) 2026-01-21 13:39:07 +05:30
javascript fix: Formatting issue with reply preview content (#13399) 2026-01-30 16:35:32 +05:30
jobs feat: add cron job to remove orphan conversations (#13335) 2026-01-28 19:25:20 +05:30
listeners fix: prevent deserialization error on deletion (#13264) 2026-01-14 18:00:12 +05:30
mailboxes
mailers
models fix: Force account_id in the query (#13388) 2026-01-28 14:51:24 -08:00
policies feat: new Captain Editor (#13235) 2026-01-21 13:39:07 +05:30
presenters fix: sanitize integer fields to prevent Elasticsearch mapping errors (#13276) 2026-01-22 18:29:49 +05:30
services feat: Add TikTok social profile display support (#13384) 2026-01-29 09:26:10 +04:00
views feat: Add infinite scroll to contacts search page (#13376) 2026-01-27 18:55:19 -08:00