nick.wright | 2023-02-14 10:40:44 UTC | #1
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.euwest2);
const routingApi = new platformClient.RoutingApi(); const CLIENTID = "XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX"; const CLIENTSECRET = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
exports.handler = async (event) => {
client.loginClientCredentialsGrant(CLIENTID, CLIENTSECRET) .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: https://developer.genesys.cloud/forum/t/about-loginclientcredentialsgrant/14958
But it isn't returning anything or logging and messages. What's wrong with it?
tim.smith | 2023-02-14 14:12:17 UTC | #2
Closing as a duplicate of https://developer.genesys.cloud/forum/t/calling-api-from-lambda/18396
tim.smith | 2023-02-14 14:12:23 UTC | #3
This post was migrated from the old Developer Forum.
ref: 18407