---
schema_version: "1"
id: 41f1a31ecd9fdfd3b85f6e87622186db72b6ce232eb95df4c3d8f4680ec8b6a3
title: Get Started with Chat
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/service_sdk_ios/ios_live_agent_quick_start.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.service_sdk_ios.meta/service_sdk_ios/ios_live_agent_quick_start.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: aef490f69750a76f04c50c4335e1a4c946f1c8525d1a69a5f90dc08ba4571ebf
description: Get rolling quickly with chat sessions between your customers and your agents.
---
# Get Started with Chat

Get rolling quickly with chat sessions between your customers and your agents.

![Important](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_ios.meta/service_sdk_ios/images/icon_note_important.png)

#### 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](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5&language=en_US) before that date. Messaging offers many of the [chat features that you](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5&language=en_US) love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1&language=en_US).

Before doing this tutorial, be sure that you’ve set up Service Cloud for Chat. See [Org Setup for Chat in Lightning Experience with a Guided Flow](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_ios.meta/service_sdk_ios/live_agent_cloud_setup.htm "Use the guided setup flow in Lightning Experience to add chat to your org.") for more information.

This tutorial shows you how to get Chat into your iOS app.

1. Create an Xcode project. For this example, let’s make a Single View Application. Name it HelloChat.
    
    ![Single view application](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_ios.meta/service_sdk_ios/images/quickstart-knowledge-ios-singleviewcontroller.png)
    
    ![Hello chat setup](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_ios.meta/service_sdk_ios/images/quickstart-lac-ios-hellolac.png)
2. Install the SDK as described in [Install the for iOS for iOS](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_ios.meta/service_sdk_ios/ios_sdk_install_overview.htm "Before you can use the iOS SDK, install the SDK and configure your project.").
3. Go to your storyboard and place a button somewhere on the view. Name it Chat.
    
    ![Place button](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_ios.meta/service_sdk_ios/images/quickstart-knowledge-ios-button.png)
4. Add a Touch Up Inside action to your UIViewController implementation. Name it launchChat.
    
    ![Button action](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_ios.meta/service_sdk_ios/images/quickstart-lac-ios-action.png)
    
    ![showSOS action](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_ios.meta/service_sdk_ios/images/quickstart-lac-ios-showchat.png)
5. Import the SDK. Wherever you intend to use the Chat SDK, be sure to import the ServiceCore framework and the ServiceChat framework.
    
    In Swift:
    
    import ServiceCore
    import ServiceChat
    
    In Objective-C:
    
    @import ServiceCore;
    @import ServiceChat;
6. Launch a chat session from within the launchChat method.
    
    From the button action implementation, launch chat using the [showChat(with:showPrechat:)](https://forcedotcom.github.io/ServiceSDK-iOS/releases/api/234.1/Classes/SCSChatInterface.html#/c:objc\(cs\)SCSChatInterface\(im\)showChatWithConfiguration:showPrechat:) method on [SCSChatInterface](https://forcedotcom.github.io/ServiceSDK-iOS/releases/api/234.1/Classes/SCSChatInterface.html).
    
    In Swift:
    
    @IBAction func launchChat(sender: AnyObject) {
    
      // Create configuration object
      if let config = SCSChatConfiguration(liveAgentPod: "YOUR\_POD\_NAME",
                                           orgId: "YOUR\_ORG\_ID",
                                           deploymentId: "YOUR\_DEPLOYMENT\_ID",
                                           buttonId: "YOUR\_BUTTON\_ID") {
    
        // Start the session
        ServiceCloud.shared().chatUI.showChat(with: config)
      }
    }
    
    In Objective-C:
    
    \- (IBAction)launchChat:(id)sender {
                            
      SCSChatConfiguration \*config =
        \[\[SCSChatConfiguration alloc\] initWithLiveAgentPod:@"YOUR\_POD\_NAME"
                                                     orgId:@"YOUR\_ORG\_ID"
                                              deploymentId:@"YOUR\_DEPLOYMENT\_ID"
                                                  buttonId:@"YOUR\_BUTTON\_ID"\];
    
      // Start the session
      \[\[SCServiceCloud sharedInstance\].chatUI showChatWithConfiguration:config\];
    }
    
    Fill in the placeholder text for the Chat API endpoint, the org ID, the deployment ID, and the button ID.
    
    Deployment ID
    
    The unique ID of your Chat deployment. To get this value, from Setup, select **Chat** | **Deployments**. The script at the bottom of the page contains a call to the liveagent.init function with the **pod**, the **deploymentId**, and **orgId** as arguments. Copy the **deploymentId** value.
    
    ![Deployment ID](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_ios.meta/service_sdk_ios/images/chat_org_deployment_id.png)
    
    For instance, if the deployment code contains the following information:
    
    <script type='text/javascript' 
            src='https://d.gla3.gus.salesforce.com/content/g/js/44.0/deployment.js'\></script\>
    <script type='text/javascript'\>
    liveagent.init('https://d.gla5.gus.salesforce.com/chat', '573B00000005KXz', '00DB00000003Rxz');
    </script\>
    
    The deployment ID value is:
    
    573B00000005KXz
    
    Be sure not to use the org ID value (which is also in this deployment code) for the deployment ID.
    
    Button ID
    
    The unique button ID for your chat configuration. To get this value, from Setup, search for **Chat Buttons** and select **Chat Buttons & Invitations**. Copy the id for the button from the JavaScript snippet.
    
    ![Button ID](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_ios.meta/service_sdk_ios/images/chat_org_button_id.png)
    
    For instance, if your chat button code contains the following information:
    
    <a id="liveagent\_button\_online\_575C00000004h3m" 
       href="javascript://Chat" 
       style="display: none;" 
       onclick="liveagent.startChat('575C00000004h3m')"\>
       <!-- Online Chat Content -->
    </a\>
    <div id="liveagent\_button\_offline\_575C00000004h3m" 
         style="display: none;"\>
         <!-- Offline Chat Content -->
    </div\>
    <script type="text/javascript"\>
      if (!window.\_laq) { window.\_laq = \[\]; }
      window.\_laq.push(function() { liveagent.showWhenOnline('575C00000004h3m', 
        document.getElementById('liveagent\_button\_online\_575C00000004h3m'));
        liveagent.showWhenOffline('575C00000004h3m', 
        document.getElementById('liveagent\_button\_offline\_575C00000004h3m'));
      });
    </script\>
    
    The button ID value is:
    
    575C00000004h3m
    
    Be sure to omit the liveagent\_button\_online\_ text from the ID when using it in the SDK.
7. Launch **Service Cloud Console**. From the **Omni-Channel** widget, ensure that an agent is online.
    
    ![Omni-channel online](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_ios.meta/service_sdk_ios/images/quickstart-lac-ios-omnichannel.png)

Now you can build and run the app. When you tap the **Chat** button, the app requests a chat session, which an agent can accept from the **Service Cloud Console**. From the console, an agent can real-time chat with a customer.

![Chat publisher](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_ios.meta/service_sdk_ios/images/lac-chat-publisher-ios.png)