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,
Â
Jira webhook to ping a self-setup server with script listener running whenever a Chat issue is created/replied
The script recognizes the issue, and check the current online agent list from Chat API
The script uses its own algorithm to determine which agent should be the assignee of this issue
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.