Calling Genesys Cloud API in Javascript

Hello Experts,

I saw the Platform API Client SDK - JavaScript in the developer center but I couldn't adapt it to be used in a simple tompermonkey (for demo).

I was wondering if anyone has an example of code in Javascript (without html) of how we call Genesys Cloud APIs.
(The purpose here is to request the number of agents available in a specific queue before poping up the launcher of web messaging).

I used the launcher plugin events and commands to control the pop up but I still can't find how I can Iimplement the API request to get the number of available agents.

Many thanks for helping.

Yassine,

I wouldn't use this for production because it exposed a client id and client secret, which essentially is a username and password that would give someone access to make API requests against your org, but for a tampermonkey demo you can use a Client Credentials grant to get an access token:
https://developer.genesys.cloud/api/tutorials/oauth-client-credentials/#language=nodejs&step=0

Once you have the access token then you can all this API and filter by routing status to find members who are on queue: https://developer.genesys.cloud/api/rest/v2/routing/#get-api-v2-routing-queues--queueId--members

Good luck.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.