Choosing between /api/v2/conversations and /api/v2/analytics/conversations for real-time agent activity

We are building a custom agent desktop wrapper in C# and need to display real-time conversation metrics to the agent. Specifically, we want to show the current call duration and queue wait time.

I’ve been looking at the Genesys Cloud API docs and I’m confused about the difference between these two endpoints:

  1. /api/v2/conversations
  2. /api/v2/analytics/conversations

From what I understand, the conversations endpoint gives me the raw conversation data, like participants and state. The analytics/conversations endpoint seems to give me aggregated metrics.

Here is the code I’m using to fetch data from the conversations endpoint:

var client = new PlatformClient("https://api.mypurecloud.com");
var conversations = await client.ConversationsApi.PostConversationsAsync(
 body: new PostConversationsRequest { 
 Query = "state:connected", 
 PageSize = 10 
 });

This works fine for getting the conversation ID and state. But when I try to get the duration, I have to calculate it myself based on the createdTime and updatedTime. This feels wrong. It’s not accurate for real-time updates.

I tried using the analytics/conversations endpoint like this:

var analyticsClient = new PlatformClient("https://api.mypurecloud.com");
var analyticsRequest = new PostConversationsAnalyticsRequest {
 Interval = "PT1H",
 Agg = new List<string> { "sum" },
 Metrics = new List<string> { "conversationDuration" }
};

var analytics = await analyticsClient.AnalyticsApi.PostConversationsAnalyticsAsync(analyticsRequest);

The problem is that the analytics endpoint seems to be designed for historical data. It returns data in intervals. I don’t want historical data. I want the current state.

Also, the analytics endpoint requires me to specify a date range. If I use the current time, it might not have the data yet because of latency. The conversations endpoint is more real-time.

So, which one should I use for real-time agent activity?

If I use conversations, I have to calculate the duration myself. If I use analytics, I might not get the data in time.

I’ve also tried using webhooks, but the payload is too large and I have to parse a lot of unnecessary data. I just want the duration and wait time.

Any advice on how to handle this? I want to avoid making too many API calls. The agent desktop is already slow enough.