Check Agent Availability

Before starting a session, you can check the availability of your chat agents and then provide your users with more accurate expectations.

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.

Important

If you use the Permitted Domains setting in your Chat deployment, you’ll get unreliable information from the chat availability check in the SDK. For instance, the agent availability status may always return false. If you want to use Permitted Domains for your web chat deployment, we strongly advise that you create a separate deployment for the Service SDK.

Warning

To check whether agents are available, call the determineAvailabilityWithConfiguration method on the chatCore property, similar to how you start a chat session.

In Swift:

let config = SCSChatConfiguration(liveAgentPod: "YOUR-POD-NAME",
                                  orgId: "YOUR-ORG-ID",
                                  deploymentId: "YOUR-DEPLOYMENT-ID",
                                  buttonId: "YOUR-BUTTON-ID")

ServiceCloud.shared().chatCore.determineAvailability(with: config,
                           completion: { (error: Error?, 
                                          available: Bool, 
                                          estimatedWaitTime: TimeInterval) in

  if (error != nil) {
    // TO DO: Handle error
  }
  else if (available) {
    // TO DO: Enable chat button...

    // Optionally, use the estimatedWaitTime to
    // show an estimated wait time until an agent
    // is available. This value is only valid if 
    // SCSChatConfiguration.queueStyle is set to
    // EstimatedWaitTime. Estimate is returned
    // in seconds.
  } 
  else {
    // TO DO: Disable button or warn user that no agents are available
  }

})

In Objective-C:

SCSChatConfiguration *config =
  [[SCSChatConfiguration alloc] initWithLiveAgentPod:@"YOUR-POD-NAME"
                                               orgId:@"YOUR-ORG-ID"
                                        deploymentId:@"YOUR-DEPLOYMENT-ID"
                                            buttonId:@"YOUR-BUTTON-ID"];

[[SCServiceCloud sharedInstance].chatCore 
                 determineAvailabilityWithConfiguration:config 
                     completion:^(NSError *error, BOOL available, 
                                  NSTimeInterval estimatedWaitTime) {

  if (error != nil) {
    // TO DO: Handle error
  }
  else if (available) {
    // TO DO: Enable chat button...

    // Optionally, use the estimatedWaitTime to
    // show an estimated wait time until an agent
    // is available. This value is only valid if 
    // SCSChatConfiguration.queueStyle is set to
    // EstimatedWaitTime. Estimate is returned
    // in seconds.
  } 
  else {
    // TO DO: Disable button or warn user that 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.