How to identify a contact in the chat?

SOLVE
LukaszWiktor
Participant

Hi,

how can I identify a visitor in the chat box? I've tried the identify API

 var _hsq = window._hsq = window._hsq || []; 
_hsq.push(["identify", { email: "${email}" }]);

but it didn't work. New chat conversations still appear as "Uknown Visitor"

I'd appreciate your help.

Thanks,
Lukasz

111 Replies 111
tilly
HubSpot Product Team

@vruben -- Thank you for checking in! Hoping to have an update for you all very soon. Keep an eye out for a product notification, and I will make sure to post a note here as well. 

0 Upvotes
justindocanto
Member

If it's possible to answer, are we talking days or weeks? We migrated to hubspot thinking the chat would be a great replacement of Intercom and are now regretting that. Chats are coming in from people without proper labeling, as you know. And every day we dont have this, it causes issues.

 

So if its days, I'll gladly wait. If it's weeks, then ill need to switch for the time being.

 

Thanks

0 Upvotes
phickling
Participant

Shouldn't the "Identify" method just update both cookies and identify the user across all services? As a dev you would expect to call "Identify" and for hubspot to stitch all the data associated with that session to the user in question, rather than having to do one thing for analytics and one thing for the chat.

0 Upvotes
avichopra
Contributor | Partner

This request has been pending for 2 years and still no solution. This platform is almost useless to request anything. 

tilly
Solution
HubSpot Product Team

The Visitor Identification API is now in public beta! You can read more about it and get started here. This is open to all Pro+ portals as of now, no need to be ungated. 

 

The new Visitor Identification API enables you to provide details about visitors' identities to the chat widget after they've been authenticated by an external login system. So, if a visitor logs in (by providing their email address), the Visitor Identification API can send their identity to HubSpot's chat widget.

 

This API also works automatically with HubSpot's private content membership for CMS Hub or Knowledge Base, no additional setup required!

 

Please let me know if you have any questions or feedback. This API is still in beta, by using this API you agree to our developer beta terms.

View solution in original post

patroqueeet
Member

Good Morning,

 

just tried it without an app, but API/Token only. Got error complaining about missing scopes:

 

{"status":"error","message":"This app hasn't been granted all required scopes to make this call. Read more about required scopes here: https://developers.hubspot.com/scopes.","correlationId":".....","errors":[{"message":"All of the following scopes are required.","context":{"requiredScopes":["conversations.visitor_identification.tokens.create"]}}],"links":{"scopes":"https://developers.hubspot.com/scopes"},"category":"MISSING_SCOPES"}

linking to dead url:

https://developers.hubspot.com/scopes

 

Pls. advice

IsaacTakushi
HubSpot Employee

Hi, @patroqueeet.

 

I'll look into this. Could you share your app ID and the scopes you are currently requiring?

 

I've learned that @tilly helped you uncover the issue directly.

 

Here are links to the most updated OAuth documentation (mentions scopes) and the older but still relevant scopes documentation.

 

For others reading this, make sure to add the conversations.visitor_identification.tokens.create scope in your app definition's Auth tab, as shown below:

 

conversations.visitor_identification.tokens.create scope.jpg

Isaac Takushi

Associate Certification Manager
0 Upvotes
cl77
Participant

It seems the visitor identification API does only create a contact, when the customer sends a chat message. Is this the intended behaviour?

 

We're sending email, firstName, lastName to get a token. Contacts should be created then if not stored at HS. 

0 Upvotes
tilly
HubSpot Product Team

Hi @cl77 -- That is correct, the Visitor Identification API only creates a contact if and when they initiate a chat.

 

To make sure I understand your use case and needs, what is your expectation for this API? How are you currently using it? Thanks!

0 Upvotes
avichopra
Contributor | Partner

Hello Hubspot team,

 

The whole visitor identification doesn't work whenever the chat is loaded on the knowledge base. Because the knowledge base is opened from our mobile app, even though we know the email the chat is not able to identify the visitor. 

Please let us know the solution for this.

 

NOTE: This must be happening because on the knowledge base loaded by Hubspot instantly loads up the chat.

 

 

0 Upvotes
jpw_andy
Participant

Hi @tilly  My company started using Hubspot this year and we're on the starter plan. We were pretty jazzed about being able to use the chat widget in our intranet to provide support to our agents, but as a result of not having automatic user identification we've had very low engagement.

 

Is there a way for me to purchase or unlock access to the new visiter identification API without upgrading my whole plan?

0 Upvotes
avichopra
Contributor | Partner

@tilly any update about my comment above?

0 Upvotes
tilly
HubSpot Product Team

Hi @avichopra - Thanks for the tag. The Visitor Identification API should work from the KB, but it sounds like we may need additional specifics to get to the root cause. I recommend reaching out to our support team for next steps in troubleshooting the behavior you are seeing.

 

Hi @jpw_andy - At this time, the Visitor Identification API will work with any Pro level subscription across any Hub (Marketing, Sales, Service, or CMS) but is not available for an individual upgrade. Thank you for this feedback!

mark_cf
Member

@tilly is it the case that to reliably identify a user in HubSpot Live Chat we need to take out a Pro level subscription?

0 Upvotes
tilly
HubSpot Product Team

Hi @mark_cf! The chat widget can also identify visitors based on existing cookies or submitted email addresses, which does not require a Pro subscription. The Visitor Identification API as a method of identifying chat visitors does require a Pro subscription. Let me know if you have additional questions!

0 Upvotes
Tomtomtom1
Member

@tilly, I'm a small business just getting started.  I can't afford to pay $800/month but hate to ask my visitors for their email when I already know it.  It's just a bad user experience for my visitors.  Seems odd that HubSpot doesn't give all users access to basic API features like this.  Are there any other ways to identify visitors without asking them for their email in the chat?  Does this code still work? https://legacydocs.hubspot.com/docs/methods/tracking_code_api/identify_visitor

John3212
Participant

Hello @tilly @IsaacTakushi 

I followed the steps from the api docs here:
https://developers.hubspot.com/docs/api/conversation/visitor-identification
but we still see users coming in inbox as  Unknown Visitors, even after setting the required params in the "window.hsConversationsSettings" object


window.hsConversationsSettings = {
  loadImmediately: false,

  identificationEmail: "visitor-email@example.com",

  identificationToken: "tokenId"

};

and then we load the widget: 

window.HubSpotConversations.widget.load();
 

I think we had like 1 or 2 persons identified with their mail, and after some logouts/logins they also started appearing as Unknown Visitors. 

Can someone provide some solution for this?

0 Upvotes
IsaacTakushi
HubSpot Employee

Hi, @John3212.

 

@dennisedson will be able to help you out here.

 

Based on your description of the issue, I suspect that the identificationEmail and identificationToken may not be set every time the page loads for an authenticated visitor. Per Step 3 in the documentation:


This context will not be carried across page loads automatically if these parameters are no longer set. Tokens are temporary and will expire after 12 hours.

Isaac Takushi

Associate Certification Manager
0 Upvotes
Sheamus
Member

Isaac ( @IsaacTakushi ),

 

A couple questions on this:

1. We are already doing this for tracking:

_hsq.push([ 'identify', {
firstName,
lastName,
email,
role, // hopefully, this works...
company: tenant
}]);

What is the relationship between this an the call to setting up Chat?

 

2. Is the only way to get the identificationToken via a seperate API call? Can it be combined with the tracking identify shown above?

 

3. Unfortunately, our appliacation is not a SPA. So lots of requests. I would prefer not to add an API call on every page request. I assume the only way to manage this is to add another cookie on our end to track when we get the identification token and then if has been more than 12 hours get a new one?

 

4. Is there a way to get an identification token without creating a contact? I dont' want to create a contact unless they actually start a chat.

 

Thanks,
~Shea M

0 Upvotes
John3212
Participant

I`ve been checking everytime in the chrome dev console to see if the mail and the token are set in the window.hsConversationsSettings object, and they are always set there, i just tried again:
T1r4in6



0 Upvotes
gregtappero
Participant

I am also seeing the same issue:

We get the proper token (JWT) and base64 decode shows proper content.
The user does exist on Hubspot.

Yet we get Unknown visitor

gregtappero_1-1614800243661.png

 

 

0 Upvotes
gregtappero
Participant

Rectification, it does work on the Hubbspot Conversations Inbox.
The issue is the slack alert that does show `HubSpotAPP Unknown visitor started a conversation`.

Maybe the slack notification is triggered before the User assignment is resolved? 

0 Upvotes