What is the best way to programmatically create an email using an existing template and new content? For example, I have a template called "Marketing" which I can retrieve using the "Get Email Template by Id" call. I would like to create a form which would be hosted on our Intranet which allows different groups to enter text and create their own message and save it (i.e., group1-june, group2-june, etc.) it to Marketo. Essentially I want to merge department specific content with my approved template using the API.
Many thanks!
Developers.marketo.com should help. I've had a similar request before the API was really capable of doing this sort of thing. Should be available now, at least for Email 1.0. Sounds like a pretty big build though.
Josh - Thanks for the reply. I have been through developers.marketo.com which nicely describes individual API calls. At this point I am pretty comfortable using the MKTO Asset API. My question is what sequence of API calls do I need to call?
Thx
/Scott
Merging of this sort has been historically done using using the Request Campaign API, which is designed to couple preset templates with runtime options. You can find many discussions in the Community.
But if you're talking about saving (not sending) an email I would recommend you tokenize your emails, then use the API to clone the emails into new programs and set token values at the program level. Certainly when you talk about different departments that sounds like different programs to me.
As Sanford said, sending an email with email contents specified by the form submitter is different than creating a new email asset in Marketo using specified email template.
Case 1: For the first case, i.e. sending email out to a target audience with contents specified on the form, you can use 'Request campaign API' which is at http://developers.marketo.com/documentation/asset-api/create-email
In the past, I also have used 'Import in to list' to import target audience in a list in Marketo with lead tokens merged with the information submitted on the intranet form and then have a smart campaign 'polling' for new leads added to that list. There were other reasons to do that way at that time.
This will not create a 'separate' copy of the email in Marketo to be used by the department filling the intranet form. It's basically using the same email document in Marketo each time with different lead token values. There are other variants of this approach too.
Case 2: If you want each department to have their own copy of Email document in Marketo separate from the others, then you will have to create a new email based on the template each time the form is filled. Thus we are talking about creating the email document here and not 'sending' email. Though that can be done as an extra step.
For this you will most likely use new Asset APIs. Namely, Create Email » Marketo Developers
I am also working on something similar right now.
Hope this helps
Rajesh Talele
To me, managing token and/or snippet values via API is a better design, because they are truly variables that can be modified (either via the Marketo UI or via the same form in edit mode). If you "burn" a value into email markup then editing it becomes a lot more difficult.
I agree Sanford.
Some times though, different departments may want 'their own' copy of that email (and email program) so that they can make some variations specific to their department. I guess, it depends on the business requirements and preferences.
Rajesh