# Launching chat from a link

**URL:** <https://community.hubspot.com/t/launching-chat-from-a-link/67325>\
**Category:** Tips, Tricks & Best Practices\
**Created:** [October 18, 2022, 5:46am UTC](https://community.hubspot.com/t/launching-chat-from-a-link/67325 "2022-10-18T05:46:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![FMola](https://avatars.discourse-cdn.com/v4/letter/f/85e7bf/32.png) [@FMola](https://community.hubspot.com/u/FMola)\
**Post date:** [October 18, 2022, 5:46am UTC](https://community.hubspot.com/t/launching-chat-from-a-link/67325/1 "2022-10-18T05:46:36Z")

</div>

![hubspot chat error.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/3/3/33c5d7170b2be5c448904bcb612bdf163d978a5c.png)

Hi, I’m getting this error by using

`onclick="window.hubspot.messages.EXPERIMENTAL_API.requestWidgetOpen();`

---

<div class="post-metadata">

**Author:** ![kvlschaefer](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kvlschaefer/32/71076_2.png) [@kvlschaefer](https://community.hubspot.com/u/kvlschaefer)\
**Post date:** [October 18, 2022, 7:34am UTC](https://community.hubspot.com/t/launching-chat-from-a-link/67325/2 "2022-10-18T07:34:30Z")

</div>

Hi @FMola,

Welcome to the Community!

It would be great if you can share which troubleshooting steps you have taken so far so the Community has more information to work with.

Thank you,

Kristen

---

<div class="post-metadata">

**Author:** ![FMola](https://avatars.discourse-cdn.com/v4/letter/f/85e7bf/32.png) [@FMola](https://community.hubspot.com/u/FMola)\
**Post date:** [October 18, 2022, 7:44am UTC](https://community.hubspot.com/t/launching-chat-from-a-link/67325/3 "2022-10-18T07:44:13Z")

</div>

Thanks for the prompt response kvonloesecke,  
The code below worked for me,  
document.getElementById(“hschat1”).innerHTML = ‘\<a href=“#” onclick=“window.history.pushState; window.HubSpotConversations.clear({resetWidget:true});”\>Open Chat\</a\>’  
But it’s changing the element text, is there any possibility to trigger it without changing the inner html element? It’s actually on WordPress. I can assign an id or class to the button & use onclick event to do the job.

---

<div class="post-metadata">

**Author:** ![MatthewShepherd](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/matthewshepherd/32/31314_2.png) [@MatthewShepherd](https://community.hubspot.com/u/MatthewShepherd)\
**Post date:** [October 18, 2022, 10:19am UTC](https://community.hubspot.com/t/launching-chat-from-a-link/67325/4 "2022-10-18T10:19:02Z")

</div>

Hi @FMola  
I believe the EXPERIMENTAL\_API is deprecated so you can just use window.HubSpotConversations.widget.open() in your onclick instead. Here’s an example:

`<a href="#" id="click-to-chat__cta--text" class="cta cta--blue" style="margin-top: 20px;" onclick="window.HubSpotConversations.widget.open();">Chat with Sales</a>`

and here are a few other threads that discuss this and other approaches:  
[https://community.hubspot.com/t5/Tickets-Conversations/Click-to-launch-chat/m-p/406564](https://community.hubspot.com/t5/Tickets-Conversations/Click-to-launch-chat/m-p/406564)

[https://community.hubspot.com/t5/Tickets-Conversations/Click-to-launch-chat/m-p/405402](https://community.hubspot.com/t5/Tickets-Conversations/Click-to-launch-chat/m-p/405402)  
I hope that helps!

---

<div class="post-metadata">

**Author:** ![FMola](https://avatars.discourse-cdn.com/v4/letter/f/85e7bf/32.png) [@FMola](https://community.hubspot.com/u/FMola)\
**Post date:** [October 18, 2022, 10:56am UTC](https://community.hubspot.com/t/launching-chat-from-a-link/67325/5 "2022-10-18T10:56:12Z")

</div>

Hello MatthewShepherd,  
This worked for me  
window.HubSpotConversations.widget.open()  
Exactly what I was looking for,  
Thank you so much!
