SOLVED

Re: Automating Email creation using API

Go to solution
JayLevine
Level 1

Automating Email creation using API

Hello,

I have an automation that I created for Hubspot that I need to recreate in Marketo. I'm looking for insight into whether there are API endpoints to do these same things, or maybe a different workflow. Maybe point me at what endpoints to look at.

 

I have read through the API documentation, and it looks like this should be possible. But the documentation doesn't have enough details for me to be sure.

 

I have a data file with new activities. I use that data file to create a new email, listing all the activities in a "template" that was created for this automation.

With Hubspot process currently is:

  • check if images for activities are in the file library, get their URL if they are, or upload if not
  • upload template (updated with file URLs from above)
  • clone the latest version of the email using this template
    • this creates a draft email with the new template just uploaded
    • it copies any email lists assigned to the old email
    • replace the subject and preview in the email with new info

This currently works great in Hubspot. One of the marketing people clicks to start the process in my application. Then goes to Hubspot to send a test email, and if all looks good then hits send.

 

Also, could you point me to where I can find tokens to replace pre-defined footers, unsubscribe blocks...

 

Thanks,

Jay

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Automating Email creation using API


Thanks for the reply and your insights! I did mean that the template would be updated, not created new every time.

You still don't want to touch the Email Template asset.

 

You might fork a new email that's based on the template, or reuse a single tokenized email (my recommendation). But updating the template is a bad idea.

 


In looking at the smart campaign batch/schedule that's where the tokens are updated and the email is scheduled. Our usual workflow includes a QA of the email before we send it. Is there a way to do this with the smart campaign? I know there's an option to schedule out in the future...but if we schedule for a day later so we can QA, we'd still need to be sure to reschedule for sooner, or cancel (or whatever the correct term is).

There's no native concept of a QA/preflight. But you can have one Smart Campaign that serves as QA. If (for example) 15 minutes have gone by without anybody interacting with your app to stop the production run, then you launch the production Smart Campaign.

 


I can see we would likely have 4 or 5 tokens for the email. One of them would be the list of all the new content we are highlighting (which could be 2 activities, or 10 or 15 depending on the week). I see token details defined in the "Understanding My Tokens in a Program" document where there's a limit for text tokens of 2 MB but doesn't list any limits for the other tokens. Are there limits for the RTF token type?

There is a limit for Rich Text but it seems to change periodically. It's currently at least 2 MB. I can't see a situation where you'd need even close to 1 MB of markup in an email, that's gigantic!

 


Also, I see for the email endpoints there are options to send samples, and view a preview. Is there a way to do that with the smart campaign?


Nothing native (see above).

View solution in original post

4 REPLIES 4
SanfordWhiteman
Level 10 - Community Moderator

Re: Automating Email creation using API

Not sure how familiar you are with how Marketo works, but creating a new template every time this process runs — while possible using the API — is definitely not the typical approach, any more than it would be the approach using the Marketo UI.

 

Rather, you have a single template and you create a new email based on the template.

 

Even better, you have a single email whose contents are all tokenized, and you simply pass the token values as part of a Request Campaign or Schedule Campaign call.


But building this requires a fluency in the standard Marketo process of creating personalized/tokenized emails.

 


Also, could you point me to where I can find tokens to replace pre-defined footers, unsubscribe blocks...

There are no pre-defined footers unless you’re speaking of the {{system.unsubscribeLink}}. You can search here for Greg Michel’s great guide to the Unsubscribe Link. It has many nooks and crannies, too much to restate in this thread.

JayLevine
Level 1

Re: Automating Email creation using API

Thanks for the reply and your insights! I did mean that the template would be updated, not created new every time.

 

In looking at the smart campaign batch/schedule that's where the tokens are updated and the email is scheduled. Our usual workflow includes a QA of the email before we send it. Is there a way to do this with the smart campaign? I know there's an option to schedule out in the future...but if we schedule for a day later so we can QA, we'd still need to be sure to reschedule for sooner, or cancel (or whatever the correct term is).

 

It looks like we should create smart campaigns within a program to take advantage of program features. 

 

I can see we would likely have 4 or 5 tokens for the email. One of them would be the list of all the new content we are highlighting (which could be 2 activities, or 10 or 15 depending on the week). I see token details defined in the "Understanding My Tokens in a Program" document where there's a limit for text tokens of 2 MB but doesn't list any limits for the other tokens. Are there limits for the RTF token type?

 

Also, I see for the email endpoints there are options to send samples, and view a preview. Is there a way to do that with the smart campaign?

 

Thanks again!

Jay

SanfordWhiteman
Level 10 - Community Moderator

Re: Automating Email creation using API


Thanks for the reply and your insights! I did mean that the template would be updated, not created new every time.

You still don't want to touch the Email Template asset.

 

You might fork a new email that's based on the template, or reuse a single tokenized email (my recommendation). But updating the template is a bad idea.

 


In looking at the smart campaign batch/schedule that's where the tokens are updated and the email is scheduled. Our usual workflow includes a QA of the email before we send it. Is there a way to do this with the smart campaign? I know there's an option to schedule out in the future...but if we schedule for a day later so we can QA, we'd still need to be sure to reschedule for sooner, or cancel (or whatever the correct term is).

There's no native concept of a QA/preflight. But you can have one Smart Campaign that serves as QA. If (for example) 15 minutes have gone by without anybody interacting with your app to stop the production run, then you launch the production Smart Campaign.

 


I can see we would likely have 4 or 5 tokens for the email. One of them would be the list of all the new content we are highlighting (which could be 2 activities, or 10 or 15 depending on the week). I see token details defined in the "Understanding My Tokens in a Program" document where there's a limit for text tokens of 2 MB but doesn't list any limits for the other tokens. Are there limits for the RTF token type?

There is a limit for Rich Text but it seems to change periodically. It's currently at least 2 MB. I can't see a situation where you'd need even close to 1 MB of markup in an email, that's gigantic!

 


Also, I see for the email endpoints there are options to send samples, and view a preview. Is there a way to do that with the smart campaign?


Nothing native (see above).

Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Automating Email creation using API

While I stand by Sandy's recommendation of leveraging tokens to customize the emails instead of recreating it (email / email template) every time, but here are quick links to endpoints that you can possibly explore:

1. Query file name in Marketo by name: https://developers.marketo.com/rest-api/assets/files/#by_name

2. Upload image in design studio, check out Sandy's comment on the linked thread and link to the create/update file on the dev docs

3.  Check out the Clone Email template endpoint here and update template endpoint here.

 

Before proceeding with the solution, I strongly suggest and recommend getting to know Marketo a lil bit better to come up with a solution to pull off the same using a better and a cleaner approach (hint: tokens) .