I am trying to get a list of routing queues via a Lambda function using client credentials. This is my code:
const platformClient = require('purecloud-platform-client-v2');
const client = platformClient.ApiClient.instance;
client.setEnvironment(platformClient.PureCloudRegionHosts.eu_west_2);const routingApi = new platformClient.RoutingApi();
const CLIENT_ID = "XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX";
const CLIENT_SECRET = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";exports.handler = async (event) => {
client.loginClientCredentialsGrant(CLIENT_ID, CLIENT_SECRET) .then(() => { let queues = routingApi.getRoutingQueues() .then((data) => { console.log("Queues", data); return data; }) .catch((err) => { console.log('There was a failure calling getOrganizationsMe'); console.error(err); }); }) let retValue = { statusCode: 200, body: "done", //JSON.stringify(returnMsg), }; return retValue;
};
This code has been adapted from this post: About loginClientCredentialsGrant
But it isn't returning anything or logging and messages. What's wrong with it?