Before using features of the Desk SDK for iOS in a client app, the SBDSKMain instance must be initialized first when launching a client app. As the Desk SDK handles messages within a ticket based on Sendbird Chat, customers from Sendbird Chat should go through the user authentication with the Desk SDK before starting a chat with an agent.

Initialize the Desk SDK

Initialize the SBDSKMain instance when launching a client app. Next, copy the APP_ID of your Sendbird application from the Sendbird Dashboard. Then, call the SBDMain.initWithApplicationId() method using the copied APP_ID within the applicationDidFinishLaunching(). Make sure to use the same APP_ID from the Chat SDK at this point. Lastly, call the SBDMain.initializeDesk() method within the applicationDidFinishLaunching().

// Initialize the SBDSKMain instance to use APIs in your app.
class AppDelegate: UIApplicationDelegate {
    func applicationDidFinishLaunching(_ application: UIApplication) {

Note: If you call the SBDSKMain.initializeDesk() again after calling the SBDMain.initWithApplicationId() with a different APP_ID, all existing Desk-related data in the client app will be deleted.

Depending on the chat environment you want to provide to your customers, you can use the Chat SDK alone or both the Chat and Desk SDKs together.

Usage of SDKs

SDKUsed for

Chat SDK

In-app chat where customers can chat with each other.

Chat and Desk SDKs

Customer support that enables customers to request help from agents.

Authenticate a customer from Sendbird Chat

Every ticket in Sendbird Desk is mapped to a group channel in Sendbird Chat because messages within a ticket are handled by Sendbird Chat. Therefore, your customer needs authentications from both the Chat SDK and the Desk SDK to receive and send a message within a ticket. Use the SBDMain.connect() and the SBDMain.authenticate() methods with a customer's user ID used in Sendbird Chat to authenticate a customer.

// Use a user ID that is unique to your Sendbird application.
SBDMain.connect(withUserId: USER_ID, accessToken: ACCESS_TOKEN) { (user, error) in
    guard error == nil else {
        // Handle error.

    // Use the same user ID and access token used in the SBDMain.connect().
    SBDSKMain.authenticate(withUserId: USER_ID, accessToken: ACCESS_TOKEN) { (error) in
        guard error == nil else {
            // Handle error.

        // SendBirdDesk is now initialized,
        // and the customer is authenticated and connected to Sendbird server.

If you're implementing the Chat SDK and the Desk SDK simultaneously, connect a user to Sendbird server with their user ID and access token first.

Note: Customers from social media, such as Instagram or Twitter, are automatically authenticated on the Sendbird Dashboard with their social media account.