Analytics Conversations Aggregates: groupBy 'interval' returning empty data in TS SDK

Trying to build a custom interval report using the postAnalyticsConversationsAggregatesQuery method in the Genesys Cloud TypeScript SDK. The goal is to get conversation counts grouped by 15-minute intervals over the last 24 hours. The query works fine when I hit the REST endpoint directly via Postman, but the SDK returns an empty entities array in the response.

Here’s the query payload I’m passing:

const query: Analytics.ConversationsAggregateQuery = {
 view: 'conversation',
 select: ['count()'],
 groupBy: ['interval'],
 timeFilter: {
 type: 'relative',
 from: -86400, // 24 hours ago
 to: 0
 },
 interval: '15 minutes',
 where: [
 {
 type: 'field',
 path: 'conversationType',
 operator: 'equals',
 value: 'voice'
 }
 ]
};

const response = await analyticsApi.postAnalyticsConversationsAggregatesQuery({
 analyticsConversationsAggregateQuery: query
});

The response object has a 200 status, but response.body.entities is []. I’ve checked the timezone settings in the account, and they match the SDK client configuration. Is there a specific quirk with how the SDK serializes the interval parameter or the timeFilter object that causes this? The REST spec says interval should be a string like ‘15 minutes’, which is what I’m sending. Any ideas on why the SDK would return empty data while the raw HTTP call succeeds?

The issue is likely the date format. The TypeScript SDK expects ISO 8601 strings with timezone offsets for from and to dates. If you’re passing naive dates or local times, the backend sees an invalid range and returns empty entities.

Try constructing the query like this:

const now = new Date();
const yesterday = new Date(now.getTime() - 24 * 60 * 60 * 1000);

const query = {
 dateFrom: yesterday.toISOString(),
 dateTo: now.toISOString(),
 metrics: ["count"],
 groupBy: ["interval"],
 intervalSize: "15 minutes"
};

const response = await platformClient.AnalyticsApi.postAnalyticsConversationsAggregatesQuery("conversations", query);

Also double-check your OAuth scopes. You need analytics:conversation:view. If the token lacks that, the SDK might silently fail or return partial data depending on the version. Check the raw response headers for a 403 or 401 status before assuming the query logic is broken.

The Postman request probably worked because you manually copied a valid ISO string. The SDK handles serialization, but it doesn’t guess your timezone.