Home > How to get your agent status via the getAgentStatusAsync() API

Categories:


(Last Updated On: July 18, 2017)

Love coding and want to get your Agents status with an API? Well, you are in luck!

See the Javascript API Doc for .getAgentStatusAsync() here.

Here is how it works:

You can call this new API with an anonymous function as an argument. That anonymous function takes a boolean argument (online, in the example below) which will evaluate to the chat team’s online status (“offline” status may also be triggered by other settings such as being outside your defined Hours of Operation).

The check is asynchronous. After the getAgentStatusAsync() call, the rest of your code continues. When the result of .getAgentStatusAsync() is available, it will trigger the anonymous function (usually within a second).

The getAgentStatusAsync() call can be added to the advanced code after the line:
//Place your SnapEngage JS API Code below.

Note: If you have not added or update your code since 1/1/2013:
We highly recommend you update to the newer, better, faster, stronger version of the code by going to the “Get the code” tab in your Admin Dashboard and replacing your old code with the new one.

When using the old code, add the getAgentStatusAsync() after the addButton() or init() call has been done (after SnapEngage has been initialized).


Here is a simple example that will show an alert with the agent status:

Did you find this article helpful?

Not HelpfulNeeds WorkSo-soHelpfulVery Helpful (3 votes, average: 3.67 out of 5)
Loading ... Loading ...

Published January 12, 2012