How to fetch current online agent list from Chat API

In some situations, the current online agent list (Chat Dashboard) can be useful when it combines with Jira Webhook + Scripting + Jira API to achieve the automatic assigning function.

 

The following is the API how to fetch the list of the current online agents,

The API endpoint is as follow,

/public/online?jiraId=<jiraId>&projectId=<projectId>

at the base URL

https://chat-api.spartez-software.com/

It will require a basic auth header with API token, as described in https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/

 

 

The user permission of ADMINISTER_PROJECTS will be checked in this API, and if the user has enough permissions, the API will return full details of online agents in the onlineAgents property of the JSON response.

 

A common use case would be as the following,

 

  1. Jira webhook to ping a self-setup server with script listener running whenever a Chat issue is created/replied

  2. The script recognizes the issue, and check the current online agent list from Chat API

  3. The script uses its own algorithm to determine which agent should be the assignee of this issue

  4. The script uses standard Jira API (https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-assignee-put ) to assign this issue to that agent.