how to get identity of user in conversations

SOLVE
Highlighted
Occasional Contributor

Hi,

 

i would like to add the Conversations Chat UI in our react portal. Integration works fine.

But now, if a user is loggedin in our portal, i would set the user email into the chat.

I've read here in the forum and implemented the code above. This code works in most cases, but not in every case. 

What's wrong with that?

What must i do, do implement it more stable?

The code is executed after the login and i see the email in the console log.

  static setChatIdentity = (email) => {
    if (window.HubSpotConversations) {
      this.onConversationsAPIReady(email);
    } else {
      window.hsConversationsOnReady = [this.onConversationsAPIReady(email)];
    }
  }

  static onConversationsAPIReady = (email) => {
    console.log("onConversationsAPIReady", email);
    setTimeout(() => {
      var _hsq = window._hsq = window._hsq || [];
      _hsq.push(["identify", {
        email: email
      }]);
      _hsq.push(["trackPageView"]);
      setTimeout(() => {
        console.log("refresh", email)
        _hsq.push(["identify", {
          email: email
        }]);
        _hsq.push(["trackPageView"]);
        window.HubSpotConversations.widget.refresh();
      }, 2000);
    }, 2000);
  }

Thanks for any help or hint.

 

Regards

   Steffen...

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
Highlighted
HubSpot Moderator

Hi, @stundzigs.

 

Please see my response here. For convenience, here is the most relevant excerpt from my solution:

 

...there is currently no way to guarantee that a chat won't come in under an "Unknown Visitor," even with the method outlined above, which works much of the time.

Our team is working on a dedicated solution for this use case but we currently can't offer a concrete timeframe. Please subscribe to the API Changelog to be notified of the update when it is released.

 

@cdewey22's team is currently working on the "dedicated solution" I mention.

 

See her most recent response from Friday, 14 February 2020.

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes
1 Reply 1
Highlighted
HubSpot Moderator

Hi, @stundzigs.

 

Please see my response here. For convenience, here is the most relevant excerpt from my solution:

 

...there is currently no way to guarantee that a chat won't come in under an "Unknown Visitor," even with the method outlined above, which works much of the time.

Our team is working on a dedicated solution for this use case but we currently can't offer a concrete timeframe. Please subscribe to the API Changelog to be notified of the update when it is released.

 

@cdewey22's team is currently working on the "dedicated solution" I mention.

 

See her most recent response from Friday, 14 February 2020.

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes