# Create a new conversation for each specific url (chatflows)

**URL:** <https://community.hubspot.com/t/create-a-new-conversation-for-each-specific-url-chatflows/90320>\
**Category:** APIs & Integrations\
**Tags:** starter\
**Created:** [September 23, 2023, 2:48am UTC](https://community.hubspot.com/t/create-a-new-conversation-for-each-specific-url-chatflows/90320 "2023-09-23T02:48:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cuongdq](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cuongdq/32/200046_2.png) [@cuongdq](https://community.hubspot.com/u/cuongdq)\
**Post date:** [September 23, 2023, 2:48am UTC](https://community.hubspot.com/t/create-a-new-conversation-for-each-specific-url-chatflows/90320/1 "2023-09-23T02:48:35Z")

</div>

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_1)  
[https://mywebsite.com/products?sp=product\_2](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

---

<div class="post-metadata">

**Author:** ![HMir](https://avatars.discourse-cdn.com/v4/letter/h/dec6dc/32.png) [@HMir](https://community.hubspot.com/u/HMir)\
**Post date:** [April 13, 2024, 6:35am UTC](https://community.hubspot.com/t/create-a-new-conversation-for-each-specific-url-chatflows/90320/2 "2024-04-13T06:35:45Z")

</div>

> * * *
> 
> @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_1)  
> [https://mywebsite.com/products?sp=product\_2](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](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.
