iachat/app/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 fix: correct typo in CampaignConversationBuilder (#11336) 2025-04-21 11:57:38 +05:30
csat_surveys feat: Add CSAT response APIs (#2503) 2021-06-29 20:59:41 +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.rb fix: account email validation during signup (#11307) 2025-05-20 20:45:39 -07:00
agent_builder.rb feat: setup invite to handle SAML enabled account [CW-5613] (#12439) 2025-09-17 19:33:38 +05:30
contact_inbox_builder.rb feat: outbound voice call essentials (#12782) 2025-11-24 17:47:00 -08:00
contact_inbox_with_contact_builder.rb feat: Instagram Inbox using Instagram Business Login (#11054) 2025-04-08 10:47:41 +05:30
conversation_builder.rb feat: Ability to lock to single conversation (#5881) 2022-11-25 13:01:04 +03:00
notification_builder.rb fix: Exclude notifications for blocked contacts, except mentions (#10659) 2025-01-12 15:30:27 +05:30
notification_subscription_builder.rb chore: Use "create!" and "save!" bang methods when not checking the result (#5358) 2022-09-13 17:40:06 +05:30
year_in_review_builder.rb feat(ce): Add Year in review feature (#13078) 2025-12-15 17:24:45 -08:00