CometChatUIKit is a class that contains all necessary methods to help initialize the CometChat SDK with valid credentials for the ui kit to utilize.
The following properties and methods are present:
sendTextMessage
Used to send text messages.- TypeScript
sendMediaMessage
used to send media messages- TypeScript
sendCustomMessage
Used to send custom messages.- TypeScript
Send Form message
This method allows you to send Form messages which are the extension of Interactive Message- 1:1 chat
- Group chat
Send Card message
This method allows you to send Card messages which are the extension of Interactive Message- 1:1 chat
- Group chat
Send CustomInteractive message
This method allows you to send CustomInteractive messages which are the extension of Interactive Message- 1:1 chat
- Group chat
UIKitSettings
UIKitSettings is an object containing credentials to initialize CometChat SDK.How to initialize the UI Kit?
The UI Kit can be initialized to use CometChatUIKit by populating the auth settings first and the calling the init method. Preferably this should be done at the top most level when the app starts.infoMake sure you replace the APP_ID, REGION and AUTH_KEY with your CometChat App ID, Region and Auth Key in the below code. The
Auth Key is an optional property of the UIKitSettings Class. It is intended for use primarily during proof-of-concept (POC) development or in the early stages of application development. You can use the Auth Token method to log in securely.- JavaScript
How to login a user of your App?
Only theUID of a user is needed to log in. This simple authentication procedure is useful when you are creating a POC or if you are in the development phase. For production apps, we suggest you use AuthToken instead of Auth Key.
- JavaScript
How to login a user with Auth Token?
This advanced authentication procedure does not use the Auth Key directly in your client code thus ensuring safety.- Create a User via the CometChat API when the user signs up in your app.
- Create an Auth Token via the CometChat API for the new user and save the token in your database.
- Load the Auth Token in your client and pass it to the
login({authToken: authToken})method.
- JavaScript
How to create a new user for your App?
Create an object the new user that needs to created with as little information as the name of the user and a uid and pass it to the create(user: User) method- JavaScript
How to update a user for your App?
Update an object the user that needs to updated with as little information as the name of the user and a uid and pass it to theupdate(user: User) method
- JavaScript
How to logout from a logged-In User in App?
just pass the loggedIn-user to the logout method- JavaScript