JavaScript Quickstart

This guide will help you add chat into your website in few minutes. No backend coding required!

ChatCamp enables you to add chat into your JavaScript app quickly and efficiently. Our JavaScript SDK provides you with ready-to-use native functions and code snippets to integrate chat quickly. Our SDK supports all major frameworks such as React, AngularJS, jQuery and many more. This guide will help you in setting up chat into your app.

Setup for JavaScript

1. Create a new application from ChatCamp Dashboard

You need to create a new ChatCamp application to start integrating chat SDK into your JavaScript app. The application may be created by going to our ChatCamp Dashboard.

2. Install ChatCamp JavaScript SDK

You may install ChatCamp JavaScript SDK via npm:

npm install chatcamp

Or you may download our SDK directly from here:

After downloading SDK file, place it into your project directory:

<script src="ChatCamp.min.js"></script>

Change the path of ChatCamp.min.js file as per your project structure.

3. Initialize ChatCamp JavaScript SDK

In order to integrate the chat, you would first need to initialize our ChatCamp SDK with your application ID. This initialization must be done only once across the whole app. You may do so in the user login view once the login is successful.

var cc = new ChatCamp({
  appId: APP_ID

Here APP_ID is the ChatCamp application ID which you obtained from ChatCamp Dashboard.

4. Connect to ChatCamp backend

To connect to our chat backend you would need to use our connect function. It automatically creates the user if the user doesn't exist. We offer authentication via access token as well. This is discussed later in the guide.

cc.connect(USER_ID, function(error, user) {
  if(errror === null){
	console.log("Connected to ChatCamp")

Here USER_ID is the ID of your current app user.