Step 1:
Visit CometChat Admin Panel->Click on Install 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 ‘Update’ button.
Step 2:
a) Visit the ‘Install’ tab and click on Docked layouts 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:
<script>
var chat_name = 'LOGGEDIN_USERS_NAME';
var chat_id = 'LOGGEDIN_USERS_UNIQUE_ID';
var chat_avatar = 'LOGGEDIN_PROFILE_IMAGE';
var chat_link = 'LOGGEDIN_USERS_PROFILE_LINK';
</script>
Where:
– 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 ‘Install’ tab in CometChat Admin Panel and click on Embedded layouts and copy the HTML code 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!