3

I am developing an email locally that is tightly coupled with both AMPScript and a Python application. Almost all content including text and images uses AMPScript for one reason or another. This makes local development very hard because if you want to change anything you have to run it through the Content Builder to see your changes.

So for example if I change the font size on a headline I have to reload the page in my Python application, copy the generated HTML, save that on a public server, and then run the Content Builder in Marketing Cloud that uses httpget() to call the public page, then finally I can see what the email now looks like. It takes about 5 minutes in total for each test. Is there a better way to do this?

Solutions would include:

  • Executing AMPScript locally, maybe with dummy data.
  • Calling an API with the full HTML body and receiving the rendered result

With either solution I could develop programmatically instead of repeatedly copying and pasting HTML by hand.

5
  • Any particular reason that this has anything to do with Salesforce and thus should be posted in the Salesforce StackExchange? – brezotom Feb 23 '17 at 17:10
  • 2
    This is specifically an ExactTarget problem, and ExactTarget is part of Salesforce. Where else would I ask it ? – cbron Feb 23 '17 at 17:19
  • Ah, you are right. I missed that. Although it does seem to me that ExactTarget should have it's own separate community. I would wonder if you might get better responses on StackOverflow, though. – brezotom Feb 23 '17 at 17:25
  • In your scenario, what's the Python doing? – Adam Spriggs Feb 23 '17 at 21:11
  • Generating the email by pulling in content from a few external APIs. Not much of the email is truly static. – cbron Feb 23 '17 at 21:34
4

I would use your second option: Calling an API with the full HTML body and receiving the rendered result.

There are a couple of things you should implement to improve your development efficiency.

1. Retrieve Email Preview from API

I've documented the API method in this answer. You would need to write an app or script to parse the value of content from the response payload, but this will contain your email which has been rendered by OMM.

That will enable you to quickly generate the email personalised with a record from a sendable DE.

Note: I've only been able to get this to work with Classic Content emails, so you may need to use Classic Content during email development, then create a Content Builder email once you have completed your testing.

2. Work From Local File

To avoid having to copy and paste to a public webserver each time and preview an email from your local computer, I'd simply use Dropbox (which is free) and do the following:

  1. Save your html file to Dropbox
  2. Copy the Dropbox public link — it's persistent so you only need to do this once. You can get this link simply by right-clicking on the file or selecting the Dropbox icon in your system tray/menu and clicking 'Copy Link' next to the file.
  3. Paste the following code into your HTML email in Marketing Cloud: %%=TreatAsContent(HTTPGet('insertDropboxPublicLinkHere'))=%% (this is the only code that should appear in the email).
  4. Remove the query parameters from your Dropbox link and change 'www' to 'dl'. For example, change https://www.dropbox.com/s/i4j9xxxxh/myFile.html?dl=0 to https://dl.dropbox.com/s/i4j9xxxxh/myFile.html then paste this into the insertDropboxPublicLinkHere placeholder.
  5. Save the email

Then, each time you save changes to the HTML file on your local computer and retrieve the email preview from the API, the rendered email will reflect your changes.

4
  • This saves lots of time! cheers – Dorjee Karma Mar 3 '20 at 1:28
  • Great idea. I tried Box and it wants me to login. I haven't tried dropbox, but can anyone confirm if this still works? Although in my case, I'm using a Marketing Cloud App, so it's opening within Marketing Cloud. That may be the problem. – garek007 Mar 19 at 18:22
  • Hello @garek007, I'm not sure what you mean by 'using a Marketing Cloud App', but if you are building an email or CloudPage (or any other message), then you can use One Drive, Dropbox, Google Drive, or other services that provide a publicly accessible URL. Refer to a comprehensive set of instructions on Ivan's blog at ampscript.xyz. – Eliot Harper Mar 20 at 9:11
  • @EliotHarper I am using mine for a page not an email and serving it up in a tab in Marketing Cloud and it wants me to login. I think that's the issue. – garek007 Mar 22 at 18:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.