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:

1let config = SCSChatConfiguration(liveAgentPod: "YOUR-POD-NAME",
2                                  orgId: "YOUR-ORG-ID",
3                                  deploymentId: "YOUR-DEPLOYMENT-ID",
4                                  buttonId: "YOUR-BUTTON-ID")
5
6ServiceCloud.shared().chatCore.determineAvailability(with: config,
7                           completion: { (error: Error?, 
8                                          available: Bool, 
9                                          estimatedWaitTime: TimeInterval) in
10
11  if (error != nil) {
12    // TO DO: Handle error
13  }
14  else if (available) {
15    // TO DO: Enable chat button...
16
17    // Optionally, use the estimatedWaitTime to
18    // show an estimated wait time until an agent
19    // is available. This value is only valid if 
20    // SCSChatConfiguration.queueStyle is set to
21    // EstimatedWaitTime. Estimate is returned
22    // in seconds.
23  } 
24  else {
25    // TO DO: Disable button or warn user that no agents are available
26  }
27
28})

In Objective-C:

1SCSChatConfiguration *config =
2  [[SCSChatConfiguration alloc] initWithLiveAgentPod:@"YOUR-POD-NAME"
3                                               orgId:@"YOUR-ORG-ID"
4                                        deploymentId:@"YOUR-DEPLOYMENT-ID"
5                                            buttonId:@"YOUR-BUTTON-ID"];
6
7[[SCServiceCloud sharedInstance].chatCore 
8                 determineAvailabilityWithConfiguration:config 
9                     completion:^(NSError *error, BOOL available, 
10                                  NSTimeInterval estimatedWaitTime) {
11
12  if (error != nil) {
13    // TO DO: Handle error
14  }
15  else if (available) {
16    // TO DO: Enable chat button...
17
18    // Optionally, use the estimatedWaitTime to
19    // show an estimated wait time until an agent
20    // is available. This value is only valid if 
21    // SCSChatConfiguration.queueStyle is set to
22    // EstimatedWaitTime. Estimate is returned
23    // in seconds.
24  } 
25  else {
26    // TO DO: Disable button or warn user that no agents are available
27  }
28
29});

To understand the algorithm used for the estimated wait time, see the estimated wait time documentation in the Chat REST API Developer Guide.