Platform SDK JS: Fetching queues across multiple divisions

Trying to pull every queue in our org using the JS SDK. The getQueues method only returns results for the default division. I’ve tried setting the divisionId, but it seems limited to one at a time. The pagination loop works fine for a single division, but iterating through all division IDs feels clunky. Is there a built-in way to fetch across divisions without manual looping?

Yeah, the SDK doesn’t have a magic “getAllDivisions” method for queues. You’re stuck iterating, but you don’t need to manually loop through division IDs if you don’t want to. Just query the divisions endpoint first, then map over that list.

Here’s how I usually handle it in Node. It’s a bit verbose, but it keeps the logic clean. You’ll need the divisionId in the queue query parameters for each pass.

const { PlatformClient } = require('@genesyscloud/genesyscloud');

async function getAllQueues(client) {
 const divisions = await client.Jwt.getJwtToken(); // assuming auth is done
 const { entities } = await client.Organizations.getOrganizations(); // or getDivisions depending on setup
 
 const allQueues = [];
 for (const div of entities) {
 const { entities: queues } = await client.Queues.getQueues({ divisionId: div.id });
 allQueues.push(...queues);
 }
 return allQueues;
}

Watch out for rate limits though. If you have hundreds of divisions, you’ll hit the ceiling fast. Maybe add a small delay between requests.