chatWith API assists you to dynamically launch a chat box directly from your web paget. The chatWith API is used to launch a chat box. The input parameter is the user’s ID or group id with whom the conversation has to be initiated .
For one-on-one chatbox
jqcc.cometchat.chatWith(USERID);
For group chatbox
jqcc.cometchat.chatWith({'groupid':groupid});
The ideal use of this function is in profile pages i.e. to add a “Chat with me” link to profiles.
<a href="javascript:void(0)" onclick="javascript:jqcc.cometchat.chatWith(1);">Chat with me<a>
If ‘Hangout’ named group’s id is 2, then code will be:
<a href="javascript:void(0)" onclick="javascript:jqcc.cometchat.chatWith({'groupid':2});">Open Hangout Group<a>
Not finding what you need?
The CometChat team is here to help!