<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Connect _hsenc with contact ID in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Connect-hsenc-with-contact-ID/m-p/816745#M65484</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/595299"&gt;@ABorg&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;The hsenc value is a hashed value that is used to uniquely identify a contact in HubSpot. It is generated by HubSpot and is not something that you can decipher yourself. However, you can use the hsenc value to connect to the right contact back end by using the HubSpot API.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Here are the steps on how to connect the _hsenc value with the contact ID&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Create a HubSpot API key.&lt;BR /&gt;Use the HubSpot API to get the contact ID for the _hsenc value.&lt;BR /&gt;Store the contact ID in your data warehouse.&lt;BR /&gt;Here is an example of how to use the HubSpot API to get the contact ID for the _hsenc value&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;import requests

def get_contact_id(hsenc):
    url = "https://api.hubspot.com/contacts/v1/contact/by-hsenc/" + hsenc
    headers = {
        "Authorization": "Bearer YOUR_API_KEY"
    }
    response = requests.get(url, headers=headers)
    if response.status_code == 200:
        return response.json()["id"]
    else:
        return None

contact_id = get_contact_id("YOUR_HSENC_VALUE")&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;Once you have the contact ID, you can store it in your data warehouse. You can then use the contact ID to query your data warehouse for information about the contact.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jul 2023 10:02:03 GMT</pubDate>
    <dc:creator>himanshurauthan</dc:creator>
    <dc:date>2023-07-07T10:02:03Z</dc:date>
    <item>
      <title>Connect _hsenc with contact ID</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Connect-hsenc-with-contact-ID/m-p/816729#M65482</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've been looking at solutions to grab the _hsenc value with GTM, send it to our datawarehouse and then connect it with the Contact ID (or Record ID?) that I get from Hubspot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I am not sure how to decipher the _hsenc value and then connect it to the right contact back end. Any suggestions?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindly&lt;/P&gt;&lt;P&gt;Andreas&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2023 09:21:29 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Connect-hsenc-with-contact-ID/m-p/816729#M65482</guid>
      <dc:creator>ABorg</dc:creator>
      <dc:date>2023-07-07T09:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Connect _hsenc with contact ID</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Connect-hsenc-with-contact-ID/m-p/816745#M65484</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/595299"&gt;@ABorg&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;The hsenc value is a hashed value that is used to uniquely identify a contact in HubSpot. It is generated by HubSpot and is not something that you can decipher yourself. However, you can use the hsenc value to connect to the right contact back end by using the HubSpot API.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Here are the steps on how to connect the _hsenc value with the contact ID&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Create a HubSpot API key.&lt;BR /&gt;Use the HubSpot API to get the contact ID for the _hsenc value.&lt;BR /&gt;Store the contact ID in your data warehouse.&lt;BR /&gt;Here is an example of how to use the HubSpot API to get the contact ID for the _hsenc value&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;import requests

def get_contact_id(hsenc):
    url = "https://api.hubspot.com/contacts/v1/contact/by-hsenc/" + hsenc
    headers = {
        "Authorization": "Bearer YOUR_API_KEY"
    }
    response = requests.get(url, headers=headers)
    if response.status_code == 200:
        return response.json()["id"]
    else:
        return None

contact_id = get_contact_id("YOUR_HSENC_VALUE")&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;Once you have the contact ID, you can store it in your data warehouse. You can then use the contact ID to query your data warehouse for information about the contact.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2023 10:02:03 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Connect-hsenc-with-contact-ID/m-p/816745#M65484</guid>
      <dc:creator>himanshurauthan</dc:creator>
      <dc:date>2023-07-07T10:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: Connect _hsenc with contact ID</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Connect-hsenc-with-contact-ID/m-p/853225#M67638</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/20405"&gt;@himanshurauthan&lt;/a&gt;.&lt;BR /&gt;&lt;BR /&gt;I get a&amp;nbsp;&lt;SPAN&gt;404&amp;nbsp;Not&amp;nbsp;Found on the url you mentioned.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Also I couldn't find any reference to&lt;STRONG&gt;&amp;nbsp;by-hsenc&lt;/STRONG&gt; into the documentation.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I can search by utk, but I'm not able to search by hsenc.&lt;BR /&gt;&lt;A href="https://legacydocs.hubspot.com/docs/methods/contacts/get_contact_by_utk" target="_blank"&gt;https://legacydocs.hubspot.com/docs/methods/contacts/get_contact_by_utk&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Please advise.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Catalin&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 14:59:32 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Connect-hsenc-with-contact-ID/m-p/853225#M67638</guid>
      <dc:creator>cpanti</dc:creator>
      <dc:date>2023-09-21T14:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: Connect _hsenc with contact ID</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Connect-hsenc-with-contact-ID/m-p/853230#M67639</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/595299"&gt;@ABorg&lt;/a&gt;. Did you managed to solve it?&lt;BR /&gt;Thank you.&lt;/P&gt;&lt;P&gt;Catalin&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 15:00:38 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Connect-hsenc-with-contact-ID/m-p/853230#M67639</guid>
      <dc:creator>cpanti</dc:creator>
      <dc:date>2023-09-21T15:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: Connect _hsenc with contact ID</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Connect-hsenc-with-contact-ID/m-p/877419#M68962</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/20405"&gt;@himanshurauthan&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;BR /&gt;I followed your tutorial but I only get "None" values as reply. I contacted HS Support who told me that decoding the `hsenc` value is not possible. I urgently need to decode it to get the real contact_id, do you have any idea how to solve this?&lt;BR /&gt;Thanks,&lt;BR /&gt;Verena&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2023 16:54:10 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Connect-hsenc-with-contact-ID/m-p/877419#M68962</guid>
      <dc:creator>VMüller4</dc:creator>
      <dc:date>2023-11-09T16:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: Connect _hsenc with contact ID</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Connect-hsenc-with-contact-ID/m-p/918460#M70886</link>
      <description>&lt;P&gt;Is there a way to search for _hsenc in the v3 api?&lt;/P&gt;&lt;P&gt;As YOUR_API_KEY has been deprecated, headers requires YOUR_ACCESS_TOKEN instead, which returns 404 with the older v1 API above.&lt;/P&gt;&lt;P&gt;I'm trying to link the _hsenc in Google Analytics to the _hsenc in a sent email (which I assume Hubspot stores somewhere).&lt;/P&gt;&lt;P&gt;The reason for this is I dont want to use hubspotlinks for tracking clickthrus as my audience wont click through when they see the encoded URL.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2024 10:40:53 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Connect-hsenc-with-contact-ID/m-p/918460#M70886</guid>
      <dc:creator>mgraham60</dc:creator>
      <dc:date>2024-02-07T10:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Connect _hsenc with contact ID</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Connect-hsenc-with-contact-ID/m-p/919216#M70927</link>
      <description>&lt;P&gt;Some progress that I wanted to share with the community.&lt;/P&gt;&lt;P&gt;The plain text URL with _hsenc is stored in contacts -&amp;gt; properties -&amp;gt; hs_analytics_last_url.&lt;/P&gt;&lt;P&gt;However, this is not always populated - my guess is it appears in about 50% of contacts who have clicked through.&lt;/P&gt;&lt;P&gt;Here is code for API v1, which works with the new ACCESS-TOKEN. Not tried with v3 yet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import requests&lt;BR /&gt;headers = { "Authorization": "Bearer &amp;lt;YOUR-ACCESS-TOKEN&amp;gt;" }&lt;BR /&gt;url= '&lt;A href="https://api.hubapi.com/contacts/v1/contact/email/" target="_blank"&gt;https://api.hubapi.com/contacts/v1/contact/email/&lt;/A&gt;' + user_email + '/profile'&lt;BR /&gt;response = requests.get(url, headers=headers)&lt;BR /&gt;print(response.json()["properties"]["hs_analytics_last_url"])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a lot of effort to avoid hubspot's encoded click tracking URL.&lt;/P&gt;&lt;P&gt;Are there plans to address this?&lt;/P&gt;&lt;P&gt;I cannot believe I am the only one whose click-thru rates are impacted by hubspotlinks.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 09:49:03 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Connect-hsenc-with-contact-ID/m-p/919216#M70927</guid>
      <dc:creator>mgraham60</dc:creator>
      <dc:date>2024-02-08T09:49:03Z</dc:date>
    </item>
  </channel>
</rss>

