Consuming the v2.analytics.conversation.aggregate webhook event but the nested JSON payload doesn’t match the documentation. The aggregationData object contains unexpected keys that break our Terraform-driven schema validation. Here is the sample payload causing the issue. What is the correct structure for parsing this event?
Are you using the default aggregation window or a custom one? The schema changes significantly depending on whether you are pulling real-time snapshots or historical rollups.
The aggregationData object is dynamic. It doesn’t have fixed keys for every metric. Instead, it uses metric names as keys. If you are seeing unexpected keys, check your Analytics view configuration. Those keys correspond exactly to the metrics selected in the View.
Here is how I handle this in . I don’t validate against a static JSON schema. That breaks too often. Instead, I use a to filter the keys I actually need.
// : Filter aggregationData
function processAggregation(payload) {
const data = payload.aggregationData;
const requiredMetrics = ["call_count", "handle_time"];
// Extract only known metrics
const cleanData = {};
requiredMetrics.forEach(metric => {
if (data && data[metric]) {
cleanData[metric] = data[metric];
}
});
return cleanData;
}
You can also check the View definition via API to see what metrics are included. Use GET /api/v2/analytics/views/{viewId}. Look at the metrics array in the response. Every item in that array will appear as a key in aggregationData if data exists.
If you are using Terraform for schema validation, that is likely the bottleneck. The webhook payload structure is not strictly typed in the same way a database table is. It is a map. Your validation logic needs to be flexible. Ignore keys you don’t recognize. Focus on the ones you defined in the View.
Also check the groupBy array. If you group by agent or queue, the structure nests deeper. You might be hitting a case where the group-by value creates an unexpected key structure. Verify your group-by settings in the Analytics UI.
The documentation shows a simplified example. Real payloads are messier. Build your parser to expect noise. Filter what you need. Discard the rest.