Desk / Android
Home
/
Desk
/
Android

Authentication

In order to use features of the Desk SDK in your client apps, the SendBirdDesk instance should be connected with Sendbird server, and customers from Sendbird Chat should go through the user authentication with the Desk server using the SendBirdDesk.authenticate(). Once authenticated, customers can live-chat with agents based on Sendbird Chat platform.

Note: Customers can request support from various types of channels. They can submit tickets from in-app chats or social media such as Facebook, Instagram and Twitter. Customers from social media are automatically registered in your dashboard with their social media accounts without any authentication process.


Initialize the Desk SDK with APP_ID

A SendBirdDesk instance must be initialized when launching a client app. Call the SendBird.init() and the SendBirdDesk.init() methods within the Application.onCreate(). The Sendbird.init() should be called first by the APP_ID of your Sendbird application in the dashboard. However, if you initiate the SendBirdDesk again with a SendBird instance initiated by a different APP_ID, all existing Desk-related data in the client app will be cleared.

Light Color Skin
Copy
// Initialize SendBirdDesk instance to use APIs in your app.
public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        SendBird.init(APP_ID, this);
        SendBirdDesk.init();
    }
}

Note: Built with Sendbird Chat platform, Sendbird Desk SDK is a plugin that handles customer inquiries through tickets. Messages within tickets are dealt with by Sendbird Chat platform, and every ticket is mapped to a group channel of Sendbird Chat. Because of this interaction, the same APP_ID should be used for both Desk and Chat SDKs.

It is possible to use the Chat SDK only or both Chat and Desk SDKs together in your client app depending on the chat service you want to provide.

Usage of SDKs

SDKUsed for

Chat SDK

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

Chat and Desk SDKs

Tickets where customers can chat with agents.


Authenticate to the Desk server

If a customer comes from Sendbird Chat platform, authenticate them using the authenticate() method with their user IDs. If a customer comes from social media such as Instagram or Facebook, they are automatically registered in the dashboard with their social media accounts without any authentication process.

Note: Customers from Sendbird Chat platform signifies users who are already authenticated with the Chat SDK. If you’re implementing Chat SDK and Desk SDK at the same time, connect a user to Sendbird server with their user ID and access token first.

Light Color Skin
Copy
// The USER_ID below should be unique to your Sendbird application.
SendBird.connect(USER_ID, ACCESS_TOKEN, new SendBird.ConnectHandler() {
    @Override
    public void onConnected(User user, SendBirdException e) {
        if (e != null) {
            // Handle error.
        }

        // Use the same user Id and access token used in the SendBird.connect().
        SendBirdDesk.authenticate(USER_ID, ACCESS_TOKEN, new SendBirdDesk.
            AuthenticateHandler() {
                @Override
                public void onResult(SendBirdException e) {
                    if (e != null) {
                        // Handle error.
                    }

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

        ...
    }
});