Create a new conversation for each specific url (chatflows)

I have embedded your livechat on my website.
I have a page showing each product like this:
https://mywebsite.com/products?sp=product_1
https://mywebsite.com/products?sp=product_2

How can clicking on product_1 open a conversation for product_1
Clicking on product_2 opens the chat for product_2

Each conversation for each product is independent of each other
Looking forward to your help

I use javascript and nextjs


@cuongdq wrote:

I have embedded your livechat on my website.
I have a page showing each product like this:
https://mywebsite.com/products?sp=product_1
https://mywebsite.com/products?sp=product_2

How can clicking on product_1 open a conversation for product_1
Clicking on product_2 opens the chat for product_2

Each conversation for each product is independent of each other
Looking forward to your help

I use javascript and nextjs


To enable distinct conversations for each product on your website using JavaScript and Next.js, you can use the URL parameters to trigger different chat sessions. Begin by capturing the product identifier from the URL when a user navigates to a product page. In Next.js, this can be achieved using the useRouter hook to access query parameters. For instance, if each product page URL is structured like https://mywebsite.com/products?sp=product_1, you can extract the product ID (product_1, product_2, etc.) from the sp query parameter. Next, integrate this product ID with your live chat system’s API. If your live chat solution allows for JavaScript-based commands, you can programmatically start a new chat session keyed to the specific product ID. This ensures that each product interaction remains independent, creating a unique conversation stream based on the product being viewed. This method enhances user experience by aligning chat discussions with the user’s current context, making support or sales interactions more relevant and efficient.