List of Agents and their Active Chats

At the moment I’m currently trying to integrate some real-time stats from LiveChat Inc into a dashboard.

I’m finding it quite easy to pull a list of currently logged in Agents, however I’m a bit stumped trying to find an API call I can use to get either their currently active chats or at the very least a count of how many they’re currently active on.

Is there anyway to do this via the currently available API calls?

Hello @kdonaldson,

Thank you for reaching us with this!

Actually, there are two ways to do it:

The most efficient way to get new chats handled by your agents would be to use our webhooks -> specifically, the incoming_chat_thread webhook, available in our Configuration v.3. You can register this webhook in LiveChat, so that every time one of your customers will start a conversation, your system will receive the payload that will include the information like:

  1. Thread ID;
  2. Customer ID;
  3. Agent ID (email address).

After receiving this payload, you should be able to match the thread ID with your agents, based on the email address of the operator handling the chat. You can also register additional thread_closed webhook, that will be triggered whenever a conversation with your agent is finished (so that you can reflect this information on a dashboard as well). If you’d like to learn more about how such webhooks can be registered and what are they all about, you can check out our official documentation: https://developers.livechatinc.com/docs/management/configuration-api/#webhooks

The other way to receive chats that are currently active on your license would be the get_chats_summary method, available in our Agent Chat API (click here to learn more). This method will provide you with the list of all chats that are currently active on your license, together with the details like:

  1. Thread ID;
  2. Customer ID;
  3. Agent ID (email address).

This method can also be used to get the list of currently active chats and match them with the agents on your dashboard (the active chats will include the "active": true property).

@kdonaldson I hope that this helps! If you have any additional questions, please don’t hesitate to ask.

1 Like