Before starting a session, you can check the availability of your chat agents and then provide your users with more accurate expectations. For instance, when no agents are available, you can hide or disable the button to contact an agent
important: The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to Messaging for In-App and Web before that date. Messaging offers many of the chat features that you love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in Help.
To check whether agents are available, create an AgentAvailabilityClient object and asynchronously check the AvailabilityState status.
In Java:
// Build a configuration object
ChatConfiguration chatConfiguration =
new ChatConfiguration.Builder(ORG_ID, BUTTON_ID,
DEPLOYMENT_ID, LIVE_AGENT_POD)
.build();
// Create an agent availability client
Boolean requestEstimatedWaitTime = false; // Don’t request if we don’t plan to use it
AgentAvailabilityClient client = ChatCore.configureAgentAvailability(chatConfiguration, requestEstimatedWaitTime);
// Check agent availability
client.check().onResult(new Async.ResultHandler<AvailabilityState>() {
@Override
public void handleResult (Async<?> async, @NonNull AvailabilityState state) {
switch (state.getStatus()) {
case AgentsAvailable: {
// TO DO: Handle the case where agents are available
// Optionally, use the estimatedWaitTime to
// show an estimated wait time until an agent
// is available. This value is only valid
// if you request it from the
// configureAgentAvailability call above.
// Estimate is returned in seconds.
Integer ewt = state.getEstimatedWaitTime();
break;
}
case NoAgentsAvailable: {
// TO DO: Handle the case where no agents are available
break;
}
case Unknown: {
break;
}
}
});
In Kotlin:
// Build a configuration object
val chatConfiguration = ChatConfiguration.Builder(ORG_ID, BUTTON_ID,
DEPLOYMENT_ID, LIVE_AGENT_POD).build()
// Create an agent availability client
val requestEstimatedWaitTime = false // Don’t request if we don’t plan to use it
val client = ChatCore.configureAgentAvailability(chatConfiguration, requestEstimatedWaitTime)
// Check agent availability
client.check().onResult(object: Async.ResultHandler<AvailabilityState> {
override fun handleResult(operation: Async<*>?, result: AvailabilityState) {
when (result.getStatus()) {
AvailabilityState.Status.AgentsAvailable -> {
// TO DO: Handle the case where agents are available
// Optionally, use the estimatedWaitTime to
// show an estimated wait time until an agent
// is available. This value is only valid
// if you request it from the
// configureAgentAvailability call above.
// Estimate is returned in seconds.
val ewt = result.getEstimatedWaitTime()
}
AvailabilityState.Status.NoAgentsAvailable -> {
// TO DO: Handle the case where no agents are available
}
}
}
})
To understand the algorithm used for the estimated wait time, see the estimated wait time documentation in the Chat REST API Developer Guide.
You can also use this API to get an updated Chat server before starting a session to determine whether a server has changed for your pod. Call the getLiveAgentPod method from the AvailabilityState object you get back from the AgentAvailabilityClient. If the server has changed, update this configuration value in the future to prevent an unnecessary round-trip request.