Bot Connector Webhook Timeout on /api/v2/analytics/flows/details with Large Date Ranges

Just noticed that our Premium App integration is experiencing intermittent 504 Gateway Timeout errors when the bot connector attempts to fetch historical flow analytics via a webhook callback. The specific endpoint failing is /api/v2/analytics/flows/details. This occurs when the bot logic requests performance metrics for a date range exceeding 30 days, which is a standard requirement for our client reporting dashboard.

The issue appears to be related to how the platform handles aggregation for large datasets within the AI/Bot context. When the request size is small (e.g., intervalSize=PT1H for 24 hours), the response returns successfully with a 200 OK status. However, increasing the range to 30 days with the same interval size triggers the timeout. We have verified that the OAuth token used by the bot connector has the necessary analytics:view scope and is not expiring during the request.

Environment details:

  • Platform: Genesys Cloud (US1 region)
  • Integration: Custom Bot Connector built on AppFoundry
  • API Version: v2
  • Error: 504 Gateway Timeout
  • Payload: JSON with startDate and endDate spanning 30 days, intervalSize=PT1H
  • Frequency: Occurs on 100% of requests exceeding 24-hour ranges

We have attempted to mitigate this by paginating the requests using the nextPageToken, but the timeout persists even for the initial page of a 30-day query. Is there a known limitation on the flows/details endpoint regarding date range size when accessed via bot webhook contexts? Or is this a broader issue with the analytics API under heavy load? We are considering switching to a background job pattern, but that introduces latency issues for real-time bot responses. Any insights on the expected behavior or a workaround would be appreciated.

TL;DR: Check your date range parameters. The endpoint caps at 30 days, so split the request into weekly chunks to avoid the 504.