To use SendBird's features, first do the following authentication tasks.

Initialize the SDK with APP_ID

To use the chat features, you must initialize SendBird using the APP_ID assigned to your SendBird application. Typically, initialization is implemented in the user login view.

var sb = new SendBird({
    appId: APP_ID;

Connect to SendBird server with UserID

By default, SendBird requires only a UserID to join a channel. Upon requesting connection, SendBird queries its user database for a matching UserID. If it finds that the UserID has not been registered yet, SendBird creates a new user account. The UserID can be any unique string id, such as an email address or a UID from your database.

This simple authentication procedure is useful when you are in development or if your service does not require additional security.

Note: Explanation on SendBird's usage of Handlers and callbacks can be found under the Event Handler section.

sb.connect(USER_ID, function(user, error) {});

Note: You must connect to SendBird before calling any methods through the SDK (apart from initializing SendBird). If you attempt to call a method without connecting, you may receive an API-TOKEN is missing error.

Connect to SendBird server with UserID and Access Token

With the SendBird Platform API, you can create a user with an access token, or you can issue an access token for an existing user. Once an access token is issued, you are required to provide the user's token in the login method.

  1. Create a SendBird user account via the Platform API when your user signs up on your service.
  2. Save the access token to your secured persistent store.
  3. Load the access token in your client and pass it to the SendBird login method.
  4. For security reasons, we recommend that you periodically update your access token by issuing a new token to replace the previous one.

Note: You can set restrictions for users without access tokens in your Dashboard settings. These settings can be found under Security - Access Token Policy.

sb.connect(USER_ID, ACCESS_TOKEN, function(user, error) {});

Disconnect from SendBird server

You must disconnect from SendBird when your user no longer needs to receive messages from an online state. But users receive Group Channel messages through Push Notificions in React Native.

Disconnecting removes all registered handlers and callbacks. That is, it removes all event handlers added through sb.addChannelHandler() or sb.addConnectionHandler(). It also flushes all internally cached data, such as the channels that are cached when sb.OpenChannel.getChannel() or sb.GroupChannel.getChannel() is called.

    // You are disconnected from SendBird.

Update user profile

You can update user's nickname and profile image. Call updateCurrentUserInfo(nickname, profileUrl, callbackFunction) to update the nickname, as well as the profile picture with a URL.

sb.updateCurrentUserInfo(NICKNAME, PROFILE_URL, function(response, error) {
    if(error) {

Or, you can upload an image directly using updateCurrentUserInfoWithProfileImage(nickname, profileFile, callbackFunction).

sb.updateCurrentUserInfoWithProfileImage(NICKNAME, PROFILE_URL, function(response, error) {
    if(error) {