iachat/spec/builders
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
..
campaigns chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30
csat_surveys chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30
email feat: Clean up email configuration for from and reply to emails (#12453) 2025-09-24 11:36:53 -07:00
messages feat: Display story replies with attachment and context label (#13356) 2026-01-28 16:47:04 +04:00
v2 feat: Add first response time distribution report endpoint (#13400) 2026-01-30 22:22:27 +04:00
account_builder_spec.rb fix: account email validation during signup (#11307) 2025-05-20 20:45:39 -07:00
agent_builder_spec.rb fix: Avoid duplicate invitation emails when adding an agent (#9131) 2024-03-26 18:58:45 -07:00
contact_inbox_builder_spec.rb chore: Add cache to improve widget performance (#11163) 2025-03-24 16:04:49 -07:00
contact_inbox_with_contact_builder_spec.rb feat: Instagram Inbox using Instagram Business Login (#11054) 2025-04-08 10:47:41 +05:30
conversation_builder_spec.rb feat: Ability to lock the conversation to a single thread in API channels (#10329) 2024-12-09 23:36:17 +08:00
notification_builder_spec.rb fix: Exclude notifications for blocked contacts, except mentions (#10659) 2025-01-12 15:30:27 +05:30
year_in_review_builder_spec.rb feat(ce): Add Year in review feature (#13078) 2025-12-15 17:24:45 -08:00