Hi, I’m getting this error by using
onclick="window.hubspot.messages.EXPERIMENTAL_API.requestWidgetOpen();
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
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.
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/405402
I hope that helps!
Hello MatthewShepherd,
This worked for me
window.HubSpotConversations.widget.open()
Exactly what I was looking for,
Thank you so much!