WebChat Widget 403 Forbidden on Analytics Data Source Fetch via Terraform

Has anyone hit a 403 when trying to read webchat session analytics via the genesyscloud_analytics_query data source in Terraform?

We are automating the extraction of digital channel KPIs for our Sydney team. The setup works fine for voice metrics, but digital channels throw a permission error during plan phase.

Environment:

  • Terraform: v1.6.4
  • Genesys Cloud Provider: v1.65.0
  • Auth: Client Credentials (OAuth)
  • Permissions: analytics:view, analytics:report:view, webchat:session:view

HCL Snippet:

data "genesyscloud_analytics_query" "webchat_kpi" {
 query {
 metrics = ["sessionCount", "avgDuration"]
 timeGrouping = "daily"
 filters = [
 {
 group = "all"
 filter = {
 type = "equals"
 key = "channelType"
 value = "webchat"
 }
 }
 ]
 }
}

Error Output:

Error: GET https://api.mypurecloud.com/api/v2/analytics/queries?async=true: 403 Forbidden
Response: {"code":"forbidden","message":"Not authorized to perform action"}

We verified the service account has the correct roles. Direct API call via Postman with the same token works. The issue seems specific to the Terraform provider’s handling of the channelType filter for digital channels.

Is there a known bug with the analytics query builder for webchat in this provider version? Or do we need an additional scope not documented in the provider docs?

Appreciate any insights.