Creating Partial Drafts Through API


I was just wondering if it was possible to create a partial draft through the API (ie. only submitting email name, subject, from name, from email, template, etc.) and then direct the user to the email editor on Campaign Monitor to finish off the process.  Is this possible?  If it is, how would I go about doing it? (Using php wrapper)


jamesd jamesd, 4 years ago

If you want to use a template, you can create a campaign from a template and just pass in empty content.

So if you were using the PHP client library and following the sample code, you'd just do something like this:

$template_content = array(
  'Singlelines' => array(),
  'Multilines' => array(),
  'Images' => array(),
  'Repeaters' => array()
$result = $wrap->create_from_template('Client ID', array(
    'Subject' => 'Campaign Subject',
    'Name' => 'Campaign Name',
    'FromName' => 'Campaign From Name',
    'FromEmail' => 'Campaign From Email Address',
    'ReplyTo' => 'Campaign Reply To Email Address',
    'ListIDs' => array('First List', 'Second List'),
    'SegmentIDs' => array('First Segment', 'Second Segment'),
    'TemplateID' => 'Template ID',
    'TemplateContent' => $template_content

That would specify empty content for the TemplateContent field, and therefore allow someone to fill in the content in the editor.

Hope that helps.

stevenOHO, 4 years ago

Thanks for the reply.

I did as you suggested and I've run into a problem that I can't seem to figure out.  When I submit the details of the post, it comes back with the following:

object(stdClass)#65 (2) {
  string(110) "Failed to deserialize your request. 
Please check the documentation and try again.
Fields in error: campaign"

I checked a couple things and it seems that everything works fine (ie. the data being passed gets serialized properly) until it gets to this line of the "_call" function:

$call_result = $this->_transport->make_call($call_options);

What is the problem I'm runnning into? And how can I fix it?


jamesd jamesd, 4 years ago

Hey, sorry - that original value for TemplateContent won't serialise correctly. I've just modified my original post above with the value which will work (in the $template_content variable).

See why 200,000 companies worldwide love Campaign Monitor.

From Australia to Zimbabwe, and everywhere in between, companies count on Campaign Monitor for email campaigns that boost the bottom line.

Get started for free