I’m trying to log emails to the CRM via the API, with the appropriate from/to names and email addresses. The docs show different ways to structure the payload on different pages, but I haven’t been able to get anything to work.
Here is the payload I’m sending, with the hs_email_headers value copied directly from the docs:
{
"properties": {
"hs_timestamp": "2019-10-30T03:30:17.883Z",
"hs_email_text": "Test test test",
"hs_email_subject": "Test Subject",
"hs_email_direction": "EMAIL"
},
"hs_email_headers": "{\"from\":{\"email\":\"from@domain.com\",\"firstName\":\"FromFirst\",\"lastName\":\"FromLast\"},\"sender\":{\"email\":\"sender@domain.com\",\"firstName\":\"SenderFirst\",\"lastName\":\"SenderLast\"},\"to\":[{\"email\":\"ToFirst+ToLast<to@test.com>\",\"firstName\":\"ToFirst\",\"lastName\":\"ToLast\"}],\"cc\":[],\"bcc\":[]}",
"associations": [{
"to": {
"id": 40958
},
"types": [{
"associationCategory": "HUBSPOT_DEFINED",
"associationTypeId": 198
}]
}]
}
I have also tried including the hs_email_headers value as json instead of a string. Both methods result in an email being successfully logged and associated to the Contact record, but the hs_email_header values I passed are ignored. The email is logged with the Contact’s name for “To” instead of the one I passed, and nothing for “From.”
Has anyone been able to get this to work?
