Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including sendbird with all npm packages installed. Try it out:

var sendbird = require("sendbird")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

sendbird v3.0.140

Sendbird JavaScript SDK

Sendbird Chat SDK for JavaScript

Platform Languages npm

Table of contents

  1. Introduction
  2. Before getting started
  3. Getting started
  4. Sending your first message
  5. Appendix
  6. Changelogs


Introduction

Through Sendbird Chat SDK for Javascript, you can efficiently integrate real-time chat into your client app. On the client-side implementation, you can initialize, configure and build the chat with minimal effort. On the server-side, Sendbird ensures reliable infra-management services for your chat within the app. This read.me provides the Chat SDK’s structure, supplementary features, and the installation steps.

How it works

It is simple to implement chat in your client app with the Chat SDK: a user logs in, sees a list of channels, selects or creates an open channel or a group channel, and, through the use of the channel event handlers, sends messages to the channel, while also receiving them from other users within the channel.

More about Sendbird Chat SDK for JavaScript

Find out more about Sendbird Chat for JavaScript on Chat SDK for JavaScript doc.


Before getting started

This section shows you the prerequisites you need to check for using Sendbird Chat SDK for JavaScript. If you have any comments or questions regarding bugs and feature requests, visit Sendbird community.

Supported browsers

BrowserSupported versions
Internet Explorer10 or higher
Edge13 or higher
Chrome16 or higher
Firefox11 or higher
Safari7 or higher
Opera12.1 or higher
iOS Safari7 or higher
Android Browswer4.4 (Kitkat) or higher

More about additional features of Sendbird the the Chat SDK

Try building your Sendbird application with these two add-ons:

  • Sendbird UIKit for JavaScript: a development kit with a user interface that enables an easy and fast integration of standard chat features into new or existing client apps.
  • Sendbird SyncManager for JavaScript: the Chat SDK add-on that optimizes the user caching experience by interlinking the synchronization of the local data storage with the chat data in Sendbird server through an event-driven structure.


Getting started

This section gives you information you need to get started with Sendbird Chat SDK for JavaScript.

Try the sample app

The fastest way to test the Chat SDK is to build your chat app on top of our sample app. To create a project for the sample app, download the app from our GitHub repository. The link is down below.

  • https://github.com/sendbird/Sendbird-JavaScript

You can also download the sample using a git command:

$ git clone https://github.com/sendbird/SendBird-JavaScript

Note: Find out more about Sendbird SDK for JavaScript samples on https://sample.sendbird.com

Different sample projects

For JavaScript, Sendbird supports a variety of sample projects. Their installation procedures are detailed as below:

Run the web sample projects

There are three web sample projects: basic sample, live chat sample, and widget sample. To run the sample projects, do the following to use NodeJS for your local server:

  1. Download and install NodeJS if your system doesn't have it yet.
  2. Open a terminal and move to the project path.
$ cd web-basic-sample
  1. Install packages that are used in the sample project.
$ npm install
  1. Run the sample project.
$ npm start

Run the React Native sample project

Our React Native sample project is built on the Redux pattern of React Native. To run the sample, do the following:

  1. Download and install NodeJS if your system doesn't have it yet.
  2. Setup the React Native environment in your system.
  3. Open a terminal and enter the commands below in your project path.
$ cd react-native-redux-sample/ReactNativeWithSendBird
$ npm install
  1. Run the sample app by entering the commands below.
$ react-native run-ios
$ react-native run-android

Before entering the two commands above, you should run the simulator from the Android Studio in advance. The command for iOS works without further action.

Here are the steps to install Chat SDK

Follow the simple steps below to build the Chat SDK into your client app.

Step 1: Create a Sendbird application from your dashboard

A Sendbird application comprises everything required in a chat service including users, message, and channels. To create an application:

  1. Go to the Sendbird Dashboard and enter your email and password, and create a new account. You can also sign up with a Google account.
  2. When prompted by the setup wizard, enter your organization information to manage Sendbird applications.
  3. Lastly, when your dashboard home appears after completing setup, click Create + at the top-right corner.

Regardless of the platform, only one Sendbird application can be integrated per app; however, the application supports communication across allSendbird’s provided platforms without any additional setup. Sendbird currently supports iOS, Android, web, .NET, and Unity client apps.

Note: All the data is limited to the scope of a single application, thus the users in different Sendbird applications are unable to chat with each other.

Step 2: Install the Chat SDK

If you’re familiar with using external libraries or SDKs, installing the Chat SDK is simple.You can install the Chat SDK with package manager npm or yarn by entering the command below on the command line.

  • Npm

Note: To use npm to install the Chat SDK, Node.js must be first installed on your system.

$ npm install sendbird (request to npm server)

Install via Npm and import like below in your TypeScript file.

import * as SendBird from "sendbird";
var sb = new SendBird({ appId: "APP_ID" });
// do something...

If you have trouble importing Sendbird, please check your tsconfig.json file and change the value of allowSyntheticDefaultImports to true in compilerOptions.

  • Yarn
$ yarn add sendbird

Or download the latest Chat SDK for JavaScript from the following link if you do not want to use package manager

  • https://github.com/sendbird/Sendbird-SDK-JavaScript

Note: You should also add axios library into the

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free