I’m stuck on pagination logic for the Genesys Cloud JavaScript SDK. The goal is to pull every queue across multiple divisions, but the routingApi.getRoutingQueues() call only returns results for the authenticated user’s default division. I’ve tried passing divisionId in the query params, but that just locks me into a single division. I need to iterate through all available divisions first, then fetch queues for each. Here’s the current approach:
const { GenesysCloudPlatformClient } = require('@genesyscloud/genesyscloud');
const client = new GenesysCloudPlatformClient();
async function getAllQueues() {
const divisions = await client.platformClient.organizations.getOrganizationsDivisions();
let allQueues = [];
for (const div of divisions.entities) {
const queues = await client.platformClient.routing.getRoutingQueues({
divisionId: div.id,
pageSize: 100
});
allQueues = allQueues.concat(queues.entities);
}
return allQueues;
}
The issue is getOrganizationsDivisions() requires organization:division:read scope which my app token doesn’t have. I tried switching to routingApi.getRoutingQueues() without a division ID, hoping it would return all accessible queues, but it defaults to the user’s division. Is there a way to list accessible divisions via the SDK, or should I be using a different endpoint? The API docs are vague on multi-division queries.