My configuration keeps failing for fetching live queue metrics.
I am building a self-hosted n8n workflow to poll real-time queue statistics (waiting count, agents available) every 30 seconds. The goal is to trigger alerts when wait times exceed thresholds. I am using the standard HTTP Request node with OAuth2 credentials configured correctly, as verified by successful calls to /api/v2/users/me. However, the specific Statistics API endpoint returns a 400 Bad Request error immediately. I suspect the query parameters for interval or groupBy are malformed, but the documentation is ambiguous about required fields for real-time snapshots versus aggregated data.
Here is the current request configuration:
{
"nodeVersion": 2,
"parameters": {
"requestMethod": "GET",
"url": "https://api.mypurecloud.com/api/v2/analytics/queues/realtime",
"options": {
"qs": {
"interval": "now-1m/now",
"groupBy": "queue",
"queueIds": "{{ $json.queueId }}"
}
}
}
}
The error response body is generic: {"code":"bad.request","message":"Invalid query parameters."}. I have tried removing groupBy and using queueId as a path parameter instead, but both result in 400 errors. Is the interval format incorrect for real-time data, or is there a specific header required for this endpoint that n8n is omitting? I need to know the exact parameter structure to stabilize this automation pipeline.