Can anyone clarify the correct JSON schema structure for custom metrics in genesyscloud_integration_action?
- Provider v1.15.0
- Error: `400 Bad Request: Validation failed for field ‘metrics’
- Terraform state shows resource created, but Genesys Cloud UI displays no data
- Payload includes valid
metricType and filter arrays
- Environment: us-east-1
- GitHub Actions pipeline fails on apply step
Seeking working HCL example for analytics export.
The main issue here is that the dashboard layer expects specific metric definitions that align with the internal Genesys Cloud data model, rather than arbitrary custom fields. When configuring Analytics Data Actions via Terraform, the genesyscloud_integration_action resource requires strict adherence to the documented schema for the metrics block. A common oversight is defining the metricType without ensuring the corresponding filter structure matches the expected hierarchy for that specific type.
Consider adjusting the configuration to explicitly define the metric structure as follows:
- Verify that the
metricType corresponds to a supported built-in metric (e.g., QUEUE_HANDLED, AGENT_HANDLED) rather than a custom string.
- Ensure the
filter array contains objects with valid dimension and value pairs that exist in your organization’s data.
- Check that the
integrationActionId references an active and correctly configured integration.
Example configuration snippet:
resource "genesyscloud_integration_action" "example" {
integration_action_id = "your-action-id"
name = "Custom Metrics Action"
description = "Action for custom metrics"
metrics {
metricType = "QUEUE_HANDLED"
filter {
dimension = "queueId"
value = ["queue-id-123"]
}
}
}
After updating the Terraform state, re-run the apply step. If the issue persists, validate the JSON payload against the Genesys Cloud API documentation for integration actions. The UI may not display data immediately if the metric definition does not match any existing records in the analytics engine. Confirming the metric definitions align with actual queue or agent activity will resolve the validation error and ensure data visibility in the dashboard.
The docs actually state the metrics array needs explicit type definitions for each entry to pass validation.
metrics {
name = "custom_metric"
metric_type = "COUNT"
}