Sendbird

Functions to integrate SendBird chat into your app.

circle-info

You'll need to import the javascript file in your website before starting from this linkarrow-up-right.

Initialize

Initializes SendBird with a user ID and connects the user to the SendBird service.

window.WTN.SendBird.sendbirdInitialize({
  userId: "user123",
  nickname: "John",
  profileurl: "https://example.com/avatar.png",
  callback: function (response) {
    console.log(response);
  },
});

Parameters:

Key
Type
Required
Description

userId

String

Yes

The unique user ID to connect with.

nickname

String

No

Display name for the user.

profileurl

String

No

URL of the user's profile image.

callback

Function

No

Callback function invoked with the response.


Is Initialized

Checks whether SendBird has been initialized.

Callback Response:

Key
Type
Description

initialized

Boolean

Whether SendBird has been initialized.

appId

String

The SendBird application ID.


Is Connected

Checks whether the user is currently connected to SendBird.

Callback Response:

Key
Type
Description

connected

Boolean

Whether the user is connected to SendBird.


Get User ID

Retrieves the currently connected user's ID.

Callback Response:

Key
Type
Description

userId

String

The current user's SendBird user ID.


Update User Info

Updates the current user's nickname and/or profile image URL.

Parameters:

Key
Type
Required
Description

nickname

String

No

The new display name for the user.

profileurl

String

No

The new profile image URL for the user.

callback

Function

No

Callback function invoked with the response.

Callback Response:

Key
Type
Description

success

Boolean

Whether the user info was updated.


Create Group Channel

Creates a new group channel with the specified users.

Parameters:

Key
Type
Required
Description

name

String

No

The name of the group channel.

userIds

String[]

No

An array of user IDs to add to the channel.

isDistinct

Boolean

No

If true, reuses an existing channel with the same members instead of creating a new one.

callback

Function

No

Callback function invoked with the response.

Callback Response:

Key
Type
Description

success

Boolean

Whether the channel was created successfully.

channelUrl

String

The URL of the created group channel.


Show UI

Opens the full SendBird chat UI showing the channel list.

Callback Response:

Key
Type
Description

success

Boolean

Whether the UI was shown successfully.

status

String

Status of the UI display operation.


Show Channel UI

Opens the SendBird chat UI for a specific channel.

Parameters:

Key
Type
Required
Description

url

String

No

The channel URL to open.

callback

Function

No

Callback function invoked with the response.

Callback Response:

Key
Type
Description

success

Boolean

Whether the channel UI was shown successfully.

status

String

Status of the UI display operation.

channelUrl

String

The URL of the displayed channel.


Disconnect

Disconnects the current user from SendBird. The user can reconnect later using sendbirdInitialize.

Callback Response:

Key
Type
Description

success

Boolean

Whether the disconnect was successful.


Logout

Logs out the current user from SendBird and cleans up all resources including push notification tokens.

Callback Response:

Key
Type
Description

success

Boolean

Whether the logout was successful.

Logout differs from disconnect in that it also unregisters the device's push notification token and clears all stored SendBird data. Use sendbirdDisconnect for temporary disconnections and sendbirdLogout when the user is signing out of your app.

Last updated