AnsweredAssumed Answered

Fetching email contents from API

Question asked by 6ee27fa7966b1a4aca9d0e0f3bf2f787e2ab2cb4 on Aug 11, 2017
Latest reply on Feb 5, 2018 by Ambika Sowmyan

I'm working on a portion of our CRM integration with Marketo which requires us to store the contents of an email in Marketo.


What I'm doing here is caching the activity feed and then in the CRM, pull any related email activities from that cache to show our employees that this contact was recently emailed. From there they want to be able to view the contents of the email itself.


I pull down a list of all emails available in Marketo from /rest/asset/v1/emails.json which I store. Then I loop over those and pull the contents of that meta data from /rest/asset/v1/email/[email id]/content.json.


The problem I'm having is that the data returned from content.json is a large array with all the components of the email broken out in to objects. With 'fancy' emails I will essentially need to convert that to an HTML doc which will a) draw out development time significantly and b) be unlikely to look like what we actually sent to customers.


My question - is there a way to pull the body in a way that I don't need to flatten and parse the array to HTML? Eg, the body itself, already arranged rather than the components or modules of the body.