CometChat Pulse Documentation

Welcome to the CometChat Pulse documentation. You'll find comprehensive guides and documentation to help you start working with CometChat as quickly as possible. Let's jump right in!

Key Concepts

CometChat Dashboard

The CometChat Dashboard enables you to create new apps (projects) and manage your existing apps.

  • For every app, a unique App ID is generated. This App ID will be required when integrating CometChat within your app.
  • Along with the App ID, you will need to create an API Key (from the Dashboard) which can be used for user authentication.

API Keys

You can generate two types of API Keys from the dashboard.

Type
Privileges
Recommended Use

Auth Only

The API keys with authOnly scope can be used for direct login using API Key or to generate the Auth Token for users. It can not be used to perform any other platform operation.

In your client side code

Full Access

The API keys with fullAccess scope can be used to perform all the platform operations.

In your server side code

Users

A user is anyone who uses CometChat.

UID

  • Each user is uniquely identified using UID.
  • The UID is typically the primary ID of the user from your database.

Auth Token

  • A single user can have multiple auth tokens. The auth tokens should be per user per device per session.
  • It should be generated by API call ideally, via server to server call. The auth token should then be given to SDKs for login.

Authentication

To allow a user to use CometChat, the user must log in to CometChat.

CometChat does not handle user management. You must handle user registration and login at your end. Once the user is logged into your app/site, you can log in the user to CometChat programmatically. So the user does not ever directly login to CometChat.

CometChat does not handle friends management. If you want to associate friends with your users, you must handle friends management in your app. Once two users are friends (i.e. they have accepted each other as friends), then you can associate them as friends in CometChat.

Typical Workflow

Your App
Your Server
CometChat

User registers in your app

You store the user information in your database (e.g. ID, name, email, phone, location etc. in users table)

You add the user to CometChat (only ID & name) using the API

User logs in to your app

You verify the credentials, login the user and retrieve the user ID

You log in the user to CometChat using the same user ID programmatically

User sends a friend request

You display the request to the potential friend

No action required

User accepts a friend request

You display the users as friends

You add both the users as friends using the API

User Roles

A role is a category for a group of similar users. For example, you may want to group your premium users using the role "Premium". These roles can then be used to add/remove privileges for a given role using the CometChat Dashboard. For example, you may want your premium users to be able to chat to all users but free users to only be able to chat to premium users.

User List

  • The User List can be used to build the Contacts or Who's Online view in your app.
  • The list of users can be different based on the logged in user.
  • Based on the Settings in the CometChat Dashboard, this list can be all users or friends.
  • By default, all users are retrieved when the UsersRequest method (or equivalent) is called. You can customize the list returned to return friends by changing the setting in the CometChat Dashboard.

Groups

A group can be used for multiple users to communicate with each other on a particular topic/interest.

GUID

  • Each group is uniquely identified using GUID.
  • The GUID is typically primary ID of the group from your database. If you do not store group information in your database, you can generate a random string for use as GUID.

Types

CometChat supports four different types of groups:

Type
Visibility
Participation

Public

All users

Any user can choose to join

Password

All users

Any user with a valid password can choose to join

Private

Only users part of the group

Invited users will be auto-joined

Members

Once a user joins a group, they become a member of the group. Members are part of the group indefinitely i.e. they will keep receiving messages, calls & notifications. To stop, the user must either be kicked, banned or intentionally leave the group.

CometChat supports three different types of member scopes in a group:

Member
Default
Privileges

Admin

Group creator is assigned Admin scope

  • Assign Admins & Moderators
  • Kick & Ban Users
  • Send & Receive Messages & Calls
  • Update group
  • Delete group

Moderator

-

  • Update group
  • Kick & Ban Users
  • Send & Receive Messages & Calls

Participant

Any other user is assigned Participant scope

  • Send & Receive Messages & Calls

Messaging

CometChat supports two types of messages:

Type
Description

Text

By default, every message is considered as a text message.

Along with the text message, custom metadata can be sent in JSON format. For example, you can send custom metadata to identify the original message the current message is in response to (i.e. to implement reply feature).

Media

Any media message like files, audio & video.

Along with the media message, custom metadata can be sent in JSON format. For example, you can add metadata to send a caption along with the media message.

Limitations

  • Real-time user information (presence) is available for first 1000 users (when retrieving all users) or first 1000 friends per user (when retrieving friends).
  • Groups are limited to 1000 members per group

Key Concepts


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.