Custom Coded Site

Step 1:
Visit CometChat Administration Panel->Click on Add CometChat tab and fill the following details:

a) Site URL: Enter your domain name without http

b) Platform: Select ‘Custom Integration’ from the drop-down

Click on ‘Save’ button.


Step 2:
a) Visit the ‘Add CometChat’ tab to get the HTML code that you need to add to your site’s template. Also, add the following code to your site’s template and update the variables programmatically:

var chat_name = 'LOGGEDIN_USERS_NAME';
var chat_avatar = 'LOGGEDIN_PROFILE_IMAGE';

chat_name: Should store the name of the logged in user.
chat_id: Should be unique, numeric, not null value which stores the logged in user’s ID.
chat_avatar (optional): Should store the complete path of the profile picture of the logged in user.
chat_link (optional): Should store the profile link of the logged in user.


b) To embed CometChat to your site, visit “Add CometChat” tab in CometChat Administration Panel and copy the HTML code displayed in the section “Embed CometChat in your site page” and paste them to the location mentioned.


If you would like to use Restful APIs for user management, then you just need to add the chat_id and none of the other above variables. For more information please check Restful API documentation.

Not finding what you need?

The CometChat team is here to help!