Creating a campaign with a combination of template and custom content


I am evaluating private-labeling CampaignMonitor and integrating it with our in-house application. One of the most important things we need to be able to do is to generate some custom content -- in this case, some HTML about one or more events -- and incorporate that into a template that the client has already configured.

I had anticipated being able to do this in the following way:
1. Call a "Get template" API method which would return the HTML
2. Find a "tag" in the HTML and insert out content in its place
3. Call a "Create campaign" API method with the adjusted content

Would this be possible with your API?


Rob Scott
Senior Vice President, LLC

jamesm, 5 years ago

Hi Rob,

You should be able to achieve what you want with a little leg-work on your side, as the current API does not support directly getting the content of a draft campaign. The process would roughly be:

* Create a base template, as normal but include your own 'tag', or placeholder inside the HTML for the dynamic content and upload it to the Client's account
* Have the client create a new draft campaign using this template
* Use the v3 API's Get Drafts method and use the PreviewUrl to pull down the content that the Client had created
* Combine the dynamic event content and the Client's content from the draft campaign into a new HTML file and then using the API, delete the old draft and create a new draft campaign using your final HTML.
* You can then allow the Client to make any final changes to the new draft and send it as normal.

Essentially, the custom code you would have to write amounts to:
* A single HTTP GET, to grab the content of the initial draft campaign
* GET any custom images the Client has included in the template and save those for your subsequent upload
* Follow each of the tracked links in the campaign, to retrieve the original URLs that they point to
* A couple of extra API calls to delete the initial draft once you've created a new one

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free