Hey all, we recently came out with a Conversations JavaScript API, where you wouldn’t have to refresh the page. This is great for SPAs because now you can just refresh the widget and not the page itself. After some quick testing on a page of my own, I was able to identify the contact, refresh the widget programmatically, then have the ability to see the contact’s email address within the Conversations tool.
screenshot: Screenshot by Lightshot
We still can’t use personalization tokens inside the chat unless you’re using bots, but now the contacts you identify won’t show up as “Anonymous Visitor”. Here’s the code I used:
function onConversationsAPIReady() {
var _hsq = window._hsq = window._hsq || [];
console.log("ready")
_hsq.push(["identify",{
email: "test@testing.com" }]);
_hsq.push(['trackPageView']);
setTimeout( () => {
console.log("refresh")
window.HubSpotConversations.widget.refresh();
}, 1000)
}
function sendIdentify(){
if (window.HubSpotConversations) {
onConversationsAPIReady();
} else {
window.hsConversationsOnReady = [onConversationsAPIReady];
}
feel free to keep testing, but just wanted to make sure you were aware of this new JS API we have.