Aggregate Conversation Insights
Aggregate conversation insights by specified fields
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.ai.conversations.conversationInsights.retrieveAggregates();
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.ai.conversations.conversation_insights.retrieve_aggregates()
print(response.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.AI.Conversations.ConversationInsights.GetAggregates(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
var response = client.ai().conversations().conversationInsights().retrieveAggregates();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.ai.conversations.conversation_insights.retrieve_aggregates
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->ai->conversations->conversationInsights->retrieveAggregates();
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ai:conversations:conversation-insights retrieve-aggregates \
--api-key 'My API Key'curl --request GET \
--url https://api.telnyx.com/v2/ai/conversations/conversation-insights/aggregates \
--header 'Authorization: Bearer <token>'{
"data": [
{
"record_count": 0
}
]
}{
"detail": [
{
"loc": [
"body",
"name"
],
"msg": "Field required",
"type": "missing"
}
]
}Authorizations
Query Parameters
Fields to group by (can be comma-separated or multiple parameters). Prefix a field with 'metadata.' (e.g. 'metadata.assistant_id') to group by the conversation's metadata instead of the insight result.
Common fields used for over-time charts:
score— Group by the insight's score value (e.g. for Agent Instruction Following, User Satisfaction).metadata.assistant_id— Group by the assistant that handled the conversation.metadata.assistant_version_id— Group by the assistant version, useful for comparing performance across versions in the portal's 'Insights Over Time' chart.metadata.telnyx_conversation_channel— Group by conversation channel (phone_call, web_chat, etc.).
Filter by creation datetime to scope the aggregation window. Supports range operators (e.g., created_at=gte.2025-01-01T00:00:00Z for the start of the range, created_at=lt.2025-01-02T00:00:00Z for the end). To build per-day time series (as the portal does for the 'Insights Over Time' chart), issue one request per day bounded by created_at=gte.<day_start> and created_at=lt.<next_day_start>.
Response
Successful Response
Aggregated conversation insight counts grouped by the specified fields. Each item in data contains the grouped field values and a record_count indicating how many conversation insights match that combination.
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.ai.conversations.conversationInsights.retrieveAggregates();
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.ai.conversations.conversation_insights.retrieve_aggregates()
print(response.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.AI.Conversations.ConversationInsights.GetAggregates(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
var response = client.ai().conversations().conversationInsights().retrieveAggregates();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.ai.conversations.conversation_insights.retrieve_aggregates
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->ai->conversations->conversationInsights->retrieveAggregates();
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ai:conversations:conversation-insights retrieve-aggregates \
--api-key 'My API Key'curl --request GET \
--url https://api.telnyx.com/v2/ai/conversations/conversation-insights/aggregates \
--header 'Authorization: Bearer <token>'{
"data": [
{
"record_count": 0
}
]
}{
"detail": [
{
"loc": [
"body",
"name"
],
"msg": "Field required",
"type": "missing"
}
]
}