<?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: Api - Problem to set property hs_email_headers on incoming Email Object in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Api-Problem-to-set-property-hs-email-headers-on-incoming-Email/m-p/784758#M63341</link>
    <description>&lt;P&gt;Hey,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/556065"&gt;@tbalthazard&lt;/a&gt;. Thanks for flagging this. I'll take your example and to reproduce the issue on my end.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;Jaycee&lt;/P&gt;</description>
    <pubDate>Fri, 21 Apr 2023 04:21:27 GMT</pubDate>
    <dc:creator>Jaycee_Lewis</dc:creator>
    <dc:date>2023-04-21T04:21:27Z</dc:date>
    <item>
      <title>Api - Problem to set property hs_email_headers on incoming Email Object</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Api-Problem-to-set-property-hs-email-headers-on-incoming-Email/m-p/783956#M63291</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try to create an incoming email with api call.&lt;/P&gt;&lt;P&gt;POST&amp;nbsp;&lt;A href="https://api.hubapi.com/crm/v3/objects/emails" target="_blank" rel="noopener"&gt;https://api.hubapi.com/crm/v3/objects/emails&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Body :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "properties": {
        "hubspot_owner_id": "63590768",
        "hs_email_text": "bodyContent",
        "hs_email_subject": "test hs_email_direction incoming 1",
        "hs_email_direction": "INCOMING_EMAIL",
        "hs_timestamp": 1681894200000,
        "hs_email_status": "SENT"
    },
    "hs_email_headers": {
        "from": {
            "email": "contact1@company1.com"
        },
        "to": [
            {
                "email": "contact2@company2.com"
            },
            {
                "email": "myself@mycompany.com"
            }
        ],
        "cc": [
            {
                "email": "contact3@company3.com"
            }
        ]
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Response is 201&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when looking on hubspot CRM UI&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tbalthazard_0-1681918118452.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/89533i2E3B283723B0CA83/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tbalthazard_0-1681918118452.png" alt="tbalthazard_0-1681918118452.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;hs_email_headers have been ignored.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For an outgoing email same payload with only difference on :&lt;/P&gt;&lt;P&gt;"hs_email_direction": "EMAIL"&lt;/P&gt;&lt;P&gt;The header part in&amp;nbsp;hubspot CRM UI is right&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you helpme on this one as I surely missing something?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Tibo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2023 15:35:06 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Api-Problem-to-set-property-hs-email-headers-on-incoming-Email/m-p/783956#M63291</guid>
      <dc:creator>tbalthazard</dc:creator>
      <dc:date>2023-04-19T15:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Api - Problem to set property hs_email_headers on incoming Email Object</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Api-Problem-to-set-property-hs-email-headers-on-incoming-Email/m-p/784758#M63341</link>
      <description>&lt;P&gt;Hey,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/556065"&gt;@tbalthazard&lt;/a&gt;. Thanks for flagging this. I'll take your example and to reproduce the issue on my end.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;Jaycee&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 04:21:27 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Api-Problem-to-set-property-hs-email-headers-on-incoming-Email/m-p/784758#M63341</guid>
      <dc:creator>Jaycee_Lewis</dc:creator>
      <dc:date>2023-04-21T04:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: Api - Problem to set property hs_email_headers on incoming Email Object</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Api-Problem-to-set-property-hs-email-headers-on-incoming-Email/m-p/803938#M64674</link>
      <description>&lt;P&gt;Hello, were you able to reproduce and correct the problem?&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Tibo&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 08:34:26 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Api-Problem-to-set-property-hs-email-headers-on-incoming-Email/m-p/803938#M64674</guid>
      <dc:creator>tbalthazard</dc:creator>
      <dc:date>2023-06-07T08:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: Api - Problem to set property hs_email_headers on incoming Email Object</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Api-Problem-to-set-property-hs-email-headers-on-incoming-Email/m-p/1009598#M75005</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am facing the exact same issue. Do you have an update on this issue?&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jul 2024 15:04:10 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Api-Problem-to-set-property-hs-email-headers-on-incoming-Email/m-p/1009598#M75005</guid>
      <dc:creator>AJoshi95</dc:creator>
      <dc:date>2024-07-14T15:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: Api - Problem to set property hs_email_headers on incoming Email Object</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Api-Problem-to-set-property-hs-email-headers-on-incoming-Email/m-p/1010104#M75019</link>
      <description>&lt;P&gt;Hey &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/793250"&gt;@AJoshi95&lt;/a&gt;&lt;/SPAN&gt;, thank you for posting in our Community.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please specify what you are currently experiencing? &amp;nbsp;Since this is not a new post, the more information, screenshots, and details you can provide, the better I can advise on the next steps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kindly,&lt;/P&gt;
&lt;P&gt;Pam&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 17:05:56 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Api-Problem-to-set-property-hs-email-headers-on-incoming-Email/m-p/1010104#M75019</guid>
      <dc:creator>PamCotton</dc:creator>
      <dc:date>2024-07-15T17:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: Api - Problem to set property hs_email_headers on incoming Email Object</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Api-Problem-to-set-property-hs-email-headers-on-incoming-Email/m-p/1010672#M75039</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/60427"&gt;@PamCotton&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using Ruby gem hubspot-api-client for my integration. (I am pretty new to Hubspot integration as well as Ruby and Ruby on Rails.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is a code snippet where I am updating the Contact, Company and Email objects. The Contact, Company and Email objects get created successfully, all the associations also get created. The only issue is the Email headers not showing correctly.&lt;/P&gt;&lt;LI-CODE lang="ruby"&gt;    def save_to_crm 
        contact_association = []
        if company_name?
          company_body = {associations:[], properties:{"name":company_name, "domain": company_website}}
          company_api_response = crm_client.crm.companies.basic_api.create(body: company_body)
          if company_api_response.id
            contact_association = [{"types":[{"associationCategory": "HUBSPOT_DEFINED", "associationTypeId":1}], "to":{"id":company_api_response.id}}]
          end
        end
        contact_body = {associations:contact_association, properties:{"firstname": first_name, "lastname": last_name, "email": email_address, "company": company_name}}
        contact_api_response = crm_client.crm.contacts.basic_api.create(body: contact_body)
        if contact_api_response.id
          email_association = [{"types":[{"associationCategory": "HUBSPOT_DEFINED", "associationTypeId":198}], "to":{"id":contact_api_response.id}}]
          if company_api_response.id
            email_association[1] = {"types":[{"associationCategory": "HUBSPOT_DEFINED", "associationTypeId":186}], "to":{"id":company_api_response.id}}
          end
          email_header_hash = {"from":{"email":email_address, "firstName":first_name, "lastName":last_name}, "sender":{"email":email_address, "firstName":first_name,"lastName":last_name},"to":{"email":"info@mydomain.com", "firstName":"Info", "lastName":"MyDomain.com" }, "cc":[], "bcc":[]}
          email_body = {associations: email_association, properties:{"hs_email_direction": "INCOMING_EMAIL", "hs_email_subject": "Website Contact Us Page - Contact", "hs_email_text": message, "hs_timestamp": Time.now.utc.iso8601, "hs_email_headers": email_header_hash.to_json}}
          email_api_response = crm_client.crm.objects.emails.basic_api.create(body: email_body)
        end
    end

    def crm_client
        return Hubspot::Client.new(access_token: Rails.application.credentials.dig(:hubspot, :API_KEY))
    end&lt;/LI-CODE&gt;&lt;P&gt;The form used to capture the data:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AJoshi95_1-1721137409735.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/122454iBA17933AD78B31B8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AJoshi95_1-1721137409735.png" alt="AJoshi95_1-1721137409735.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Resulting Company record:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AJoshi95_2-1721137655505.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/122457iA2093C8D28266949/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AJoshi95_2-1721137655505.png" alt="AJoshi95_2-1721137655505.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Notice the data highlighted in yellow.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AJoshi95_3-1721137764447.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/122459i05040BC628B267B4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AJoshi95_3-1721137764447.png" alt="AJoshi95_3-1721137764447.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Company, Contact and associations updated correctly but the email header details are blank.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AJoshi95_4-1721137814164.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/122460i42F1830F7EB0A193/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AJoshi95_4-1721137814164.png" alt="AJoshi95_4-1721137814164.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2024 13:52:02 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Api-Problem-to-set-property-hs-email-headers-on-incoming-Email/m-p/1010672#M75039</guid>
      <dc:creator>AJoshi95</dc:creator>
      <dc:date>2024-07-16T13:52:02Z</dc:date>
    </item>
    <item>
      <title>Re: Api - Problem to set property hs_email_headers on incoming Email Object</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Api-Problem-to-set-property-hs-email-headers-on-incoming-Email/m-p/1046477#M76949</link>
      <description>&lt;P&gt;I want to invite our top experts &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/17186"&gt;@Anton&lt;/a&gt; and &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/76319"&gt;@DanielSanchez&lt;/a&gt;&lt;/SPAN&gt; do you have any recommendations?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;Pam&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2024 15:59:09 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Api-Problem-to-set-property-hs-email-headers-on-incoming-Email/m-p/1046477#M76949</guid>
      <dc:creator>PamCotton</dc:creator>
      <dc:date>2024-09-26T15:59:09Z</dc:date>
    </item>
  </channel>
</rss>

