iachat/spec/builders/v2/reports
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
..
conversations chore: upgrade ruby version to 3.4.4 (#11524) 2025-05-21 19:40:07 +05:30
timeseries fix: resolution count does not have account scope (#12370) 2025-09-04 18:04:00 +05:30
agent_summary_builder_spec.rb feat(v4): Update team, agent summary builder to include resolution metrics (#10607) 2024-12-20 19:16:56 +05:30
bot_metrics_builder_spec.rb feat: Add backend APIs for the bot metrics (#9031) 2024-03-01 08:20:20 -08:00
channel_summary_builder_spec.rb feat: Add an API to support querying metrics by ChannelType (#13255) 2026-01-12 23:18:47 -08:00
first_response_time_distribution_builder_spec.rb feat: Add first response time distribution report endpoint (#13400) 2026-01-30 22:22:27 +04:00
inbox_label_matrix_builder_spec.rb feat: Add inbox-label matrix report endpoint (#13394) 2026-01-29 13:32:59 -08:00
inbox_summary_builder_spec.rb feat: Instagram Inbox using Instagram Business Login (#11054) 2025-04-08 10:47:41 +05:30
label_summary_builder_spec.rb fix: wrong resolution count in timeseries reports (#12261) 2025-09-03 15:47:16 +05:30
team_summary_builder_spec.rb feat(v4): Update team, agent summary builder to include resolution metrics (#10607) 2024-12-20 19:16:56 +05:30