By default, you can add AtomChat as a docked layout on your website (i.e the chat popup on the bottom right or left of your website) or as an Embedded Layout on any page.
For a Marketplace, typically, there is a vendor listing. And the option to start a chat with any vendor is present on their profile itself.
A buyer on your website will browse through products listed by vendors.
Similar to buying something just by clicking on a 'Buy Now' button, the most efficient way to enable a buyer to connect with the seller is by adding a 'Chat Now' button on their profiles!
First, you need to create and add a 'Chat Now' button against vendor profiles. Clicking the button now has to action to open their private chat window.
We'll guide you how!
<button type="button" onclick="javascript:jqcc.cometchat.launch({uid:'1'});">Chat Now</button>
Here, you need to pass the user_id of the user to "uid" dynamically. This is the user_id of the vendor whose chat window should open.
In the above example, we have passed uid "1". This will open the chat box of the user whose user_id is "1". And this should be dynamically passed.
For example, if you are using WordPress, uid will be WordPress user_id.
Please refer to- **https://help.atomchat.com/launch-atomchat**
You may want an inbox-like layout, i.e our embedded chat window for vendors and buyers. This layout can be opened by clicking a button.
<a href="[<https://abc.com/chat?userid=123>](<https://abc.com/chat?userid=123>)">Chat with John</a>
Please replace the href value with the page URL where you have AtomChat's embedded layout on your website and pass the userid value in the URL as GET parameter.
For userid, you need to pass the value of the selected user's userid dynamically.
4. After the first click event, you are redirected to the embedded layout chat page. Then, you need to use this passed userid value in the URL to launch the selected user's chat box in the layout directly.
var url_string = window.location.href
var url = new URL(url_string);
var userid = url.searchParams.get("userid");
var setTime = setTimeout(function(){
if(typeof CometChathasBeenRun != undefined){
jqcc.cometchat.launch({"uid":userid});
}
},7000);
If you need any help with this setup, please reach out to us!
Happy to help :)