# Chat Javascript API - How to tell if agent online?

**URL:** <https://community.hubspot.com/t/chat-javascript-api-how-to-tell-if-agent-online/17245>\
**Category:** APIs & Integrations\
**Tags:** cms-content\
**Created:** [November 18, 2019, 1:29am UTC](https://community.hubspot.com/t/chat-javascript-api-how-to-tell-if-agent-online/17245 "2019-11-18T01:29:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mark1/32/59606_2.png) [@Mark1](https://community.hubspot.com/u/Mark1)\
**Post date:** [November 18, 2019, 1:29am UTC](https://community.hubspot.com/t/chat-javascript-api-how-to-tell-if-agent-online/17245/1 "2019-11-18T01:29:16Z")

</div>

Hi,

I want to show certain content based on the availaibility of the Chat Agent i.e. if online show content A if offline show content B.

I can’t see anything in the API so just seeing if anyone has any suggesions?

Cheers,

Mark

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [November 18, 2019, 7:08pm UTC](https://community.hubspot.com/t/chat-javascript-api-how-to-tell-if-agent-online/17245/2 "2019-11-18T19:08:09Z")

</div>

Hi, @Mark1.

As you noted, the [Conversations JavaScript API](https://developers.hubspot.com/docs/methods/conversations_api/hubspot-conversations-javascript-api) currently doesn’t contain methods relating to agent status or activity. We’ll have to think creatively.

If you set the chat launcher to hide when all agents are away (see screenshot below) then the `widget.status` will be `false` and you can use JavaScript to hide or reveal different content. Would something like that work?

 ![Hide chat launcher.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/3X/1/3/1305e0678aca9c64b90e5b6564f1301773945a2d.jpeg)

---

<div class="post-metadata">

**Author:** ![Mark1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mark1/32/59606_2.png) [@Mark1](https://community.hubspot.com/u/Mark1)\
**Post date:** [November 18, 2019, 7:13pm UTC](https://community.hubspot.com/t/chat-javascript-api-how-to-tell-if-agent-online/17245/3 "2019-11-18T19:13:03Z")

</div>

Thanks for you response. It would technically work however we still want Chat to be available to visitors even if all Agents are offline (so we can capture offline messages for follow up later). Any other Ideas?

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [November 18, 2019, 7:26pm UTC](https://community.hubspot.com/t/chat-javascript-api-how-to-tell-if-agent-online/17245/4 "2019-11-18T19:26:14Z")

</div>

That makes sense, Mark.

Unfortunately, I can’t think of any workarounds for that use case with the available methods.  
The product team certainly wants to make the Conversations JavaScript API more robust and useful, though, so I recommend upvoting and commenting on [this feature request](https://community.hubspot.com/t5/HubSpot-Ideas/Live-chat-agent-status-control-though-API/idi-p/269699). I just threw an upvote on there myself.
