Desk SDKs JavaScript v1
Desk SDKs JavaScript
Desk SDKs
Version 1


Copy link

Before using features of the Desk SDK for JavaScript in a client app, the SendBirdDesk 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

Copy link

To initialize the Desk SDK, call the SendBirdDesk.init() method and pass the SendbirdChat class that is already initialized by the APP_ID of your Sendbird application on the Sendbird Dashboard.

// Initialize SendBirdDesk instance to use APIs in your app.

There's an option to add DeviceOsPlatform and when setting up, it's recommended that you set it as MOBILE_WEB in case you're using React Native.

init(sendbird: SendbirdGroupChat, platform?: DeviceOsPlatform)

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

Copy link
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 a customer from Sendbird Chat

Copy link

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 with the same user ID. Use the sb.connect() method to send and receive a message and the SendBirdDesk.authenticate() methods to retrieve or update a ticket.

// Use a user ID that is unique to your Sendbird application.
async function connectDesk() {
    const params = {
        appId: APP_ID,
        modules: [new GroupChannelModule()],
    const sb = SendbirdChat.init(params);
    try {
        await sb.connect(USER_ID);
            // authentication callback
            () => {
                // The customer is authenticated and connected to the Sendbird server.
        // The customer is authenticated and connected to the Sendbird server.
    } catch (error) {
        // Handle error.

// Running the connectDesk() function.

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.