Display Phone Number Based On Zendesk Availability

Like many tech companies, we work crazy hours and team members often work remotely. Sometimes we’re here early, some nights we work late, and sometimes we’re celebrating a milestone at a favorite Austin spot.

We use live chat on our site to help our customers and a standard feature of these tools is to dynamically show the chat button when your team is logged in and available. Having chat show up dynamically provides a better experience to our customers.

We were curious to see if we could show and hide our phone number in a similar fashion.

Learn more in this related guide: 4 Ways to Find Out If Modern Org Chart  Software Makes Sense.

One solution you could use is to display the phone number based on the time of day. The code would look something like this:

But what if the team is swamped? It would be great to only show the phone number if someone is on the other end.

We built a tool that does just that. At Pingboard, we use Zendesk for our customer support tickets. The Zendesk API shows your team’s availability in real time.

Our API call looks something like this:

And the response from Zendesk looks like this:

Using Javascript, we parse the response to see if any agents are available and if they are, the phone number is displayed on the site.

We cache the response for five minutes to minimize the number of API calls.

For further reading, here are some resources for you to check out:

Download Now

by Bill Boebel
Founder and CEO of Pingboard.
blog comments powered by Disqus