How can I capture a visitor's email address if he/she is already a contact in Hubspot? C# or javascript


#1

I would like to capture a website (outside Hubspot) visitor's email address and use it elsewhere in my web application, benefiting from that this visitor is already a contact in Hubspot and thus known. How do I do that? either via C# or Javascript...

thanks


#2

Hi @finnhelmo, you should be able to use the Identify a visitor function on your page with JS.


#4

As far as I understand that one, it does the opposite of what I need: it assumes I already know the email and then SETs it.

What I need is that I need to GET the email address of a visitor on my website, based on that they are already Hubspot contacts (so it will of course not work if my website user is not a contact).


#5

Ah I see @finnhelmo, thanks for that clarifying point. If that's the case, you could conceivably make a request to this endpoint based off of the logged in user's hutk (HubSpot usertoken) to retrieve their email address. This doesn't support CORS/AJAX requests though, so this action would have to be handled server-side on your end