Templates: access from API ?


While browsing the API docs, I found nothing regarding Templates used in campaigns: it seems we can only use 2 of the 3 options proposed in the online creation of campaign (Text, HTML, and not the third one: using a template).

Am I right ? If so, is it planned ?

Mathew Mathew, 7 years ago


Yes, you are right, it isn't possible to create template campaigns via the API (since the client would still need to login to edit the content anyway, it hasn't been requested very often).

We're not currently planning to change that, but will record your suggestion.

Get in touch with us on Twitter: http://twitter.com/campaignmonitor
We're also on Facebook: http://facebook.com/campaignmonitor
Joomailer Joomailer, 7 years ago


We at Joomailer would also love to see this implemented into the API. Could you add a "$template_id" parameter to the $cm->campaignCreate function?
It would also be great if the mail content could be passed as string and not only wrapped into a .html site.

What we're planning to do with Joomailer is the ability to create template campaigns from the Joomla backend by selecting one or more articles that have been created within Joomla. These articles are HTML formatted so that they should be well useable as mail content.

I think the fewest people use CampaignMonitor to send plain text mails so the API's Campaign.Create is a bit obsolete at this point. :-/

Kind Regards,

Joomailer.com - Campaign Monitor Integration for Joomla!
Phil Phil, 7 years ago

Hi Pete,

It's possible i'm misunderstanding you, and if so i apologise.

The only campaigns the API can send as HTML ones, and they can be as nicely-formatted as you like. There's no reason to limit them to just text. From the point of view of Joomailer there's no reason you couldn't use a Joomla template to create and edit a campaign. Once it's finished make it linkable and use that as the HTML link in Campaign.Create. You'll be laughing :)

In terms of creating campaigns from Campaign Monitor templates, unfortunately it's not as simple as passing a templateID into Campaign.Create. We then need to find a way to determine populate the template with content, and that won't be trivial. We've added your voice to the request, but we can't promise when it will happen.

Joomailer Joomailer, 7 years ago

I think you showed me the right way to go. :D
I focused on using the campaign monitor templates but since the API doesnt support that we'll create some Joomla templates that are configured for the newsletter. For example mootools.js is inserted automatically by Joomla, but that can be modified by some code in the template's head.
I allready did some test campaigns and it works really well to send the whole joomla template in a mail. There are some things we still need to sort out for example to remove any javascript from the site or the user friendlyness to create the content and get the URL but nothing that can't be solved.


Joomailer.com - Campaign Monitor Integration for Joomla!
JSJ, 6 years ago

I have a follow up question on this thread.

When sending a campaign via the API, you are required to provide the HTML content via a callout (url) from CM back to your own system, instead of using a pre-defined template. Makes sense. My question is, what can be contained in the HTML that is delivered back to CM through this URL? Specifically, can this HTML stream contain the template tags, custom fields, and $variables such that the HTML will be merged with data for each specific customer at the time of delivery (first name, etc)? Basically, can you send in a "template" yourself via the URL you implement, containing the mail merge tags so each message will be customized per recipient?

Thanks in advance.

Blake, 6 years ago

My question is, what can be contained in the HTML that is delivered back to CM through this URL?

Any tags that you can use in a normal HTML campaign can be used in a campaign that you import using the API. So you can use the date tags, quick links (such as web version and forward to a friend), as well as personalisation tags (including any custom fields you may have).

bc173, 6 years ago


Would be great if I could create a campaign using a template through the API. Was planning on implementing this today until I found out this is not possible (yet).

tobystokes, 6 years ago


Here's why it would be useful: We've got a client who wan't to send some complicated table stuff in an otherwise standard templated email. We're going to build a tool for them to generate some html from an excel document that would otherwise be impracticably long-winded to create a template for. Ideally this could then be inserted into an editable area of an existing template via the API.

vivojack, 6 years ago


This would be a great feature for my clients who don't want to have to leave their own website to do anything.  Currently I am creating custom templates outside of campaign monitor which can then be populated from mysql using php, but it would be nice to have one set of templates, not two.



jamesd jamesd, 4 years ago

Hey all,

Sorry it's been a long time coming, but we're happy to announce that we've implemented the ability to create a campaign from a template in the Campaign Monitor API.

Please be sure to check out the API docs for full details. Hope that helps.

Also, you can subscribe to our API Announcements forum for regular API updates.

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