Engagement Email API Display Issue

contacts
engagements

#1

Email engagements created via the HubSpot API display differently in the HubSpot UI to those created by HubSpot's native email integration. The API created emails lack detail and show incorrect information in the Team Activity view. This can confuse HubSpot users. Examples of the discrepancies are highlighed in the attached images.

  1. The title line for emails created by the native integration include details of the "from" and "to" addresses (ref image 1). The title line for the API created engagement email is "New logged email" without detail regarding the "to" or "from" email addresses (ref image 2).
  • If they think to do so, users ca view the "from" email by mousing over the person icon (most people do not think to do this)
  • There is no way to view who the email was sent "to" (refer to image 2 and 3)
  1. If you are the HubSpot user whose user account is used to authenticate the API call (i.e. OAuth2 user) the title line for the API created engagement email is "You logged an email" and has the same issues as the prior point
  2. Detail in the "Team Activity" view (dashboard report "Sales > Team Activity") is quite misleading. In example image 4:
  • it is presented as though the email was sent to tim@redacted.com, which is not correct; in this example the email is from tim@redacted.com and to person.test@gmail.com
  • it is presented as though HubSpot User "Tim X" sent the email, however that is not correct. HubSpot user "Tim X" is the OAuth account used to load the email into HubSpot. In this case neither the sender or receiver are configured HubSpot users in the portal.

Image 1: Native Email Look

Image 2: Engagement Email via API

Image 3: Engagement via API as OAuth user

Image 4:Team Activity view

Here is an example API call body that reproduces this issue:

{
"engagement": {
"type": "EMAIL",
"timestamp": "1541631478000"
},
"associations": {
"contactIds": ["651",
"201"],
"companyIds": ,
"dealIds":
},
"attachments": ,
"metadata": {
"from": {
"email": "tim@redacted.com"
},
"html": "<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"><meta name="Generator" content="Microsoft Word 15 (filtered medium)"><body lang="EN-AU" link="#0563C1" vlink="#954F72"><div class="WordSection1"><p class="MsoNormal">.. this is the email content

<p class="MsoNormal"> 
(Migration ID: <SY3PR01MB12760B57014A301C95750...redacted...>)",
"subject": "Here Is an Email",
"to": [{
"email": "person.test@gmail.com"
}],
"text": "(Migration ID: <SY3PR01MB12760B57014A301C95750...redacted...>)"
}
}

Using the HubSpot API it is possible to query back the same created email engagement and confirm that the "to" and "from" detail was correctly accepted by HubSpot:

{
"metadata": {
"cc": ,
"to": [{
"email": "trujay.test@gmail.com"
}],
"bcc": ,
"from": {
"email": "tim@redacted.com"
},
"html": "<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"><meta name="Generator" content="Microsoft Word 15 (filtered medium)"><body lang="EN-AU" link="#0563C1" vlink="#954F72"><div class="WordSection1"><p class="MsoNormal">.. this is the email content

<p class="MsoNormal">&nbsp
;
(Migration ID: )",
"text": "(Migration ID: <SY3PR01MB12760B57014A301C9575...redacted...>)",
"sender": {
  },
  "subject": "Here Is an Email",
  "emailSendEventId": {
  	
  },
  "validationSkipped": [],
  "attachedVideoOpened": false,
  "attachedVideoWatched": false

},
"engagement": {
"id": 1416891663,
"type": "EMAIL",
"active": true,
"portalId": 5113094,
"createdAt": 1541633245997,
"createdBy": 3759955,
"timestamp": 1541631478000,
"modifiedBy": 3759955,
"lastUpdated": 1541633245997,
"allAccessibleTeamIds":
},
"attachments": ,
"associations": {
"dealIds": ,
"ownerIds": ,
"quoteIds": ,
"ticketIds": ,
"companyIds": ,
"contactIds": [201,
651],
"contentIds": ,
"workflowIds":
}
}": ,
"ownerIds": ,
"quoteIds": ,
"ticketIds": ,
"companyIds": ,
"contactIds": [201,
651],
"contentIds": ,
"workflowIds":
}
}


#5

Hi @Tim,

Thank you for documenting this feedback so thoroughly! I was able to easily replicate the behavior.

I'll share your discovery with the relevant product teams.

It's worth noting, however, that you can get a name and/or email to appear after "New logged email" by including either a firstName or lastName field in the to array after the email field. These fields are shown in the metadata example in this documentation.

For example, this request:

{
    "engagement": {
        "type": "EMAIL",
        "timestamp": 1542104772000
    },
    "associations": {
        "contactIds": [100001],
        "companyIds": [ ],
        "dealIds": [ ],
        "ownerIds": [ ]
    },
"metadata": {
    "from": {
      "email": "fischy@hubspot.com>"
    },
    "to": [
      {
        "email": "it@hubspot.com"
      }
    ],
    "cc": [],
    "bcc": [],
    "subject": "This is the subject of the second received email",
    "html": "<div>This is the body of the second received email</div><div><br></div><div>-Me</div>",
    "text": "This is the body of the second received email\n\n-Me"
}
}

produces this email engagement:

In contrast, this request:

{
    "engagement": {
        "type": "EMAIL",
        "timestamp": 1542104772000
    },
    "associations": {
        "contactIds": [100001],
        "companyIds": [ ],
        "dealIds": [ ],
        "ownerIds": [ ]
    },
"metadata": {
    "from": {
      "email": "fischy@hubspot.com>",
      "firstName": "Here",
      "lastName": "Fischy"
    },
    "to": [
      {
        "email": "it@hubspot.com",
        "firstName": "Isaac",
        "lastName":"Test"
      }
    ],
    "cc": [],
    "bcc": [],
    "subject": "This is the subject of the received email",
    "html": "<div>This is the body of the received email</div><div><br></div><div>-Me</div>",
    "text": "This is the body of the received email\n\n-Me"
}
}

produces this email engagement:

You can even include the recipient's full name in the email field:

{
    "engagement": {
        "type": "EMAIL",
        "timestamp": 1542024000
    },
    "associations": {
        "contactIds": [100001],
        "companyIds": [ ],
        "dealIds": [ ],
        "ownerIds": [ ]
    },
"metadata": {
    "from": {
      "email": "it@hubspot.com",
      "firstName": "Isaac",
      "lastName": "Test"
    },
    "to": [
      {
        "email": "Here Fischy <fischy@hubspot.com>"
      }
    ],
    "cc": [],
    "bcc": [],
    "subject": "This is the subject of the email",
    "html": "<div>This is the body of the email</div><div><br></div><div>-Me</div>",
    "text": "This is the body of the email\n\n-Me"
}
}

which produces: