CometChat Pro enables you to add voice, video & text chat for your website & app.
This guide demonstrates how to add chat to a Javascript application using CometChat. Before you begin, we strongly recommend you read the Key Concepts guide.
Signup for CometChat and then:
- Create a new app: Enter a name & hit the + button
- Head over to the API Keys section and click on the Create API Key button
- Enter a name and select the scope as Auth Only
- Now note the API Key and App ID
First, install via npm
Shell
For v1.8.x and older:
npm install @cometchat-pro/chat@1.8.14 --save
For v2.0.x:
npm install @cometchat-pro/chat@2.0.4 --save
Then, import the CometChat
object wherever you want to use CometChat
JavaScript
import { CometChat } from "@cometchat-pro/chat"
Include the CometChat Javascript library in your HTML code
For v1.8.x and older:
<script type="text/javascript" src="https://unpkg.com/@cometchat-pro/chat@1.8.14/CometChat.js"></script>
For v2.0.x:
<script type="text/javascript" src="https://unpkg.com/@cometchat-pro/chat@2.0.4/CometChat.js"></script>
To learn more, please refer to our Javascript Developer Documentation:
For v1.8.x and older: Documentation
For v2.0.0-beta: Documentation