Exporting the Email Template Markup Source Text via API


#1

We would like to import the text of the email template from Hubspot into Salesforce. For example, if I send out 1000 emails, I’d like Salesforce to have a copy of the the email Template that was actually sent.

We have looked at the API http://developers.hubspot.com/docs/methods/templates/get_templates_template_id

Unfortunately, we are not sure how to capture the template_id. The problem is we also don’t have the template id in the data we get from Hubspot for sent email and email events.

Here is an example of the sent emails

“hs_email_last_email_name”: {
“value”: “Test nurture email 6”,
“versions”: [
{
“timestamp”: 1469631141217,
“selected”: false,
“value”: “Test nurture email 6”,
“source-label”: null,
“source-type”: “EMAIL”,
“source-id”: null
},
{
“timestamp”: 1469631138200,
“selected”: false,
“value”: “Test nurture email 5”,
“source-label”: null,
“source-type”: “EMAIL”,
“source-id”: null
},
{
“timestamp”: 1469631135356,
“selected”: false,
“value”: “Test nurture email 4”,
“source-label”: null,
“source-type”: “EMAIL”,
“source-id”: null
},

This is the example of the email event data
{
“recipient”: "dd@*****wide.com",
“hmid”: “CiRituUzYzk2…”,
“created”: 1477474234924,
“type”: “OPEN”,
“emailCampaignId”: 35356256,
“appName”: “AbBatch”,
“portalId”: 12
12,
“deviceType”: “COMPUTER”,
“location”: …
“appId”: 2
***5,
“duration”: 7151,
“userAgent”: “Mozilla/4.0 …”,
“smtpId”: null,
“sentBy”: {
“id”: “b2f3c961-a885-42a9-83bd-e3bd5c43f8ef”,
“created”: 1476284700269
},
“ipAddress”: “12.1.1.90”,
“id”: “29027358-3219-3775-825b-996356d9ece3”,
“browser”: …
}

Any hints in the right direction would be a tremendous help.