Sending content to Templates

620 views
Skip to first unread message

wayne berry

unread,
May 6, 2011, 9:00:08 AM5/6/11
to MailChimp API Discuss
Hi There,

I'm trying to send html content to mailchimp templates via the
campaignCreate() method.
code looks like this

$retval = $api->campaignCreate($type, $opts, $content);

all works great, but the content doesn't go through, i'm using one of
the standard vanilla mailchimp templates

To quote the documentation....
Supported template sections include: "html_HEADER", "html_MAIN",
"html_SIDECOLUMN", and "html_FOOTER"

but when I call the campaignTemplateContent() methoed I get totally
different sections
the sections my template has look like this

std_preheader_content, postcard_heading00, std_content00 etc

but when i try pass content into these sections it doesn't work...
tried prefixing the keys with html_ but still no luck

am i missing out on something?

wayne berry

unread,
May 6, 2011, 9:16:06 AM5/6/11
to MailChimp API Discuss
okay, just solved this if anyone else is interested...

the campaignTemplateContent() method gives the field names, but
"incorrectly"

i'd get a field from the above method called "postcard_heading00"

but when i check the mc-edit value in the actual template it's called
"repeat_1:0:postcard_heading00"

the actual mc-edit value works perfectly... just so you all know :)

jesse

unread,
May 6, 2011, 11:08:59 AM5/6/11
to MailChimp API Discuss
The documentation is correct. A more detailed discussion is here:

http://groups.google.com/group/mailchimp-api-discuss/browse_thread/thread/2fc50342e5a3544e/805a6f5d93d35fb0

From what you found, this is involved with some sections:

http://code.google.com/p/mailchimp-api/issues/detail?id=40

If you can reliably make them work, great, but they are not currently
supported as is.


jesse

adamflorin

unread,
Jun 17, 2011, 6:13:33 PM6/17/11
to MailChimp API Discuss
Thanks for the tip, Wayne. I've gotten template population working
using these "namespaced" section names as well, but it took some
digging!

For instance, to fill the two columns of a "1:2 columns" style
template, you must pass in "html_repeat_1:0:tiwc300_content00" and
"html_repeat_2:0:tiwc300_content01". I sorta reverse-engineered these
by cross-referencing the template preview & source. The pattern for
these repeatable section names appears to be:

[mc:repeatable]:[mc:repeatindex]:[mc:edit]

Madhu Shirke

unread,
Oct 12, 2012, 8:35:38 AM10/12/12
to mailchimp-...@googlegroups.com
Hi! Thanks,

Your post really helpful. Can you please suggest me how to add image the into "postcard_image" section using campaignCreate() method?

I write the code as below

template_content = {'html_repeat_1:0:postcard_heading00':"Newsletter",'html_repeat_1:0:postcard_image': "<img src="https://d2q0qd5iz04n9u.cloudfront.net/_ssl/proxy.php/http/gallery.mailchimp.com/af4fc222e52ce4538b269875e/images/Welcome1350023449.jpg">",'html_repeat_1:0:std_content00': html_content}

I also tried by passing only image path also, still its not working.
and pass this content to campaignCreate() method. Heading and content will be added. Only problem with image.
Reply all
Reply to author
Forward
0 new messages